犀速AI
Contents
Updated 2026-10-08

API & Error Codes

Endpoints and authentication

The Xisu AI base URL and every endpoint: OpenAI-compatible chat/completions, responses, embeddings, images and models, plus Anthropic-native messages, all sharing one key and balance. Includes the auth header, streaming behaviour and dropped streams.

Endpoint address

https://api.xisu.ai/v1

Endpoints

The gateway speaks two protocols, on one key and one balance.

OpenAI-compatible (what almost everyone uses)

Endpoint Purpose
POST /v1/chat/completions Chat completions
POST /v1/embeddings Text embeddings
GET /v1/models The models this key may call
POST /v1/images/generations Image generation (synchronous; no streaming)
POST /v1/responses Responses API (the Codex CLI and the OpenAI SDK's responses API; models are a subset, see The OpenAI Responses endpoint)
POST /v1/images/generations Image generation (synchronous; no streaming)
POST /v1/responses Responses API (the Codex CLI and the OpenAI SDK's responses API; models are a subset, see The OpenAI Responses endpoint)

Anthropic-native (works with the Anthropic SDK and Claude Code as-is)

Endpoint Purpose
POST /v1/messages Chat completions, with neither request nor response translated
POST /v1/messages/count_tokens Count tokens; not billed

For the differences, and which one to use, see The Anthropic-native endpoint.

Of the remaining OpenAI endpoints only image generation is offered (/v1/images/generations, synchronous, no streaming, and it needs an image model — whether one is currently on sale is answered by GET /v1/models). Image edits and variations, audio, files, fine-tuning, Assistants and the rest are not offered here, and pricing has no "per audio minute" dimension. (Image input is a different matter — it passes through untouched on /v1/messages.)

Authentication

Standard bearer token:

Authorization: Bearer YOUR_API_KEY

Keys are created in the console, and the full key is shown only once, at creation.

If a key has an IP allowlist, calling from an address outside it returns 401 invalid_api_key — the same code as an invalid key. That is deliberate: a dedicated code would tell whoever holds a leaked key "this key is fine, you're just on the wrong network". So when you debug a 401, check the source IP first instead of rushing to recreate the key.

Streaming

Pass "stream": true. You get standard SSE, terminated by data: [DONE]. That is the OpenAI-compatible shape — /v1/messages returns a native Anthropic event stream with no [DONE]; see The Anthropic-native endpoint. That is the OpenAI-compatible shape — /v1/messages returns a native Anthropic event stream with no [DONE]; see The Anthropic-native endpoint.

  • Usage for a streamed response arrives in the final chunk. If the connection drops you won't receive it, but the tokens already generated are still billed — the gateway meters what it produced, not what reached you.
  • A long silence usually means the upstream is queueing, not that the connection died. Handle it with your client's own timeout.
  • To retry after a dropped stream, start a new request. There is no resume semantic.

SDK compatibility

Any OpenAI-compatible SDK works by changing base_url; your code stays the same. Verified: the official openai Python and Node SDKs, plus most desktop clients and terminal coding tools that allow a custom endpoint.

For per-client setup, see Use your existing SDK or client.