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

# 快速开始

> 三步完成注册、获取 API Key 并发起第一次请求。

按照以下步骤，你可以在五分钟内完成注册并调用第一个 AI 接口。

**1. 注册并登录**

访问 [https://t.ato2.nodesms.com](https://t.ato2.nodesms.com)，完成注册并登录到你的账号。

**2. 创建 API Key**

进入**令牌管理**页面，点击**创建令牌**，为 Key 设置名称和额度后保存。复制以 `sk-` 开头的 API Key，妥善保管。

**3. 发起第一个请求**

打开终端，复制以下 cURL 命令并替换 `$API_KEY` 为你的 Key，即可发送第一条对话请求：

```bash theme={"dark"}
curl -X POST https://t.ato2.nodesms.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "你好"}]
  }'
```

如果一切正常，你将收到包含模型回复的 JSON 响应。

## 在代码中使用

```python Python theme={"dark"}
from openai import OpenAI

client = OpenAI(
    api_key="sk-xxx",
    base_url="https://t.ato2.nodesms.com/v1",
)

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

```javascript Node.js theme={"dark"}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-xxx",
  baseURL: "https://t.ato2.nodesms.com/v1",
});

const response = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "你好" }],
});
console.log(response.choices[0].message.content);
```

## 在第三方客户端中使用

以下客户端均支持 OpenAI 兼容接口，只需填入 API 地址和 Key 即可使用：

| 客户端 | API 地址填写方式 |
| - | - |
| Cherry Studio | 模型服务 -> 添加供应商 -> OpenAI，Base URL 填 `https://t.ato2.nodesms.com/v1` |
| LobeChat | 设置 -> 语言模型 -> OpenAI，API 代理地址填 `https://t.ato2.nodesms.com/v1` |
| NextChat | 设置 -> 自定义接口，接口地址填 `https://t.ato2.nodesms.com`，API Key 填入你的 Key |

部分客户端在填写地址时带有 `/v1` 后缀，若连接失败可尝试切换带 `/v1` 或不带的地址。

> [!NOTE]
>
> 示例中的 `gpt-4o-mini` 仅为示例，实际可用模型请通过 [模型列表](https://docs.nodesms.com/aitoken/api/models.md) 接口查询。

## 下一步

* 查看 [对接说明](https://docs.nodesms.com/aitoken/api/overview.md)，了解接口地址、鉴权方式和错误处理。
* 在左侧「AI 模型接口」中浏览全部接口，并在页面中在线调试。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.