Skip to content

Response headers

DirectInference returns a few headers that let you observe how a request was handled — without ever exposing the model behind it.

Every response on the DI surface carries an X-DI-Request-Type header naming the request type the call was classified as — pro, code, vision, document, long, json, reason, or flash. It is a fact about your own request (a PDF makes it a document request), so it is safe to surface; the model that served it stays private.

# The OpenAI SDK exposes raw response headers via with_raw_response.
raw = client.chat.completions.with_raw_response.create(
model="gpt-5.5-mini",
messages=[{"role": "user", "content": "Refactor this function."}],
)
print(raw.headers.get("x-di-request-type")) # -> "code"
resp = raw.parse() # the usual typed completion
print(resp.choices[0].message.content)

If the calling key — or your account — has a spend cap set, successful responses carry standard rate-limit headers that express the cap as a request budget, so an SDK can self-throttle. Keys with no cap (the default) receive none.

On the OpenAI and Gemini surfaces:

  • x-ratelimit-limit-requests — the cap expressed as a whole-request budget
  • x-ratelimit-remaining-requests — budget left in the current window
  • x-ratelimit-reset-requests — seconds until the window resets

The Anthropic surface uses that provider’s spelling — anthropic-ratelimit-requests-limit, anthropic-ratelimit-requests-remaining, and anthropic-ratelimit-requests-reset (an RFC 3339 timestamp). All are allow-listed in Access-Control-Expose-Headers. When a request is actually blocked by a cap, the 402 carries a Retry-After instead — see Spend & limits.

There is no resolved-model header. Other services hand back the model they picked; DirectInference does not — not in a header, not in the body, not in a trailer. The response echoes the model id you sent and nothing about the candidate, provider, version, cost, or trace that produced it.