Request Headers

The X-Dz-* request headers that drive attribution, session identity and per-request routing, and the two headers the gateway returns.

Request Headers

Gateway controls ride X-Dz-* request headers rather than the request body, so every official vendor SDK can drive them through a first-class, typed parameter (default_headers and its equivalents).

Every X-Dz-* header listed here is stripped before the request is forwarded upstream. The provider never sees them.

Attribution headers

These label a request so its cost can be attributed. All are optional.

HeaderValue
X-Dz-UserCost-attribution user.
X-Dz-TeamCost-attribution team.
X-Dz-ProjectCost-attribution project.
X-Dz-EnvCost-attribution environment.
X-Dz-LabelsFree-form labels, key1=val1,key2=val2. Malformed pairs are skipped rather than failing the request.

Source headers

These record where a request came from, for correlating gateway traffic with the workload that produced it.

HeaderValue
X-Dz-NamespaceKubernetes source namespace.
X-Dz-WorkloadKubernetes source workload.
X-Dz-PodKubernetes source pod.

Behavioural headers

HeaderValue
X-Dz-Session-IdYour own conversation id. The router pins its first routing decision to it, so a mid-conversation profile edit cannot swap the model and reset the provider's prompt cache.
X-Dz-Workload-TypeThe workload type you are declaring. Used for per-workload cache scoping, and it is the axis evidence is grouped by.
X-Dz-RouterThe canonical carrier for the per-request routing override: the dz_router object as raw compact JSON, maximum 8192 bytes.

Why the session id is worth sending

The session is the unit of this domain. It is resolved in precedence order:

  1. The X-Dz-Session-Id header you supplied.
  2. A session id extracted from a recognised client surface.
  3. Auto-inference from the source pod, the system-prompt hash and a credential salt, within a sliding window.

Only the first is a stable session key -- one that came from you and is therefore comparable across turns. An inferred identity is recorded separately and never substituted for a client-supplied one, because it fragments a conversation: a reconnecting client presents the same conversation under a new identity, so an absent prior turn says nothing about whether a warm prefix existed.

Anything that reasons about a previous turn -- cache-miss classification, cross-turn cache-bust pricing, holdout arm stickiness -- requires a stable session key and falls back to "unknown" rather than guessing. Sending X-Dz-Session-Id is the single cheapest thing you can do to improve the quality of your own measurements.

X-Dz-Router rules

SituationResult
Sent once, valid JSON, known fieldsApplied as the most specific rung of the routing ladder.
Sent on the header and as the dz_router body field400 dz_router_conflict, even if the two are byte-identical. There is no precedence rule.
Sent twice as a repeated header400 invalid_dz_router.
Over 8192 bytes400 dz_router_too_large, with a message pointing at routing profiles -- the server-side mechanism for large steering configurations.
Carrying an unknown fieldRefused, not ignored (invalid_dz_router). A typo must never silently do nothing.

Response headers

Keyed inference responses carry two headers:

HeaderValue
X-Dz-Request-IdThe id the trace and telemetry rows for this request are stored under.
X-CacheMISS, HIT or SEMANTIC-HIT. Stamped MISS before the cache is consulted and overwritten by whichever hit path serves, so the value is exhaustive.

Both are emitted on keyed inference only. Passthrough traffic is forwarded byte-identically in both directions, so nothing is added there.

On this page