<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dashu</title>
    <description>The latest articles on DEV Community by Dashu (@xiuai).</description>
    <link>https://dev.to/xiuai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4086935%2Feb941186-d57d-4ec7-be26-7bc45d2c1189.jpg</url>
      <title>DEV Community: Dashu</title>
      <link>https://dev.to/xiuai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xiuai"/>
    <language>en</language>
    <item>
      <title>A 200 Response Is Not Enough: Testing Claude Code Through an Anthropic Gateway</title>
      <dc:creator>Dashu</dc:creator>
      <pubDate>Sun, 30 Aug 2026 12:56:41 +0000</pubDate>
      <link>https://dev.to/xiuai-lab/a-200-response-is-not-enough-testing-claude-code-through-an-anthropic-gateway-443h</link>
      <guid>https://dev.to/xiuai-lab/a-200-response-is-not-enough-testing-claude-code-through-an-anthropic-gateway-443h</guid>
      <description>&lt;p&gt;A 200 response from an AI gateway proves that one HTTP request worked. It does not prove that Claude Code can discover a model, send the right Messages payload, recover from an optional endpoint failure, and finish a task.&lt;/p&gt;

&lt;p&gt;That distinction matters when Claude Code is configured through an Anthropic-compatible gateway such as &lt;a href="https://router.xiu.ai/en/integrations" rel="noopener noreferrer"&gt;XiuRouter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide uses a two-layer acceptance test:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Send a small request directly to &lt;code&gt;/v1/messages&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run a complete short task in Claude Code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the first layer fails, debug the gateway configuration. If it passes but the second layer fails, debug the client workflow instead of rotating keys or changing models at random.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure the API root, not the Messages path
&lt;/h2&gt;

&lt;p&gt;Claude Code appends &lt;code&gt;/v1/messages&lt;/code&gt; to the configured base URL. Set the API root without &lt;code&gt;/v1&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://router-api.xiu.ai"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_XIUROUTER_API_KEY"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ANTHROPIC_AUTH_TOKEN&lt;/code&gt; sends a Bearer token, which XiuRouter accepts on the Messages route. Gateway model discovery lets Claude Code load models exposed by the configured gateway.&lt;/p&gt;

&lt;p&gt;A base URL ending in &lt;code&gt;/v1&lt;/code&gt; produces the duplicated path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://router-api.xiu.ai/v1/v1/messages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is a configuration error, not a model error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test &lt;code&gt;/v1/messages&lt;/code&gt; before opening Claude Code
&lt;/h2&gt;

&lt;p&gt;Use an exact model ID visible to the intended XiuRouter key. Do not copy a model ID from an old article or another service group.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="s2"&gt;/v1/messages"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"anthropic-version: 2023-06-01"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"content-type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "model": "YOUR_MODEL_ID",
    "max_tokens": 32,
    "messages": [
      {
        "role": "user",
        "content": "Reply only with: connected"
      }
    ]
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The response should be JSON with a Messages &lt;code&gt;content&lt;/code&gt; value. Check more than the status code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The body is JSON, not an HTML error page returned by a proxy.&lt;/li&gt;
&lt;li&gt;The response contains text content.&lt;/li&gt;
&lt;li&gt;The model and usage fields are plausible for the request.&lt;/li&gt;
&lt;li&gt;The request appears in the expected XiuRouter usage records.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An HTTP 200 with an empty body, malformed JSON, or HTML is still a failed integration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then test the Claude Code workflow
&lt;/h2&gt;

&lt;p&gt;Start Claude Code in a non-critical repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;/model&lt;/code&gt; and select a model marked &lt;strong&gt;From gateway&lt;/strong&gt;. Run &lt;code&gt;/status&lt;/code&gt; and confirm the Anthropic base URL and gateway credential are active.&lt;/p&gt;

&lt;p&gt;The test task should exercise the client, not just produce a greeting. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Read package.json and report the package manager, test command, and build command.
Do not edit any files.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A useful pass condition is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code discovers a gateway model.&lt;/li&gt;
&lt;li&gt;The task starts without an authentication or payload error.&lt;/li&gt;
&lt;li&gt;The client receives a usable Messages response.&lt;/li&gt;
&lt;li&gt;The task reaches a final answer.&lt;/li&gt;
&lt;li&gt;The corresponding gateway request is visible in usage records.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This catches failures that a standalone curl request cannot expose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat &lt;code&gt;count_tokens&lt;/code&gt; 404 as a workflow signal
&lt;/h2&gt;

&lt;p&gt;XiuRouter does not expose a dedicated &lt;code&gt;/v1/messages/count_tokens&lt;/code&gt; route. Claude Code documents token counting as optional and can fall back through the inference endpoint.&lt;/p&gt;

&lt;p&gt;Do not classify the connection as broken from that 404 alone. Check what happens next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If Claude Code falls back to &lt;code&gt;/v1/messages&lt;/code&gt; and completes the task, the missing optional route did not block the workflow.&lt;/li&gt;
&lt;li&gt;If the task stops after the 404, capture the client version and logs, then diagnose the client behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pass condition is task completion, not the absence of every warning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Failure patterns and the shortest useful check
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;401&lt;/code&gt; or invalid token
&lt;/h3&gt;

&lt;p&gt;Confirm that the variable is &lt;code&gt;ANTHROPIC_AUTH_TOKEN&lt;/code&gt;, the key is active, and the shell that starts Claude Code actually contains the variable.&lt;/p&gt;

&lt;p&gt;If Claude Code reports multiple credential sources, run &lt;code&gt;/logout&lt;/code&gt; to use the gateway credential, or unset the gateway variables to keep the saved Claude login. Do not leave both paths ambiguous.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gateway models do not appear
&lt;/h3&gt;

&lt;p&gt;Confirm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart Claude Code after changing the environment. Also verify that the intended key can see at least one Claude model.&lt;/p&gt;

&lt;h3&gt;
  
  
  The request path is &lt;code&gt;/v1/v1/messages&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Remove &lt;code&gt;/v1&lt;/code&gt; from &lt;code&gt;ANTHROPIC_BASE_URL&lt;/code&gt;. The correct value is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://router-api.xiu.ai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  A &lt;code&gt;400&lt;/code&gt; response names experimental fields
&lt;/h3&gt;

&lt;p&gt;Retry with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is narrower than changing the model, key, and gateway at the same time.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP 200 contains HTML
&lt;/h3&gt;

&lt;p&gt;Inspect the response &lt;code&gt;content-type&lt;/code&gt; and body. A CDN, login wall, or proxy can return an HTML page with a successful transport status. The direct curl test should return Messages JSON.&lt;/p&gt;

&lt;h3&gt;
  
  
  Direct Messages works, but Claude Code still fails
&lt;/h3&gt;

&lt;p&gt;Keep the successful curl response as evidence and narrow the remaining variables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code version&lt;/li&gt;
&lt;li&gt;selected gateway model&lt;/li&gt;
&lt;li&gt;active environment variables&lt;/li&gt;
&lt;li&gt;credential-source warning&lt;/li&gt;
&lt;li&gt;optional endpoint fallback&lt;/li&gt;
&lt;li&gt;experimental request fields&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Changing one variable at a time preserves the known-good gateway result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Roll back without leaving mixed credentials
&lt;/h2&gt;

&lt;p&gt;For the CLI, unset the gateway variables and restart Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;unset &lt;/span&gt;ANTHROPIC_BASE_URL
&lt;span class="nb"&gt;unset &lt;/span&gt;ANTHROPIC_AUTH_TOKEN
&lt;span class="nb"&gt;unset &lt;/span&gt;CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY
&lt;span class="nb"&gt;unset &lt;/span&gt;CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;/status&lt;/code&gt; after restart and confirm that the previous connection is active.&lt;/p&gt;

&lt;p&gt;For the VS Code extension or Claude desktop Code, restore the previous environment or Third-Party Inference configuration, restart the application, and run the same status check.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.xiu.ai/en/router/integrations/claude-code/" rel="noopener noreferrer"&gt;Connect Claude Code to XiuRouter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.xiu.ai/en/router/api-compatibility/" rel="noopener noreferrer"&gt;XiuRouter API compatibility&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://router.xiu.ai/en/integrations" rel="noopener noreferrer"&gt;XiuRouter Agent integrations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These references were reviewed on August 30, 2026. Model availability can change, so use the current catalogue and an exact model ID visible to the intended key.&lt;/p&gt;

&lt;p&gt;XiuAI and its products are operated by XiuLab Inc, a U.S. corporation.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>claude</category>
      <category>programming</category>
    </item>
    <item>
      <title>One API Does Not Mean One Protocol: Chat Completions, Responses, Messages, and Gemini</title>
      <dc:creator>Dashu</dc:creator>
      <pubDate>Sun, 30 Aug 2026 10:40:07 +0000</pubDate>
      <link>https://dev.to/xiuai-lab/one-api-does-not-mean-one-protocol-chat-completions-responses-messages-and-gemini-39kd</link>
      <guid>https://dev.to/xiuai-lab/one-api-does-not-mean-one-protocol-chat-completions-responses-messages-and-gemini-39kd</guid>
      <description>&lt;p&gt;"OpenAI compatible" is useful shorthand, but it is not a complete integration contract.&lt;/p&gt;

&lt;p&gt;Two clients can accept the same API key and base domain while sending different request paths, authentication headers, payload shapes, streaming events, and tool-call formats. That difference matters when you connect coding agents, SDKs, or production applications to a multi-model gateway.&lt;/p&gt;

&lt;p&gt;At XiuAI, we expose four text-generation routes through &lt;a href="https://router.xiu.ai/en/" rel="noopener noreferrer"&gt;XiuRouter&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenAI Chat Completions&lt;/li&gt;
&lt;li&gt;OpenAI Responses&lt;/li&gt;
&lt;li&gt;Anthropic Messages&lt;/li&gt;
&lt;li&gt;Gemini GenerateContent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The practical rule is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Start with the protocol your client actually sends. Do not choose a protocol from the model name or from an "OpenAI compatible" label.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This article explains how to make that choice and how to verify the integration without turning a small configuration change into a production incident.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Choose the client protocol before the model
&lt;/h2&gt;

&lt;p&gt;A model name does not determine the request protocol.&lt;/p&gt;

&lt;p&gt;For example, the same model may be reachable through Chat Completions in one service group but not through Responses or Messages in another. A successful Chat Completions request is not proof that the same model and route will support Responses, Anthropic Messages, or Gemini GenerateContent.&lt;/p&gt;

&lt;p&gt;Use the client's native behavior as the starting point:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Client or application&lt;/th&gt;
&lt;th&gt;Preferred route&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Codex, agents, and new OpenAI-style applications&lt;/td&gt;
&lt;td&gt;OpenAI Responses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Code, Anthropic SDKs, and Claude-native clients&lt;/td&gt;
&lt;td&gt;Anthropic Messages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Existing OpenAI-compatible applications that do not support Responses&lt;/td&gt;
&lt;td&gt;Chat Completions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini SDKs and Gemini-native clients&lt;/td&gt;
&lt;td&gt;Gemini GenerateContent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If the client documentation is unclear, inspect its official configuration guide or request logs. Do not infer the protocol from a generic compatibility badge.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Base URLs depend on what the client appends
&lt;/h2&gt;

&lt;p&gt;An OpenAI-compatible SDK usually appends paths under &lt;code&gt;/v1\&lt;/code&gt;, so its configured base URL is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;text&lt;br&gt;
https://router-api.xiu.ai/v1&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A Claude client that appends &lt;code&gt;/v1/messages\&lt;/code&gt;, or a Gemini client that appends &lt;code&gt;/v1beta/models/...\&lt;/code&gt;, should use the API root:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;text&lt;br&gt;
https://router-api.xiu.ai&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is a common source of duplicated paths such as &lt;code&gt;/v1/v1/messages\&lt;/code&gt;, especially when a configuration field is called "API URL" without explaining whether it expects a domain, a base path, or a complete endpoint.&lt;/p&gt;

&lt;p&gt;For direct requests, use the complete path:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Method and path&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Chat Completions&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /v1/chat/completions\&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Responses&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /v1/responses\&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anthropic Messages&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /v1/messages\&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini GenerateContent&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /v1beta/models/{model}:generateContent\&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. Authentication is also protocol-specific
&lt;/h2&gt;

&lt;p&gt;OpenAI-compatible requests use a Bearer token:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;http&lt;br&gt;
Authorization: Bearer YOUR_XIUROUTER_API_KEY&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Anthropic Messages can use:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;http&lt;br&gt;
x-api-key: YOUR_XIUROUTER_API_KEY&lt;br&gt;
anthropic-version: 2023-06-01&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;XiuRouter also accepts a Bearer token on the Messages route for gateway clients such as Claude Code.&lt;/p&gt;

&lt;p&gt;Gemini GenerateContent can use:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;http&lt;br&gt;
x-goog-api-key: YOUR_XIUROUTER_API_KEY&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Gemini's &lt;code&gt;key\&lt;/code&gt; query parameter is accepted as well, but headers are easier to keep out of access logs and copied URLs.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Run one small request on the exact production combination
&lt;/h2&gt;

&lt;p&gt;Before moving application traffic, test the exact combination of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API key&lt;/li&gt;
&lt;li&gt;model ID&lt;/li&gt;
&lt;li&gt;service group&lt;/li&gt;
&lt;li&gt;protocol&lt;/li&gt;
&lt;li&gt;streaming mode&lt;/li&gt;
&lt;li&gt;tool or structured-output features you need&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First list the models visible to the scoped key:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
curl https://router-api.xiu.ai/v1/models \&lt;br&gt;
  -H "Authorization: Bearer $XIUROUTER_API_KEY"&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then send one small request through the route your client will use. For Responses:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
curl https://router-api.xiu.ai/v1/responses \&lt;br&gt;
  -H "Authorization: Bearer $XIUROUTER_API_KEY" \&lt;br&gt;
  -H "Content-Type: application/json" \&lt;br&gt;
  -d '{&lt;br&gt;
    "model": "YOUR_MODEL_ID",&lt;br&gt;
    "input": "Reply only with: XiuRouter connected"&lt;br&gt;
  }'&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For Anthropic Messages:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
curl https://router-api.xiu.ai/v1/messages \&lt;br&gt;
  -H "x-api-key: $XIUROUTER_API_KEY" \&lt;br&gt;
  -H "anthropic-version: 2023-06-01" \&lt;br&gt;
  -H "Content-Type: application/json" \&lt;br&gt;
  -d '{&lt;br&gt;
    "model": "YOUR_MODEL_ID",&lt;br&gt;
    "max_tokens": 64,&lt;br&gt;
    "messages": [&lt;br&gt;
      {&lt;br&gt;
        "role": "user",&lt;br&gt;
        "content": "Reply only with: XiuRouter connected"&lt;br&gt;
      }&lt;br&gt;
    ]&lt;br&gt;
  }'&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After the response, verify the same request in usage records: key, model, service group, endpoint, token counts, status, and cost.&lt;/p&gt;

&lt;p&gt;The small test is billable. Check the &lt;a href="https://router.xiu.ai/en/pricing" rel="noopener noreferrer"&gt;current model and service-group pricing&lt;/a&gt; before sending it.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Know the compatibility boundaries
&lt;/h2&gt;

&lt;p&gt;A gateway route can support the core text request without implementing every provider feature.&lt;/p&gt;

&lt;p&gt;Current XiuRouter boundaries include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/v1/messages/count_tokens\&lt;/code&gt; has no dedicated route. Claude Code documents token counting as optional and can fall back through inference, but you still need to verify that the final task completes.&lt;/li&gt;
&lt;li&gt;The Responses route is stateless. Stored conversations, &lt;code&gt;previous_response_id\&lt;/code&gt;, background mode, and provider-hosted tools are outside the current compatibility scope.&lt;/li&gt;
&lt;li&gt;XiuRouter exposes Gemini GenerateContent, not the Gemini Interactions API.&lt;/li&gt;
&lt;li&gt;Files, fine-tuning, image variations, and some legacy endpoints are not implemented by the current gateway.&lt;/li&gt;
&lt;li&gt;Tool calls, structured output, prompt caching, streaming events, and token accounting can differ when an inbound request is converted to an upstream provider format.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are not edge cases to hide in fine print. They determine whether an agent can finish a task, whether a retry is safe, and whether usage records match the client's expectations.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Use scoped keys and keep the rollback small
&lt;/h2&gt;

&lt;p&gt;Create one key per application or environment. Limit models, service groups, quota, expiration, and IP scope where appropriate.&lt;/p&gt;

&lt;p&gt;For a migration:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keep the existing provider configuration available.&lt;/li&gt;
&lt;li&gt;Add XiuRouter as a separate provider or environment.&lt;/li&gt;
&lt;li&gt;Test a small non-critical task.&lt;/li&gt;
&lt;li&gt;Compare output, streaming, tool calls, token accounting, latency, and cost.&lt;/li&gt;
&lt;li&gt;Move traffic gradually.&lt;/li&gt;
&lt;li&gt;Keep the previous provider as the rollback path until the new route has passed real workloads.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Changing only a base URL is convenient. Treating that change as proof of full protocol compatibility is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;The current endpoint table and limitations are maintained in the &lt;a href="https://docs.xiu.ai/en/router/api-compatibility/" rel="noopener noreferrer"&gt;XiuRouter API compatibility guide&lt;/a&gt;. The guide was reviewed on August 22, 2026, and this article was checked against it on August 30, 2026.&lt;/p&gt;

&lt;p&gt;XiuAI and its products are operated by XiuLab Inc, a U.S. corporation.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
