← 返回
未分类 Key

Claude Code 自定义模型代理

This skill should be used when configuring Claude Code CLI to connect to a custom Anthropic-compatible API endpoint with non-Anthropic models. Solves the "There's an issue with the selected model" error by placing the model name in settings.json instead of environment variables.
This skill should be used when configuring Claude Code CLI to connect to a custom Anthropic-compatible API endpoint with non-Anthropic models. Solves the "There's an issue with the selected model" error by placing the model name in settings.json instead of environment variables.
heartflow
未分类 community v1.0.3 4 版本 100000 Key: 需要
★ 0
Stars
📥 56
下载
💾 0
安装
4
版本
#latest

概述

Claude Code 自定义模型配置

Overview

Configures Claude Code (CLI v2.1.146+) to use a custom Anthropic-compatible API endpoint with non-Anthropic models. The key fix: placing "model" in settings.json bypasses Claude Code's local model name validation.

Quick Start

  1. Copy assets/settings.json to ~/.claude/settings.json
  2. Edit baseUrl to your endpoint, model to your model name
  3. Set the API key:

```bash

export ANTHROPIC_API_KEY="sk-your-key-here"

```

  1. Run claude

Key Configuration

Endpoint

Use the Anthropic-compatible address without /v1 suffix. Claude Code appends /v1/messages and /v1/models automatically.

Model Name — Critical Fix

Place "model" directly in settings.json to bypass Claude Code's local model name validation:

{
    "baseUrl": "https://<YOUR_ENDPOINT>",
    "model": "<YOUR_MODEL>"
}

Setting the model via ANTHROPIC_MODEL environment variable or --model CLI flag triggers validation and will be rejected for non-Anthropic models. Only the settings.json model field bypasses this check.

API Key

Store in ANTHROPIC_API_KEY environment variable (not in settings.json):

export ANTHROPIC_API_KEY="sk-your-key"

Troubleshooting

ErrorCauseFix
-------------------
There's an issue with the selected modelModel set via env var or CLI flagUse "model" in settings.json only
Not logged inMissing API keySet ANTHROPIC_API_KEY env var
ConnectionRefusedWrong endpoint URLUse base URL without /v1 suffix

版本历史

共 1 个版本

  • v1.0.3 Initial release 当前
    2026-05-23 19:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,390 📥 321,890
design-media

gpt-image-2生图技能

user_fdb96f95
gpt-image-2 生图技能:自动发现 OpenAI 兼容 API,验证模型支持,调用生图接口并保存本地文件。
★ 0 📥 820
ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 831 📥 298,105