| name | claude-code-bailian |
| description | 指导 Claude Code 接入阿里云百炼(千问)的配置与故障排查。在用户询问百炼、千问、阿里云 Claude Code、Base URL、API Key、403 invalid api-key、400 model not supported、ConnectionRefused 或 Claude Code 第三方 API 配置时使用。 |
Claude Code 接入阿里云百炼配置
按本 skill 执行配置与排查时,以 Windows 环境为准(路径、PowerShell)。完整步骤与报错对照见 reference.md。
配置前必知
| 类型 | Base URL | API Key 来源 |
|---|
| 按量付费 | https://dashscope.aliyuncs.com/apps/anthropic | 百炼控制台「密钥管理」 |
| Coding Plan | https://coding.dashscope.aliyuncs.com/apps/anthropic | 订阅套餐 → 套餐专属 API Key |
Coding Plan 的 Key 必须用 Coding Plan 专属 Base URL,否则会报 403 invalid api-key。
必做两步
- 用户级 Claude Code:
C:\Users\%USERNAME%\.claude\settings.json
- 设置
env.ANTHROPIC_BASE_URL、env.ANTHROPIC_API_KEY、env.ANTHROPIC_MODEL(如 qwen3.5-plus)。
- Cursor/VS Code:用户设置中
claudeCode.disableLoginPrompt: true
claudeCode.selectedModel: 百炼支持的模型名(如 qwen3.5-plus),不能为 Anthropic 模型名,否则 400 model not supported。
常见报错速查
| 报错 | 原因 | 处理要点 |
|---|
| ConnectionRefused | 请求发到 localhost/代理 | 检查 .claude/settings.json、.vscode/settings.json 的 Base URL,改为百炼对应 URL |
| 403 invalid api-key | Base URL 与 Key 类型不一致 | Coding Plan Key → 用 Coding Plan Base URL;按量 Key → 用按量 Base URL |
| 400 model xxx is not supported | 用了 Anthropic 模型名 | 设置 claudeCode.selectedModel 为千问模型名(如 qwen3.5-plus) |
| 仍出现登录界面 | 未关闭登录提示 | claudeCode.disableLoginPrompt: true,并重载窗口 |
配置检查清单
百炼模型名示例
qwen3.5-plus、qwen3-max、qwen3.5-flash、qwen3-coder-next 等。详见 reference.md 或阿里云百炼模型列表。
详细说明
完整配置步骤、可选项(CLI 登录、环境变量、项目级覆盖)及故障排查见 reference.md。