--- title: "XiuRouter API compatibility" description: "Choose the correct XiuRouter base URL, authentication method, and text-generation protocol, including the boundaries that require a real request." image: "https://docs.xiu.ai/og.png" --- > XiuAI documentation index > Full documentation index: https://docs.xiu.ai/en/llms.txt > Check the index for current pages before reading. # XiuRouter API compatibility XiuRouter exposes OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini GenerateContent routes. Match the route to the protocol your client actually sends. ## Base URLs | Client behavior | Configure this base URL | | --- | --- | | OpenAI-compatible SDK or application | `https://router-api.xiu.ai/v1` | | Claude client that appends `/v1/messages` | `https://router-api.xiu.ai` | | Gemini client that appends `/v1beta/models/...` | `https://router-api.xiu.ai` | | XiuRouter console | `https://router.xiu.ai` | These values are client base URLs. A direct `curl` request must include the full path, such as `https://router-api.xiu.ai/v1/responses`. ### Native Gemini through Antigravity Antigravity is the native Gemini account-pool source. Clients use the public API root and Gemini paths; do not add the internal `/antigravity` prefix. A normal key sending `/v1beta/models/{model}:generateContent` or `:streamGenerateContent?alt=sse` is routed to an available Antigravity account. - Reasoning: `generationConfig.thinkingConfig.thinkingLevel` supports `low`, `medium`, and `high`; Argon also exposes exact `-low/-medium/-high` IDs. - Images: use `responseModalities: ["TEXT", "IMAGE"]` with `generationConfig.imageConfig`, including `imageSize: "1K"/"2K"/"4K"` and `aspectRatio`. - Image editing: send `inlineData` in `contents.parts` with an edit instruction; verify returned pixels and usage. - Tools: use `tools.functionDeclarations` and `functionResponse` across turns, preserving `thoughtSignature`. - Structured output: use `responseMimeType: "application/json"` and `responseSchema`; Chat Completions `response_format` is a different contract. - Streaming: use `:streamGenerateContent?alt=sse`, read through `finishReason: "STOP"`, and record usage. Authenticate with `x-goog-api-key`. Treat usage records as the source of truth for request parameters, the upstream model, and cost. ## Text endpoints | Method and path | Use | | --- | --- | | `GET /v1/models` | List models visible to the current API key | | `POST /v1/chat/completions` | Existing OpenAI-compatible clients and tools that only support Chat Completions | | `POST /v1/responses` | Codex, agents, and new OpenAI-style applications | | `POST /v1/responses/compact` | Responses compaction for upstream types that support it | | `POST /v1/messages` | Claude Code, Anthropic SDKs, and Messages clients | | `GET /v1beta/models` | List models through the Gemini protocol | | `POST /v1beta/models/{model}:generateContent` | Gemini-native text generation | The gateway also has routes for other modalities and tasks. Do not add one to a production dependency until the intended model and service group have passed a small request on that exact route. ## Authentication OpenAI-compatible requests use: ```http Authorization: Bearer YOUR_XIUROUTER_API_KEY ``` Anthropic Messages can use: ```http x-api-key: YOUR_XIUROUTER_API_KEY anthropic-version: 2023-06-01 ``` XiuRouter also accepts a Bearer token on the Messages route for gateway clients such as Claude Code. Gemini GenerateContent can use: ```http x-goog-api-key: YOUR_XIUROUTER_API_KEY ``` The Gemini `key` query parameter is also accepted. Avoid retaining complete request URLs in logs when the key is in the query string. ## Compatibility boundaries - `/v1/messages/count_tokens` does not have a dedicated XiuRouter route. Claude Code documents token counting as optional and can fall back through the inference endpoint, but the final task must still complete. - The Responses route is stateless. Stored conversations, `previous_response_id`, and background mode are outside the current compatibility scope. - Some Responses models can use provider-hosted tools such as Web search. Test each tool with the intended model and service group, then check its call count and separate surcharge in Usage. - XiuRouter exposes Gemini GenerateContent, not the Gemini Interactions API. - Files, fine-tuning, image variations, and some legacy endpoints are not implemented by the current gateway. - A model working through Chat Completions does not prove it works through Responses, Messages, or Gemini. - Public model protocol metadata is a useful hint, but it is not a substitute for a request with the intended model and service group. - Tool calls, structured output, prompt caching, streaming events, and token accounting can differ when the gateway converts between an inbound protocol and an upstream provider format. ## Choose a protocol | Protocol | Prefer it for | | --- | --- | | Responses | Codex, agents, and new OpenAI-style applications | | Anthropic Messages | Claude Code, Anthropic SDKs, and Claude-native clients | | Chat Completions | Existing OpenAI-compatible applications and tools that do not support Responses | | Gemini GenerateContent | Gemini SDKs and Gemini-native clients | Follow the client's native protocol. Do not force a client onto another route solely because it is described as “OpenAI compatible.” ## Sources and review date This page was checked on November 7, 2026 against XiuRouter routing, authentication, Antigravity native text, reasoning levels, image sizes, image editing, tools, structured output, streaming, and recorded billing. Source: https://docs.xiu.ai/en/router/api-compatibility/index.mdx