整合指南

整合指南

將 TokenHub 接入 Claude Code、Codex、Cursor、Cline、Kilo Code 等常用 Agent 工具。

TokenHub 同時提供 OpenAI 相容、Anthropic Claude Messages 相容和 Gemini 相容 API。只要工具允許自訂 Base URL 和 API key,通常都能接到 TokenHub。

工具

從開發者 Agent、IDE 外掛和桌面用戶端中選擇。每張卡片都會開啟對應的接入教學。

設定檔優先

第三方 Agent 經常會啟動背景程序。只在某個 terminal 裡 export 變數,換 terminal、IDE 視窗或外掛宿主後可能就失效。建議先寫工具的使用者設定檔或設定頁,臨時環境變數只保留給排錯。

工具建議位置寫入內容
Claude Code~/.claude/settings.json;可選 ~/.claude.json模型和 Anthropic 相容 env;onboarding 狀態和 VS Code claudeCode.environmentVariables 只作補充。
Codex~/.codex/config.tomlTokenHub provider、model_providers.tokenhubenv_key、Base URL 和 wire API。
Aider~/.aider.conf.yml 或專案 .aider.conf.yml預設模型和 openai-api-base;Key 保存在 OPENAI_API_KEY 或本機密鑰儲存。
OpenCode~/.config/opencode/opencode.json 或專案 opencode.json自訂 provider 套件 @ai-sdk/openai-compatibleoptions.baseURL、TokenHub 模型,以及 /connect 選中的 provider。
Qwen Code~/.qwen/settings.json 或專案 .qwen/settings.json寫入 modelProviders.openaisecurity.auth.selectedType = "openai"envKey、Base URL 和 model.name
IDE 外掛VS Code / JetBrains 使用者設定或外掛設定Provider、Base URL、API key、模型欄位和權限設定。
桌面用戶端服務商或模型設定頁OpenAI Compatible 或 Custom provider,以及手動模型 ID。

選擇相容協議

先看工具支援哪種協議,再選 Base URL。多數 IDE 和桌面用戶端使用 OpenAI 相容模式;Claude Code 優先使用 Anthropic Claude Messages 相容模式;Gemini 原生工具則使用 Gemini 相容模式。

常用參數

工具要求的欄位TokenHub 填寫值
OpenAI 相容 Base URLhttps://us-api.tokenhub.com/v1
OpenAI Chat Completions 測試 URLhttps://us-api.tokenhub.com/v1/chat/completions
OpenAI Responses 測試 URLhttps://us-api.tokenhub.com/v1/responses
Anthropic Base URLhttps://us-api.tokenhub.com
Anthropic Messages 測試 URLhttps://us-api.tokenhub.com/v1/messages
Gemini Base URLhttps://us-api.tokenhub.com
Gemini 模型列表 URLhttps://us-api.tokenhub.com/v1beta/models
API KeyTokenHub 工作區金鑰,通常本機保存為 TOKENHUB_API_KEY
Model IDTokenHub 模型列表中的模型名稱

如果工具將 Host 和 Path 分開,Host 使用 https://us-api.tokenhub.com,OpenAI 相容 Path 使用 /v1。如果它只要求一個完整 Base URL,請使用 https://us-api.tokenhub.com/v1。設定完成後,先用唯讀提示驗證,再開啟寫入或自動化任務。

最後更新於