--- 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 文档索引 > 完整文档索引:https://docs.xiu.ai/llms.txt > 阅读前先通过索引确认当前可用页面。 # 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`. ## 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`, background mode, and provider-hosted tools are outside the current compatibility scope. - 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 against the current XiuRouter routing and authentication behavior, the public model catalogue, and the linked vendor protocol references on August 22, 2026. No real API key was used for a billable cross-protocol test during this review. 源文件:https://docs.xiu.ai/en/router/api-compatibility/index.mdx