Skip to content

Embeddings and rerank API

POST /v1/embeddings · operation createEmbedding

JSON passthrough; requires embeddings 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
application/octet-stream: string (binary)
400 Invalid input application/json: Error
401 Missing or invalid bearer key application/json: Error
403 Model not allowed application/json: Error
422 Model does not support this operation application/json: 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
502 Provider unavailable application/json: Error
503 Local concurrency limit reached application/json: Error
default Provider status, content type and body passed through after model alias replacement. application/json: object
application/octet-stream: string (binary)

POST /v1/rerank · operation rerank

JSON passthrough to configured path; requires rerank 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
application/octet-stream: string (binary)
400 Invalid input application/json: Error
401 Missing or invalid bearer key application/json: Error
403 Model not allowed application/json: Error
422 Model does not support this operation application/json: 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
502 Provider unavailable application/json: Error
503 Local concurrency limit reached application/json: Error
default Provider status, content type and body passed through after model alias replacement. application/json: object
application/octet-stream: string (binary)

POST /v1/ocr · operation createOCR

Mistral OCR shape. Requires the ocr flag, route:ocr and a model with the ocr capability (Mistral, or Azure AI Foundry with the azure_mistral_ocr preset). The document is an https URL fetched by the provider or a data URL carried inline; the gateway never fetches it. The response (pages with markdown) is returned as the provider sends it.

Authentication: bearerAuth

Request body (required)

  • application/json: object
    • model (string, required)
    • document (object, required)
      • type (string, required, one of "document_url", "image_url")
      • document_url (string) — https:// or data:application/pdf;base64,…
      • image_url (string)

Responses

Status Description Body
200 Pages with markdown, as returned by the provider —
400 Missing model or invalid document —
401 Missing or invalid key —
403 scope_forbidden or model_forbidden —
404 Feature disabled or unknown model —
422 Model without the ocr capability —

m7gtwcontact@m7gtw.com