快速开始
1. 创建 API Key
Section titled “1. 创建 API Key”登录控制台,打开 API Keys 并创建 Key。请放进环境变量,不要提交到代码仓库。
2. 选择协议
Section titled “2. 选择协议”| 客户端 | Base URL | 主要端点 |
|---|---|---|
| OpenAI 兼容 SDK、Codex、Cline | https://api.nexinfer.com/v1 |
/responses 或 /chat/completions |
| Claude Code、Anthropic SDK | https://api.nexinfer.com |
/v1/messages |
3. 验证鉴权
Section titled “3. 验证鉴权”curl https://api.nexinfer.com/v1/models \ -H "Authorization: Bearer $NEXINFER_API_KEY"返回 200 代表 Base URL 和 Key 正确;401 代表 Key 或请求头错误。模型不在列表中,通常表示当前 Key 没有权限或模型暂不可用。
4. 发起请求
Section titled “4. 发起请求”curl https://api.nexinfer.com/v1/responses \ -H "Authorization: Bearer $NEXINFER_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"YOUR_MODEL_ID","input":"只回复 OK。"}'模型名必须从控制台复制,不要猜别名。