> ## Documentation Index
> Fetch the complete documentation index at: https://doc.xbhuiz.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API Overview

> Base URLs, authentication, supported protocols, and common response behavior for XMAI.

XMAI exposes three protocol surfaces on one API host:

```text theme={null}
https://xmapi.site
```

Use the protocol your SDK or coding agent already speaks. The same XMAI API
key works across the public Claude, GPT, Gemini, and Grok catalog.

## Base URLs

| Protocol          | Base URL                    | Primary use                              |
| ----------------- | --------------------------- | ---------------------------------------- |
| OpenAI-compatible | `https://xmapi.site/v1`     | OpenAI SDKs, Cursor, Codex, Cline, aider |
| Anthropic-native  | `https://xmapi.site`        | Claude Code, Anthropic SDKs              |
| Gemini-native     | `https://xmapi.site/v1beta` | Google Gen AI SDKs                       |

<Note>
  The Anthropic SDK appends `/v1/messages` by itself. Use the bare host for
  Anthropic-native tools.
</Note>

## Endpoint matrix

| Endpoint                                 | Recommended models        | Response protocol            | Best for                       |
| ---------------------------------------- | ------------------------- | ---------------------------- | ------------------------------ |
| `/v1/chat/completions`                   | Claude, GPT, Gemini, Grok | OpenAI Chat Completions      | Most tools and SDKs            |
| `/v1/responses`                          | GPT                       | OpenAI Responses             | Codex-style GPT workflows      |
| `/v1/messages`                           | Claude                    | Anthropic Messages           | Claude Code and Anthropic SDKs |
| `/v1beta/models/{model}:generateContent` | Gemini                    | Gemini Generate Content      | Gemini-native SDKs             |
| `/v1/models`                             | Claude, GPT, Gemini, Grok | OpenAI-compatible model list | Model discovery                |
| `/v1beta/models`                         | Gemini                    | Gemini model list            | Gemini-native model discovery  |

## Public capability boundary

The current public documentation covers text and coding-agent workflows only:

* OpenAI-compatible Chat Completions and Responses
* Anthropic Messages for Claude Code
* Gemini Generate Content
* model listing, authentication, streaming, quota, and usage visibility

Do not assume image generation, audio, embeddings, rerank, files, fine-tuning, or
batches are supported unless they are added to this docs site and shown in the
dashboard catalog.

## Model policy

XMAI does not silently substitute, quantize, or distill models. The model id
you request is the model routed upstream. If a model is unavailable, the request
fails instead of being hidden behind another model.

## Billing

Requests spend from your prepaid account balance. Usage is metered per token and
visible in the [Dashboard](https://xbhuiz.com/dashboard). API keys can also have
per-key spending caps.

## Next steps

<CardGroup cols={3}>
  <Card title="Authentication" icon="key" href="/en/api/authentication">
    API keys, headers, and SDK auth conventions
  </Card>

  <Card title="OpenAI-compatible API" icon="code" href="/en/api/openai-compatible">
    Chat Completions, Responses, and Models
  </Card>

  <Card title="Errors & Rate Limits" icon="triangle-alert" href="/en/api/errors">
    Status codes, quota errors, and troubleshooting
  </Card>
</CardGroup>
