Provider 配置指南
本指南详细介绍 Claudex 支持的每个提供商的配置方法,包括 API Key 提供商、OAuth 订阅和本地模型。
API Key 提供商
Section titled “API Key 提供商”Anthropic
Section titled “Anthropic”- 在 console.anthropic.com 注册
- 进入 API Keys 页面创建密钥(格式:
sk-ant-*)
[[profiles]]name = "anthropic"provider_type = "DirectAnthropic"base_url = "https://api.anthropic.com"api_key = "sk-ant-..."default_model = "claude-sonnet-4-20250514"claudex profile test anthropicMiniMax
Section titled “MiniMax”- 在 platform.minimaxi.com 注册
- 在控制台中进入 API Keys 页面
[[profiles]]name = "minimax"provider_type = "DirectAnthropic"base_url = "https://api.minimax.io/anthropic"api_key = "..."default_model = "claude-sonnet-4-20250514"claudex profile test minimaxOpenRouter
Section titled “OpenRouter”- 在 openrouter.ai 注册
- 在 openrouter.ai/keys 获取 API 密钥
[[profiles]]name = "openrouter"provider_type = "OpenAICompatible"base_url = "https://openrouter.ai/api/v1"api_key = "sk-or-..."default_model = "anthropic/claude-sonnet-4"claudex profile test openrouterGrok (xAI)
Section titled “Grok (xAI)”- 在 console.x.ai 注册
- 在控制台中创建 API 密钥
[[profiles]]name = "grok"provider_type = "OpenAICompatible"base_url = "https://api.x.ai/v1"api_key = "xai-..."default_model = "grok-3-beta"claudex profile test grokOpenAI
Section titled “OpenAI”- 在 platform.openai.com 注册
- 在 platform.openai.com/api-keys 创建 API 密钥
[[profiles]]name = "chatgpt"provider_type = "OpenAICompatible"base_url = "https://api.openai.com/v1"api_key = "sk-..."default_model = "gpt-4o"claudex profile test chatgptDeepSeek
Section titled “DeepSeek”- 在 platform.deepseek.com 注册
- 在控制台中创建 API 密钥
[[profiles]]name = "deepseek"provider_type = "OpenAICompatible"base_url = "https://api.deepseek.com"api_key = "sk-..."default_model = "deepseek-chat"claudex profile test deepseekKimi / Moonshot
Section titled “Kimi / Moonshot”- 在 platform.moonshot.cn 注册
- 在控制台中创建 API 密钥
[[profiles]]name = "kimi"provider_type = "OpenAICompatible"base_url = "https://api.moonshot.cn/v1"api_key = "sk-..."default_model = "moonshot-v1-128k"claudex profile test kimiGLM / 智谱
Section titled “GLM / 智谱”- 在 open.bigmodel.cn 注册
- 在控制台中创建 API 密钥
[[profiles]]name = "glm"provider_type = "OpenAICompatible"base_url = "https://open.bigmodel.cn/api/paas/v4"api_key = "..."default_model = "glm-4-plus"claudex profile test glmOAuth 订阅认证
Section titled “OAuth 订阅认证”OAuth 认证允许你使用现有的提供商订阅(ChatGPT Plus、Claude Max 等),无需单独的 API 密钥。
Claude Max / Pro
Section titled “Claude Max / Pro”使用你现有的 Claude 订阅,通过 Claude Code 的原生 OAuth 会话。
前置条件:已安装 Claude Code 且已登录(claude 命令正常工作)
[[profiles]]name = "claude-sub"provider_type = "DirectAnthropic"base_url = "https://api.anthropic.com"default_model = "claude-sonnet-4-20250514"auth_type = "oauth"oauth_provider = "claude"
[profiles.models]haiku = "claude-haiku-4-20250514"sonnet = "claude-sonnet-4-20250514"opus = "claude-opus-4-20250514"无需额外的 claudex auth login 步骤。Claudex 直接读取 ~/.claude 中的现有会话。
ChatGPT Plus / Codex CLI
Section titled “ChatGPT Plus / Codex CLI”通过 Codex CLI token 使用你的 ChatGPT Plus 或 Pro 订阅。
前置条件:安装 Codex CLI 并完成认证:
# 安装 Codex CLInpm install -g @openai/codex
# 认证(会打开浏览器)codex auth然后配置 Claudex:
[[profiles]]name = "codex-sub"provider_type = "OpenAIResponses"base_url = "https://chatgpt.com/backend-api/codex"default_model = "gpt-4o"auth_type = "oauth"oauth_provider = "openai"
[profiles.models]haiku = "gpt-4o-mini"sonnet = "gpt-4o"opus = "o1-pro"# 从 Codex CLI 读取 tokenclaudex auth login openai --profile codex-sub
# 验证claudex auth status
# 运行claudex run codex-subGoogle Gemini
Section titled “Google Gemini”通过 OAuth 设备码流程使用你的 Google 账户。
[[profiles]]name = "gemini"provider_type = "OpenAICompatible"base_url = "https://generativelanguage.googleapis.com/v1beta/openai"default_model = "gemini-2.5-pro"auth_type = "oauth"oauth_provider = "google"
[profiles.models]haiku = "gemini-2.0-flash"sonnet = "gemini-2.5-pro"opus = "gemini-2.5-pro"# 启动设备码流程(打开浏览器进行 Google 登录)claudex auth login google --profile gemini
# 验证claudex auth statusQwen / 通义千问
Section titled “Qwen / 通义千问”通过 OAuth 设备码流程使用你的 Qwen 账户。
[[profiles]]name = "qwen-oauth"provider_type = "OpenAICompatible"base_url = "https://chat.qwenlm.ai/api/chat/v1"default_model = "qwen-max"auth_type = "oauth"oauth_provider = "qwen"# 启动设备码流程claudex auth login qwen --profile qwen-oauth
# 验证claudex auth statusKimi / Moonshot (OAuth)
Section titled “Kimi / Moonshot (OAuth)”通过 OAuth 设备码流程使用你的 Kimi 账户。
[[profiles]]name = "kimi-oauth"provider_type = "OpenAICompatible"base_url = "https://api.moonshot.cn/v1"default_model = "moonshot-v1-128k"auth_type = "oauth"oauth_provider = "kimi"# 启动设备码流程claudex auth login kimi --profile kimi-oauth
# 验证claudex auth statusGitHub Copilot
Section titled “GitHub Copilot”通过 OAuth 设备码流程使用你的 GitHub Copilot 订阅。
[[profiles]]name = "github-copilot"provider_type = "OpenAICompatible"base_url = "https://api.githubcopilot.com"default_model = "gpt-4o"auth_type = "oauth"oauth_provider = "github"# 启动设备码流程(打开浏览器进行 GitHub 登录)claudex auth login github --profile github-copilot
# 验证claudex auth statusOllama
Section titled “Ollama”- 安装 Ollama:ollama.com
- 拉取模型:
ollama pull qwen2.5:72b- 配置 Claudex:
[[profiles]]name = "local-qwen"provider_type = "OpenAICompatible"base_url = "http://localhost:11434/v1"api_key = ""default_model = "qwen2.5:72b"claudex profile test local-qwen- 安装并启动 vLLM:
pip install vllmvllm serve meta-llama/Llama-3.3-70B-Instruct --port 8000- 配置 Claudex:
[[profiles]]name = "local-llama"provider_type = "OpenAICompatible"base_url = "http://localhost:8000/v1"api_key = ""default_model = "meta-llama/Llama-3.3-70B-Instruct"LM Studio
Section titled “LM Studio”- 从 lmstudio.ai 下载 LM Studio
- 加载模型并启动本地服务器(默认端口:1234)
[[profiles]]name = "lm-studio"provider_type = "OpenAICompatible"base_url = "http://localhost:1234/v1"api_key = ""default_model = "loaded-model-name"配置任何提供商后,验证连通性:
# 测试指定 profileclaudex profile test <profile-name>
# 测试所有 profileclaudex profile test all
# 列出所有已配置的 profileclaudex profile list