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.
| Header | Use it to |
|---|---|
x-trace-id | Trace a request across systems |
x-user-id | Attribute usage to a specific end user |
x-agent-name | Identify 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.