Overview

The gateway’s translate layer converts the public chat-completions request format into the runtime’s native shape and maps runtime events back to a standard response format. It also produces a consistent error body across all gateway endpoints so existing client libraries can surface failures uniformly. This page documents the supported request fields, response shapes, streaming chunks, and error format.

Base URL

For local development:

Request translation

Chat completion request

Unknown fields are tolerated on the request body so client SDKs can send extra metadata without causing validation errors.

Message roles

Message content

Content may be a plain string or an array of parts:
  • text
  • image_url
  • input_image
  • video_url
  • input_video
  • file_id
The gateway preserves images and videos as runtime file parts so vision-capable models receive the actual media.

Response translation

Chat completion response

Finish reasons

Streaming chunks

Streaming responses use server-sent events. Each data: line contains a chunk object.

Chunk types

  1. Role chunk — announces the assistant role.
  2. Content delta chunk — incremental text.
  3. Tool-call delta chunk — incremental tool-call arguments.
  4. Finish chunk — empty delta with finish_reason.
  5. Usage chunk — final usage object when stream_options.include_usage is true.
Mid-stream errors emit a standard error frame before the final [DONE].

Citations and annotations

When citations is enabled and the provider supports native citations, the assistant message includes annotations:
For providers without native citation support, the gateway prepends a RAG context block and parses [cite:<id>] markers from the response, returning them in the top-level citations array.

Error format

All gateway errors return the same JSON shape:

Error codes

  • Chat Completions — translated request/response examples
  • Proxy — middleware and routing that uses the translate layer
  • Models — model identifiers used in requests