Providers

Claude Custom

配置自定义 Claude 兼容服务

Claude Custom

Claude Custom 允许你配置 Anthropic 官方 API 或其他 Claude 兼容服务。

适用场景

  • 使用 Anthropic 官方 API
  • 使用 AWS Bedrock Claude
  • 使用其他 Claude 兼容服务

API Key 配置

获取 API Key

Anthropic 官方:

  1. 访问 Anthropic Console
  2. 进入 API Keys 页面
  3. 创建新的 API Key

AWS Bedrock:

  1. 访问 AWS Console
  2. 配置 Bedrock 访问权限
  3. 获取 AWS 凭证

在 ProxyCast 中配置

  1. 进入 凭证池 页面
  2. 点击 添加凭证
  3. 选择 Claude Custom
  4. 填写配置信息:
字段说明
名称凭证标识名称
API KeyAnthropic API Key
Base URLAPI 端点(可选)

Base URL 设置

默认端点

不填写 Base URL 时,使用 Anthropic 官方端点:

https://api.anthropic.com

自定义端点

服务Base URL
Anthropic 官方https://api.anthropic.com
AWS Bedrock使用 AWS SDK
代理服务自定义 URL

配置示例

providers:
  - name: anthropic-official
    type: claude-custom
    api_key: "sk-ant-..."
    # 使用默认 Base URL
    
  - name: claude-proxy
    type: claude-custom
    api_key: "..."
    base_url: "https://my-proxy.example.com"

支持的模型

模型说明
claude-sonnet-4-20250514Claude Sonnet 4
claude-3-5-sonnet-20241022Claude 3.5 Sonnet
claude-3-5-haiku-20241022Claude 3.5 Haiku
claude-3-opus-20240229Claude 3 Opus

API 版本

版本配置

Anthropic API 需要指定版本:

claude-custom:
  api_version: "2023-06-01"

请求头

Claude API 使用特定的请求头:

x-api-key: your-api-key
anthropic-version: 2023-06-01

AWS Bedrock 配置

使用 AWS 凭证

bedrock-claude:
  type: claude-custom
  aws_region: "us-east-1"
  aws_access_key: "..."
  aws_secret_key: "..."
  model_id: "anthropic.claude-3-sonnet-20240229-v1:0"

IAM 角色

推荐使用 IAM 角色而非 Access Key:

  1. 配置 IAM 角色
  2. 授予 Bedrock 访问权限
  3. ProxyCast 自动使用角色凭证

高级配置

自定义请求头

claude-custom:
  headers:
    X-Custom-Header: "value"

超时设置

claude-custom:
  timeout:
    connect: 10s
    request: 180s  # Claude 响应可能较慢

故障排除

API Key 无效

  1. 确认 API Key 正确
  2. 检查 Key 是否过期
  3. 确认账户状态正常

模型访问被拒

  1. 确认账户有该模型的访问权限
  2. 某些模型需要申请访问
  3. 检查使用限制

速率限制

错误解决方案
429 Too Many Requests降低请求频率
rate_limit_error等待后重试

Bedrock 问题

  1. 确认 AWS 凭证正确
  2. 检查 IAM 权限
  3. 确认区域支持 Claude