接入其他客户端

除了 Claude Code 和 OpenAI Codex,TokenCode 也可以接入 Cursor、OpenCode、OpenClaw、Hermes Agent、Continue、Cline、Aider 等常见 AI 编程客户端。

推荐阅读顺序

Claude Code、Codex、OpenCode、OpenClaw 和 Hermes Agent 建议优先使用 TokenCode CLI 的交互式菜单向导自动配置;下面的客户端说明适合手动配置或排查问题时参考。

客户端 推荐协议 文档
TokenCode CLI 交互式菜单向导,也支持一键写入对应工具配置 TokenCode CLI 接入
Cursor OpenAI 兼容 接入 Cursor
OpenCode Anthropic 兼容 接入 OpenCode
OpenClaw Anthropic 兼容 接入 OpenClaw
Hermes Agent Anthropic 兼容 接入 Hermes Agent
Continue OpenAI 兼容或 Anthropic 兼容 本页
Cline OpenAI Compatible 或 Anthropic 本页
Aider OpenAI 兼容 本页

通用配置

大多数客户端只需要三个信息:

OpenAI 兼容协议

配置项
API Key TokenCode API Key
Base URL https://tokencode.dev/v1
Model 模型列表中的模型 ID

Anthropic 兼容协议

配置项
API Key TokenCode API Key
Base URL https://tokencode.dev
Model 模型列表中的模型 ID

Continue

Continue 是 VS Code 和 JetBrains 可用的开源 AI 编程插件。编辑 ~/.continue/config.json

json
{
  "models": [
    {
      "title": "TokenCode GPT-4o",
      "provider": "openai",
      "model": "gpt-5.5",
      "apiKey": "sk-your-api-key",
      "apiBase": "https://tokencode.dev/v1"
    },
    {
      "title": "TokenCode Claude",
      "provider": "anthropic",
      "model": "claude-sonnet-4-6",
      "apiKey": "sk-your-api-key",
      "apiBase": "https://tokencode.dev"
    }
  ]
}

如果你只想维护一种配置,建议优先使用 OpenAI 兼容模式。

Cline

在 VS Code 中打开 Cline 设置:

  1. API Provider 选择 OpenAI Compatible
  2. Base URL 填写 https://tokencode.dev/v1
  3. API Key 填写 TokenCode API Key。
  4. Model 填写模型列表中的模型 ID,例如 gpt-5.5claude-sonnet-4-6deepseek-chat

如果你选择 Anthropic Provider,则 Base URL 使用 https://tokencode.dev

Aider

Aider 推荐使用 OpenAI 兼容模式:

bash
export OPENAI_API_KEY="sk-your-api-key"
export OPENAI_API_BASE="https://tokencode.dev/v1"

aider --model gpt-5.5
aider --model claude-sonnet-4-6

如果你的 Aider 版本使用 OPENAI_BASE_URL,也可以改为:

bash
export OPENAI_BASE_URL="https://tokencode.dev/v1"

排错清单

401 或 Unauthorized

优先检查 API Key 是否完整、是否属于 TokenCode、是否有可用额度。不要混用其他平台的 API Key。

404 或模型不存在

确认 Base URL 和协议匹配。OpenAI 兼容协议使用 https://tokencode.dev/v1;Anthropic 兼容协议通常使用 https://tokencode.dev

客户端找不到自定义模型

部分客户端需要关闭 Auto 模式,或手动把模型 ID 加到模型列表中。Cursor 免费版通常不能调用自定义模型,需使用支持自定义模型的套餐。