Headers Reference

All X-BR-* request and response headers.

Request Headers

These headers control BrainstormRouter behavior on a per-request basis.

HeaderTypeDescription
AuthorizationBearer Required. API key (br_live_... or br_test_...).
X-BR-Guardian: offstringSkip Guardian intelligence processing.
X-BR-Skip-Memory: truestringSkip memory read/write for this request. Useful for stateless agents.
X-User-IdstringIdentify the end-user or agent. Used for per-agent budget enforcement. Falls back to body.user.
X-Conversation-IdstringThread requests into a conversation. Also accepted as conversation_id in the request body.

Response Headers

Returned on POST /v1/chat/completions responses.

Guardian Headers

HeaderTypeExampleDescription
X-BR-Guardian-StatusstringpassGuardian processing result: pass, warn, block, off.
X-BR-Estimated-Coststring0.0023Pre-request cost estimate in USD.
X-BR-Actual-Coststring0.0019Post-request actual cost in USD.
X-BR-Efficiencystring1.21Cost efficiency ratio (estimated / actual). Values >1 mean under-budget.
X-BR-Guardian-Overhead-Msstring1.2Guardian processing latency in milliseconds (target: <5ms p95).

Routing Headers

HeaderTypeExampleDescription
X-BR-Modelstringclaude-sonnet-4-5-20250514Actual model ID used (after alias/auto resolution).
X-BR-ProviderstringanthropicProvider that served the request.
X-BR-Route-Reasonstringauto:complexity-highWhy this model was selected (when using model: "auto").

Cost & Usage Headers

HeaderTypeExampleDescription
X-Model-Router-Coststring0.0019Total cost for this request in USD.
X-Model-Router-Latency-Msstring1423End-to-end latency in milliseconds.

Using Headers with OpenAI SDKs

from openai import OpenAI

client = OpenAI(
    base_url="https://api.brainstormrouter.com/v1",
    api_key="br_live_...",
)

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Hello"}],
    extra_headers={
        "X-BR-Skip-Memory": "true",
        "X-User-Id": "agent-research-01",
    },
)

# Access response headers
print(response._response.headers.get("X-BR-Actual-Cost"))
print(response._response.headers.get("X-BR-Model"))
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.brainstormrouter.com/v1",
  apiKey: "br_live_...",
});

const response = await client.chat.completions.create(
  {
    model: "auto",
    messages: [{ role: "user", content: "Hello" }],
  },
  {
    headers: {
      "X-BR-Skip-Memory": "true",
      "X-User-Id": "agent-research-01",
    },
  },
);