你的卡片Your card Endpoint · Key · Model
你的卡片上印有三个值:接入地址、你的 Key、你的 Model。把它们填进任意 OpenAI 兼容客户端即可。每张 Key 不同,Model 以卡片印刷为准。Your card shows three values: the Endpoint, your Key, and your Model. Put them into any OpenAI-compatible client. Every key is unique; use exactly the model printed on your card.
接入地址 Base URLBase URL
https://api.thetoken.biz/openai/v1
你的 KeyYour Key
YOUR_KEY (卡片印刷,每张不同)(printed on your card, unique)
你的 ModelYour Model
YOUR_MODEL (卡片印刷的模型名)(the model name on your card)
鉴权头Auth header
Authorization: Bearer YOUR_KEY
接口Endpoints
/chat/completions · /responses
额度响应头Quota headers
x-token-remaining · x-token-limit · x-token-used
Key 鉴权方式Key authentication
三选一,任意客户端都可用。Pick any one — all clients supported.
HTTP headers
# Option 1 — OpenAI standard (recommended) Authorization: Bearer YOUR_KEY # Option 2 — Azure style api-key: YOUR_KEY # Option 3 — APIM style Ocp-Apim-Subscription-Key: YOUR_KEY
接入地址必须以 /openai/v1 结尾,客户端会自动追加 /chat/completions 或 /responses。The Base URL must end with /openai/v1; clients append /chat/completions or /responses automatically.
opencode CLI verified
新增一个 OpenAI 兼容 provider,把卡片上的 Key 与 Model 填进去。Add an OpenAI-compatible provider and fill in the Key and Model from your card.
① 编辑配置文件① Edit the config file
路径Path
~/.config/opencode/opencode.json
Windows: C:\Users\<you>\.config\opencode\opencode.json
Windows: C:\Users\<you>\.config\opencode\opencode.json
② 加入 provider(Key 鉴权)② Add the provider (key auth)
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"thetoken": {
"npm": "@ai-sdk/openai-compatible",
"name": "The Token",
"options": {
"baseURL": "https://api.thetoken.biz/openai/v1",
"apiKey": "YOUR_KEY"
},
"models": {
"YOUR_MODEL": { "name": "YOUR_MODEL", "tool_call": true }
}
}
}
}
③ 运行③ Run
shell
opencode run --model thetoken/YOUR_MODEL "What is 2+2?"
⚠ agent 模式每轮都会重发系统提示与工具定义,较耗 token;保存后需重启 opencode。⚠ Agent mode resends the system prompt + tool schemas every turn (token-heavy); restart opencode after saving.
Codex CLI verified
在 config.toml 新增 provider,Key 直接放进 http_headers 的 api-key。Add a provider in config.toml; put your Key directly into http_headers → api-key.
① 编辑配置文件① Edit the config file
路径Path
~/.codex/config.toml
Windows: C:\Users\<you>\.codex\config.toml
Windows: C:\Users\<you>\.codex\config.toml
② 配置 provider + 默认模型② Provider + default model
config.toml
model = "YOUR_MODEL" model_provider = "thetoken" [model_providers.thetoken] name = "The Token" base_url = "https://api.thetoken.biz/openai/v1" wire_api = "responses" # or "chat" http_headers = { "api-key" = "YOUR_KEY" }
③ 验证③ Verify
shell
codex exec --skip-git-repo-check "What is 2+2?"
wire_api 用 responses(Codex 原生)或 chat 都能跑。wire_api can be responses (Codex native) or chat.
桌面聊天客户端Desktop chat apps
官方 ChatGPT 桌面版不支持自定义 API 端点(只能登录 OpenAI 账号)。请改用支持 “OpenAI 兼容端点” 的客户端:Chatbox / Cherry Studio / Jan / NextChat / LM Studio。The official ChatGPT desktop app does not support custom API endpoints (account login only). Use an OpenAI-compatible client instead: Chatbox / Cherry Studio / Jan / NextChat / LM Studio.
通用设置(字段名各客户端略有差异)Common settings (field names vary by app)
提供方 / API 类型Provider / API type
OpenAI / OpenAI-Compatible
API Host / Base URL
https://api.thetoken.biz/openai/v1
API Key
YOUR_KEY
模型名Model name
YOUR_MODEL (与卡片一致)(as on your card)
Chatbox — 设置 → 模型提供方选 OpenAI API → API 域名填 https://api.thetoken.biz/openai/v1 → 密钥填 YOUR_KEY → 模型填 YOUR_MODEL。Settings → provider = OpenAI API → API host = https://api.thetoken.biz/openai/v1 → key = YOUR_KEY → model = YOUR_MODEL.
Cherry Studio — 设置 → 模型服务 → 添加 OpenAI 提供商 → API 地址 https://api.thetoken.biz/openai/v1 → 密钥 YOUR_KEY → 添加模型 YOUR_MODEL。Settings → Model providers → add OpenAI → API host = https://api.thetoken.biz/openai/v1 → key = YOUR_KEY → add model YOUR_MODEL.
SDK / REST
Python (openai SDK)(openai SDK)
python
from openai import OpenAI client = OpenAI( base_url="https://api.thetoken.biz/openai/v1", api_key="YOUR_KEY", ) r = client.chat.completions.create( model="YOUR_MODEL", messages=[{"role": "user", "content": "hi"}], ) print(r.choices[0].message.content)
curl (REST)(REST)
shell
curl https://api.thetoken.biz/openai/v1/chat/completions \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"YOUR_MODEL","messages":[{"role":"user","content":"hi"}]}'
常见问题FAQ
| 现象Symptom | 原因 / 处理Cause / fix |
|---|---|
403 model_not_allowed | 请求的 model 与 Key 绑定的模型不一致(用卡片上的 Model)The requested model differs from the one bound to your key (use the Model on your card) |
403 quota_exhausted | 额度用尽(含少量超额后)→ 联系管理员充值Quota used up (incl. small overage) → ask the admin to top up |
403 key_expired | Key 到期 → 联系管理员续期Key expired → ask the admin to renew |
401 missing_api_key | 没带 Key,检查 Authorization 头No key sent — check the Authorization header |
| 客户端 404Client 404 | Base URL 必须以 /openai/v1 结尾Base URL must end with /openai/v1 |
| agent 反复重试 / 额度飞快下降Agent retries / quota drains fast | Key 额度太小或算力不足;确认额度充足Key quota too small or throughput limited; ensure enough quota |