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

# Cursor

> 配置 Cursor 编辑器使用 EzTokens

Cursor 是一款 AI 驱动的代码编辑器。配置其使用 EzTokens，即可通过一个 API 密钥访问全部模型。

## 配置步骤

1. 打开 Cursor → **Settings** → **Models**
2. 展开 **API Keys**，输入你的 EzTokens API 密钥
3. 展开 **Override OpenAI Base URL**，输入：
   ```text theme={null}
   https://api.eztokens.ai/v1
   ```
4. 点击 **Add Custom Model**，输入模型 ID，如 `claude-sonnet-4-20250514`
5. 在对话中选择该模型即可使用

## 验证连通性

```bash theme={null}
curl https://api.eztokens.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $EZTOKENS_API_KEY" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "messages": [{"role": "user", "content": "Hello from Cursor!"}],
    "max_tokens": 100,
    "stream": true
  }'
```

## 排查

* **DNS**：确认系统可以解析 `api.eztokens.ai`
* **防火墙**：将 `api.eztokens.ai` 加入白名单
* **模型 ID**：使用 `/v1/models` 返回的精确 ID，直接使用官方模型名称

<Note>
  Cursor 使用 OpenAI 兼容端点。除 Base URL 和 API 密钥外无需额外配置。
</Note>
