> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.trygateway.ai/unified-mode/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.trygateway.ai/_mcp/server. # Unified Mode ## Docs - [Python (Unified Mode)](https://docs.trygateway.ai/unified-python.md): Call any provider using the OpenAI Python SDK - [TypeScript (Unified Mode)](https://docs.trygateway.ai/unified-typescript.md): Call any provider using the OpenAI Node.js SDK - [cURL (Unified Mode)](https://docs.trygateway.ai/unified-curl.md): Raw HTTP examples for the unified endpoint > **Note:** This page contains both a page directory (above) and the landing page content (below). The page directory is generated for agent use and does not appear on the landing page. > For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.trygateway.ai/unified-mode/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.trygateway.ai/_mcp/server. # Unified Mode Unified mode lets you call any LLM provider using the OpenAI SDK. Gateway AI translates your request into each provider's native format and translates the response back. You use one SDK, one API shape, and switch models by changing a string. ## How it works 1. You send an OpenAI-compatible `POST /v1/chat/completions` request 2. The `model` field tells the gateway which provider and model to use 3. The gateway translates the request to the provider's native format 4. The provider responds, and the gateway translates back to OpenAI format 5. You get a standard OpenAI-shaped response regardless of which provider handled it ## Model naming Use the `provider/model` format: ``` openai/gpt-4o anthropic/claude-sonnet-4-6 google/gemini-2.5-flash ``` For well-known models, you can omit the provider prefix: | Model prefix | Inferred provider | | ------------ | ----------------- | | `gpt-*` | OpenAI | | `o3`, `o3-*` | OpenAI | | `o4`, `o4-*` | OpenAI | | `claude-*` | Anthropic | | `gemini-*` | Google/Gemini | So `model="claude-sonnet-4-6"` works the same as `model="anthropic/claude-sonnet-4-6"`. For any model name that doesn't match these prefixes, use the explicit `provider/model` format. ## Base URL Point the OpenAI SDK at your gateway's `/v1` endpoint: ``` https://api.trygateway.ai/v1 ``` ## Supported models | Provider | Models | | --------- | ----------------------------------------------------------------------------------------------------------------- | | OpenAI | `gpt-4o`, `gpt-4o-mini`, `gpt-5.4`, `gpt-5.4-mini`, `gpt-5.4-nano`, `o3`, `o3-mini`, `o4-mini` | | Anthropic | `claude-opus-4-6`, `claude-sonnet-4-6`, `claude-opus-4-5`, `claude-haiku-4-5` | | Google | `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`, `gemini-3.1-pro-preview`, `gemini-3-flash-preview` | ## What's translated The gateway handles the translation between OpenAI's API format and each provider's native format: * **Messages**: role mapping, content format, system message extraction * **Streaming**: SSE event translation in real time * **Tool calling**: function definitions, tool_choice, tool results * **Vision**: image content parts (base64 and URLs) * **Parameters**: temperature, top_p, top_k, max_tokens, stop sequences * **Response**: content blocks, finish reasons, usage/token counts ## Limitations Unified mode translates the most common features. Some parameters and features are not available for all providers: | Feature / Parameter | OpenAI | Anthropic | Gemini | | -------------------------------------------- | ---------------- | ------------------------------------------- | ------------------------------------------- | | `temperature`, `top_p`, `max_tokens`, `stop` | Yes | Yes | Yes | | `top_k` | -- | Yes | Yes | | `seed` | Yes | -- | Yes | | `frequency_penalty`, `presence_penalty` | Yes | -- | -- | | `response_format` (JSON mode / JSON schema) | Yes | -- | Yes | | `user` | Yes | Yes (as `metadata.user_id`) | -- | | Tools / function calling | Yes | Yes | Yes | | `tool_choice` | Full | Partial (`auto`, `required`, `none`, named) | Partial (`auto`, `required`, `none`, named) | | Vision (images in messages) | Yes | Yes | Yes | | Streaming | Yes | Yes | Yes | | Extended thinking | -- | Native mode only | -- | | Audio/video content | Native mode only | -- | Native mode only | Parameters marked "--" are silently dropped when routing to that provider. No error is returned. For full provider feature support, use [Native Mode](/native-mode). ## Next steps * **[Python examples](/unified-python)** — chat, streaming, tool calling * **[TypeScript examples](/unified-typescript)** — Node.js integration * **[cURL examples](/unified-curl)** — raw HTTP requests