> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.xapi.to/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.xapi.to/_mcp/server.

# Chatbox 等桌面客户端

桌面与 Web 聊天客户端(Chatbox、NextChat、LobeChat、OpenWebUI 等)
均使用 OpenAI 协议与 `Authorization: Bearer` 鉴权,与 xAPI 完全兼容。

#### Chatbox

Settings → API Settings → Model Provider 选择 **OpenAI**:

| 字段       | 值                                             |
| -------- | --------------------------------------------- |
| API Host | `https://ai.xapi.to/v1`                       |
| API Key  | `sk-xapi-...`                                 |
| Model    | `claude-opus-4-7` 或其他 [模型清单](/ai/models) 中的模型 |

#### NextChat

Settings → Custom Endpoint:

| 字段              | 值                    |
| --------------- | -------------------- |
| OpenAI Endpoint | `https://ai.xapi.to` |
| API Key         | `sk-xapi-...`        |

> **Note**
>
> NextChat 内部会自动拼接 `/v1/chat/completions`,因此 Endpoint **不要**自带 `/v1`。

#### LobeChat

Settings → 语言模型 → OpenAI → 显示更多:

| 字段      | 值                       |
| ------- | ----------------------- |
| 代理地址    | `https://ai.xapi.to/v1` |
| API Key | `sk-xapi-...`           |

#### OpenWebUI

Admin Panel → Connections → OpenAI:

| 字段       | 值                       |
| -------- | ----------------------- |
| Base URL | `https://ai.xapi.to/v1` |
| API Key  | `sk-xapi-...`           |

## 通过 SDK 直接调用

#### Python

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://ai.xapi.to/v1",
    api_key="sk-xapi-...",
)

response = client.chat.completions.create(
    model="gpt-5.5",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
```

#### TypeScript

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://ai.xapi.to/v1',
  apiKey: 'sk-xapi-...',
});

const response = await client.chat.completions.create({
  model: 'gpt-5.5',
  messages: [{ role: 'user', content: 'Hello' }],
});
console.log(response.choices[0].message.content);
```

## 模型清单

参见 [模型与价格](/ai/models)。