Pass custom HTTP headers with your requests for tracing, user attribution, and logging.

Image generation

import { RouterBrain } from '@router-brain/sdk';

const rb = new RouterBrain('sk-your-api-key');

const result = await rb.image({
  model: 'dall-e-3',
  prompt: 'A beautiful landscape',
  headers: {
    'x-trace-id': 'trace-001',      // Correlate logs with this request
    'x-user-id': 'user-123',        // Identify the end user
    'x-agent-name': 'my-agent',     // Identify your app or agent
  },
}).json();

These values are forwarded to upstream services and recorded in usage logs for troubleshooting and attribution.

HeaderUse it to
x-trace-idTrace a request across systems
x-user-idAttribute usage to a specific end user
x-agent-nameIdentify which application made the call

OpenAI / Anthropic interfaces

For chat and message calls, pass headers through the native SDK mechanisms of openai and @anthropic-ai/sdk.

See also

Initialization · Image generation