# Media API

## List own asynchronous video jobs

`GET /v1/video-jobs` · operation `quotaVideoReadList`

Requires quota_video, video_generation, a currently authorized route:video key, matching key/team ownership and active model/provider snapshot. GET never calls upstream; refresh is explicit, rate limited and leased. Unknown execution keeps its budget. No automatic paid create replay.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `limit` | query | integer, min 1, max 50 |  |
| `offset` | query | integer, min 0, max 10000 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Job metadata; native secret and prompt omitted | `application/json`: object |
| `400` | Invalid version or bounded body | — |
| `401` | Credential required | — |
| `403` | Route or model forbidden | — |
| `404` | Job absent, not owned or feature disabled | — |
| `409` | Job version, lease or destination changed | — |
| `429` | Poll interval or quota limit | — |
| `503` | Required database or upstream unavailable | — |

Response `200` fields:

- `application/json`: object
  - `items` (array of [QuotaVideoJob](/docs/api/schemas/q/#quotavideojob), max items 50)
  - `limit` (integer (int64), min 1)
  - `offset` (integer, min 0)


## Read own persisted video job

`GET /v1/video-jobs/{id}` · operation `quotaVideoRead`

Requires quota_video, video_generation, a currently authorized route:video key, matching key/team ownership and active model/provider snapshot. GET never calls upstream; refresh is explicit, rate limited and leased. Unknown execution keeps its budget. No automatic paid create replay.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[a-f0-9]{32}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Job metadata; native secret and prompt omitted | `application/json`: [QuotaVideoJob](/docs/api/schemas/q/#quotavideojob) |
| `400` | Invalid version or bounded body | — |
| `401` | Credential required | — |
| `403` | Route or model forbidden | — |
| `404` | Job absent, not owned or feature disabled | — |
| `409` | Job version, lease or destination changed | — |
| `429` | Poll interval or quota limit | — |
| `503` | Required database or upstream unavailable | — |


## Cancel or delete own video task

`DELETE /v1/video-jobs/{id}` · operation `quotaVideoCancel`

Requires quota_video, video_generation, a currently authorized route:video key, matching key/team ownership and active model/provider snapshot. GET never calls upstream; refresh is explicit, rate limited and leased. Unknown execution keeps its budget. No automatic paid create replay.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[a-f0-9]{32}$` |  |

**Request body** (required)

- `application/json`: [QuotaVideoVersion](/docs/api/schemas/q/#quotavideoversion)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Job metadata; native secret and prompt omitted | `application/json`: [QuotaVideoJob](/docs/api/schemas/q/#quotavideojob) |
| `400` | Invalid version or bounded body | — |
| `401` | Credential required | — |
| `403` | Route or model forbidden | — |
| `404` | Job absent, not owned or feature disabled | — |
| `409` | Job version, lease or destination changed | — |
| `429` | Poll interval or quota limit | — |
| `503` | Required database or upstream unavailable | — |


## Refresh a video job from its captured provider

`POST /v1/video-jobs/{id}/refresh` · operation `quotaVideoRefresh`

Requires quota_video, video_generation, a currently authorized route:video key, matching key/team ownership and active model/provider snapshot. GET never calls upstream; refresh is explicit, rate limited and leased. Unknown execution keeps its budget. No automatic paid create replay.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[a-f0-9]{32}$` |  |

**Request body** (required)

- `application/json`: [QuotaVideoVersion](/docs/api/schemas/q/#quotavideoversion)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Job metadata; native secret and prompt omitted | `application/json`: [QuotaVideoJob](/docs/api/schemas/q/#quotavideojob) |
| `400` | Invalid version or bounded body | — |
| `401` | Credential required | — |
| `403` | Route or model forbidden | — |
| `404` | Job absent, not owned or feature disabled | — |
| `409` | Job version, lease or destination changed | — |
| `429` | Poll interval or quota limit | — |
| `503` | Required database or upstream unavailable | — |


## POST /v1/images/generations

`POST /v1/images/generations` · operation `generateImage`

JSON passthrough; requires images capability.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Gateway-Tags` | header | string, max length 2048 | Optional explicit JSON string map for model inference only. With usage_tag_defaults, finite defaults come from the authenticated team and explicit values override matching names; an absent header or an empty JSON object preserves defaults. One header, at most 2 KiB and eight pairs; finite configured enum. Requires usage_tags and authentication/model/team/RPM admission. Never forwarded or added to logs/traces/metric labels/cache identity. Not supported for MCP or models inventory. Tags do not authorize access or establish financial attribution. |
| `X-Gateway-End-User` | header | string, min length 1, max length 128 | Optional client-declared end user (1–128 printable characters) recorded under end_user_tracking. Takes precedence over the OpenAI user body field. Untrusted metadata: never authorization, routing, cache identity or a log/metric label. Required when the key's or its team's require block sets end_user (attribution_requirements): a request without it answers 400 missing_attribution before any provider call. |
| `X-Gateway-Session-Id` | header | string, min length 1, max length 128 | Optional client-declared session or agent-run ID (1–128 printable characters) recorded under session_tracking to group requests in logs. Untrusted metadata: never authorization, routing or cache identity. |
| `X-Gateway-Agent-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared agent that made this request (1–128 printable characters), kept with the session's agent graph. Asserted, never authentication; ignored with the flag off; an invalid or repeated value answers 400 invalid_agent_context. |
| `X-Gateway-Turn-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared turn this request belongs to (1–128 printable characters). Asserted; same rules as X-Gateway-Agent-Id. |
| `X-Gateway-Parent-Session-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional session that spawned this one (a sub-agent run), 1–128 printable characters. Asserted; ignored when equal to X-Gateway-Session-Id; same rules as X-Gateway-Agent-Id. |
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |
| `traceparent` | header | string | W3C trace context. Invalid values create a new trace. |

**Request body** (required)

- `application/json`: object
  - `model` (string, required) — Public model alias

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `422` | Model does not support this operation | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `429` | Gateway RPM, key or team concurrency cap (concurrency_limit_exceeded, T135) or applicable token/USD quota ceiling reached; the request was not forwarded upstream. | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `502` | Provider unavailable | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `default` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |


## POST /v1/images/edits

`POST /v1/images/edits` · operation `editImage`

OpenAI Images edit passthrough (T074). Requires the image_generation flag, key scope route:image_edits and a model alias with the image_edits capability. JSON (images: 1-16 {image_url} references, data or https URLs, optional mask or markup) or multipart/form-data (image or image[] files, optional mask or markup file); only the model is replaced and every other byte is forwarded. file_id references are refused with 422 file_id_unsupported: they name files in the provider account the gateway does not own. markup with mask is refused (400). Streams (image_edit.partial_image events) pass through unvalued. Priced like a generation of the same model (per image, or per token by category with image_token_pricing).

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Gateway-Tags` | header | string, max length 2048 | Optional explicit JSON string map for model inference only. With usage_tag_defaults, finite defaults come from the authenticated team and explicit values override matching names; an absent header or an empty JSON object preserves defaults. One header, at most 2 KiB and eight pairs; finite configured enum. Requires usage_tags and authentication/model/team/RPM admission. Never forwarded or added to logs/traces/metric labels/cache identity. Not supported for MCP or models inventory. Tags do not authorize access or establish financial attribution. |
| `X-Gateway-End-User` | header | string, min length 1, max length 128 | Optional client-declared end user (1–128 printable characters) recorded under end_user_tracking. Takes precedence over the OpenAI user body field. Untrusted metadata: never authorization, routing, cache identity or a log/metric label. Required when the key's or its team's require block sets end_user (attribution_requirements): a request without it answers 400 missing_attribution before any provider call. |
| `X-Gateway-Session-Id` | header | string, min length 1, max length 128 | Optional client-declared session or agent-run ID (1–128 printable characters) recorded under session_tracking to group requests in logs. Untrusted metadata: never authorization, routing or cache identity. |
| `X-Gateway-Agent-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared agent that made this request (1–128 printable characters), kept with the session's agent graph. Asserted, never authentication; ignored with the flag off; an invalid or repeated value answers 400 invalid_agent_context. |
| `X-Gateway-Turn-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared turn this request belongs to (1–128 printable characters). Asserted; same rules as X-Gateway-Agent-Id. |
| `X-Gateway-Parent-Session-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional session that spawned this one (a sub-agent run), 1–128 printable characters. Asserted; ignored when equal to X-Gateway-Session-Id; same rules as X-Gateway-Agent-Id. |
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |
| `traceparent` | header | string | W3C trace context. Invalid values create a new trace. |

**Request body** (required)

- `application/json`: object
  - `model` (string, required)
  - `prompt` (string, required, min length 1, max length 32000)
  - `images` (array of object, required, min items 1, max items 16)
    - `image_url` (string, required) — data: URL or https URL fetched by the provider
  - `mask` (object)
    - `image_url` (string, required)
  - `markup` (object)
    - `image_url` (string, required)
- `multipart/form-data`: object
  - `model` (string, required)
  - `prompt` (string, required)
  - `image` (string (binary), required) — One image; repeat image[] for up to 16
  - `mask` (string (binary))
  - `markup` (string (binary))

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `422` | Model does not support this operation | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `429` | Gateway RPM, key or team concurrency cap (concurrency_limit_exceeded, T135) or applicable token/USD quota ceiling reached; the request was not forwarded upstream. | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `502` | Provider unavailable | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `default` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |


## POST /v1/audio/speech

`POST /v1/audio/speech` · operation `generateSpeech`

JSON request and the provider's audio as the answer; requires the audio_speech capability. T198: the clip is relayed as the provider sends it (chunked, flushed per read). A clip the provider cut after it started aborts the connection (HTTP/1.1: no terminating chunk; HTTP/2: RST_STREAM), so a client never reads a truncated clip as a whole one; the request is recorded with status 200 and error_code stream_interrupted, and counted as a provider error. A client that disconnects cancels the provider call and is recorded with error_code client_closed_stream. A clip that fails before its first byte is answered 502 stream_interrupted instead. A request priced per character is charged in full once the clip started, as the provider charges it. With speech_buffer on and models[].speech.delivery buffer the answer is the whole clip with Content-Length, 502 stream_interrupted when the provider cut it, or 502 speech_buffer_exceeded when it is longer than speech.buffer_max_mib; the cost of a buffered clip answered as an error is unknown. Targets on the polly protocol (speech_polly), the azure_speech protocol (speech_azure) and the gemini protocol (speech_gemini) are translated from the OpenAI form; a member the provider has no equivalent for is refused with 422 unsupported_on_provider, and a target whose flag is off answers 404 feature_disabled. Gemini returns 24 kHz PCM only: response_format must be pcm or wav; its text is sent as a direction and the transcript (Say: &lt;input&gt;, or &lt;instructions&gt;: &lt;input&gt;); a text Gemini refuses before any audio answers 422 speech_refused and counts no provider failure.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Gateway-Tags` | header | string, max length 2048 | Optional explicit JSON string map for model inference only. With usage_tag_defaults, finite defaults come from the authenticated team and explicit values override matching names; an absent header or an empty JSON object preserves defaults. One header, at most 2 KiB and eight pairs; finite configured enum. Requires usage_tags and authentication/model/team/RPM admission. Never forwarded or added to logs/traces/metric labels/cache identity. Not supported for MCP or models inventory. Tags do not authorize access or establish financial attribution. |
| `X-Gateway-End-User` | header | string, min length 1, max length 128 | Optional client-declared end user (1–128 printable characters) recorded under end_user_tracking. Takes precedence over the OpenAI user body field. Untrusted metadata: never authorization, routing, cache identity or a log/metric label. Required when the key's or its team's require block sets end_user (attribution_requirements): a request without it answers 400 missing_attribution before any provider call. |
| `X-Gateway-Session-Id` | header | string, min length 1, max length 128 | Optional client-declared session or agent-run ID (1–128 printable characters) recorded under session_tracking to group requests in logs. Untrusted metadata: never authorization, routing or cache identity. |
| `X-Gateway-Agent-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared agent that made this request (1–128 printable characters), kept with the session's agent graph. Asserted, never authentication; ignored with the flag off; an invalid or repeated value answers 400 invalid_agent_context. |
| `X-Gateway-Turn-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared turn this request belongs to (1–128 printable characters). Asserted; same rules as X-Gateway-Agent-Id. |
| `X-Gateway-Parent-Session-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional session that spawned this one (a sub-agent run), 1–128 printable characters. Asserted; ignored when equal to X-Gateway-Session-Id; same rules as X-Gateway-Agent-Id. |
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |
| `traceparent` | header | string | W3C trace context. Invalid values create a new trace. |

**Request body** (required)

- `application/json`: object
  - `model` (string, required) — Public model alias

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The clip, as the provider's audio bytes (the Content-Type is the provider's; audio/pcm;rate=24000 or audio/wav for Gemini). Streamed unless the alias buffers it. | `audio/*`: string (binary) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled: audio_speech is off, or the flag of the target's speech provider is | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `422` | Model does not support this operation | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `429` | Gateway RPM, key or team concurrency cap (concurrency_limit_exceeded, T135) or applicable token/USD quota ceiling reached; the request was not forwarded upstream. | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `502` | Provider unavailable | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `default` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |


## GET /v1/audio/voices

`GET /v1/audio/voices` · operation `listSpeechVoices`

T198 (speech_voices, off by default): the voices of the speech aliases the key may use, per provider and model. A voice comes from the alias's own declaration (models[].speech.voices), else from the provider's voice list (ElevenLabs, Amazon Polly for the target's engine, Azure AI Speech), else from the documented voices of the model (OpenAI tts-1, tts-1-hd and gpt-4o-mini-tts; Gemini's prebuilt voices). Provider lists are read with the connection's credential and kept in memory for five minutes per replica; one listing waits 10 seconds at most. The key needs the route:audio_speech scope. The listing grants nothing: /v1/audio/speech applies its own checks. Not an inference request: nothing is charged or written to the request log.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |
| `traceparent` | header | string | W3C trace context. Invalid values create a new trace. |
| `model` | query | string, max length 256 | One speech alias; without it, every speech alias the key may use. An unknown alias, one outside the key or one without the audio_speech capability answers 404. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Voices per alias, provider and provider model | `application/json`: object |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled (speech_voices or audio_speech is off) or model_not_found | `application/json`: [Error](/docs/api/schemas/e/#error) |

Response `200` fields:

- `application/json`: object
  - `object` (`"list"`, required)
  - `data` (array of [SpeechVoice](/docs/api/schemas/s/#speechvoice), required)
  - `unavailable` (array of object, required) — Targets whose voices could not be listed
    - `model` (string, required) — The alias
    - `provider` (string, required)
    - `provider_model` (string) — Present only with server.response_headers.served_target
    - `reason` (string, required, one of `"unknown_model"`, `"provider_disabled"`, `"provider_unavailable"`) — unknown_model: no list exists for this model, declare speech.voices on the alias; provider_disabled: the flag of the target's speech provider is off; provider_unavailable: the provider's list could not be read (remembered for 30 seconds, then read again)


## POST /v1/audio/transcriptions

`POST /v1/audio/transcriptions` · operation `transcribeAudio`

Multipart passthrough; replaces model form field and preserves file bytes. Maximum 8 MiB.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Gateway-Tags` | header | string, max length 2048 | Optional explicit JSON string map for model inference only. With usage_tag_defaults, finite defaults come from the authenticated team and explicit values override matching names; an absent header or an empty JSON object preserves defaults. One header, at most 2 KiB and eight pairs; finite configured enum. Requires usage_tags and authentication/model/team/RPM admission. Never forwarded or added to logs/traces/metric labels/cache identity. Not supported for MCP or models inventory. Tags do not authorize access or establish financial attribution. |
| `X-Gateway-End-User` | header | string, min length 1, max length 128 | Optional client-declared end user (1–128 printable characters) recorded under end_user_tracking. Takes precedence over the OpenAI user body field. Untrusted metadata: never authorization, routing, cache identity or a log/metric label. Required when the key's or its team's require block sets end_user (attribution_requirements): a request without it answers 400 missing_attribution before any provider call. |
| `X-Gateway-Session-Id` | header | string, min length 1, max length 128 | Optional client-declared session or agent-run ID (1–128 printable characters) recorded under session_tracking to group requests in logs. Untrusted metadata: never authorization, routing or cache identity. |
| `X-Gateway-Agent-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared agent that made this request (1–128 printable characters), kept with the session's agent graph. Asserted, never authentication; ignored with the flag off; an invalid or repeated value answers 400 invalid_agent_context. |
| `X-Gateway-Turn-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared turn this request belongs to (1–128 printable characters). Asserted; same rules as X-Gateway-Agent-Id. |
| `X-Gateway-Parent-Session-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional session that spawned this one (a sub-agent run), 1–128 printable characters. Asserted; ignored when equal to X-Gateway-Session-Id; same rules as X-Gateway-Agent-Id. |
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |
| `traceparent` | header | string | W3C trace context. Invalid values create a new trace. |

**Request body** (required)

- `multipart/form-data`: object
  - `model` (string, required)
  - `file` (string (binary), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `422` | Model does not support this operation | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `429` | Gateway RPM, key or team concurrency cap (concurrency_limit_exceeded, T135) or applicable token/USD quota ceiling reached; the request was not forwarded upstream. | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `502` | Provider unavailable | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `default` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |


## POST /v1/videos/generations

`POST /v1/videos/generations` · operation `generateVideo`

Without quota_video, JSON passthrough to the configured path requires video capability. With quota_video, Runway aliases use the native bounded profile described below; other providers retain their configured passthrough contract, subject to applicable quota-profile admission. For Runway: model is a public alias; promptText has 1–1000 UTF-16 units; ratio is 1280:720 or 720:1280; duration is an integer 2–10 seconds. An Idempotency-Key of 16–128 URL-safe characters is required. The durable intent is recorded before paid submission; repeating an intent never resubmits the upstream create. The response is gateway job metadata, not a provider completion or invoice. Unknown execution preserves budget.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Gateway-Tags` | header | string, max length 2048 | Optional explicit JSON string map for model inference only. With usage_tag_defaults, finite defaults come from the authenticated team and explicit values override matching names; an absent header or an empty JSON object preserves defaults. One header, at most 2 KiB and eight pairs; finite configured enum. Requires usage_tags and authentication/model/team/RPM admission. Never forwarded or added to logs/traces/metric labels/cache identity. Not supported for MCP or models inventory. Tags do not authorize access or establish financial attribution. |
| `X-Gateway-End-User` | header | string, min length 1, max length 128 | Optional client-declared end user (1–128 printable characters) recorded under end_user_tracking. Takes precedence over the OpenAI user body field. Untrusted metadata: never authorization, routing, cache identity or a log/metric label. Required when the key's or its team's require block sets end_user (attribution_requirements): a request without it answers 400 missing_attribution before any provider call. |
| `X-Gateway-Session-Id` | header | string, min length 1, max length 128 | Optional client-declared session or agent-run ID (1–128 printable characters) recorded under session_tracking to group requests in logs. Untrusted metadata: never authorization, routing or cache identity. |
| `X-Gateway-Agent-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared agent that made this request (1–128 printable characters), kept with the session's agent graph. Asserted, never authentication; ignored with the flag off; an invalid or repeated value answers 400 invalid_agent_context. |
| `X-Gateway-Turn-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional client-declared turn this request belongs to (1–128 printable characters). Asserted; same rules as X-Gateway-Agent-Id. |
| `X-Gateway-Parent-Session-Id` | header | string, min length 1, max length 128 | agent_sessions (T033.002). Optional session that spawned this one (a sub-agent run), 1–128 printable characters. Asserted; ignored when equal to X-Gateway-Session-Id; same rules as X-Gateway-Agent-Id. |
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |
| `traceparent` | header | string | W3C trace context. Invalid values create a new trace. |
| `Idempotency-Key` | header | string, min length 16, max length 128 | Required under quota_video; stable unique intent key |

**Request body** (required)

- `application/json`: object
  - `model` (string, required) — Public model alias

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `422` | Model does not support this operation | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `429` | Gateway RPM, key or team concurrency cap (concurrency_limit_exceeded, T135) or applicable token/USD quota ceiling reached; the request was not forwarded upstream. | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `502` | Provider unavailable | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `default` | Provider status, content type and body passed through after model alias replacement. | `application/json`: object<br/>`application/octet-stream`: string (binary) |

