跳转到主要内容

Anthropic(Claude)

Fased 支持三种 Anthropic 认证方式:
  • Sign in (Claude Code OAuth):使用 Claude Code OAuth 登录。
  • Token (setup-token):用 claude setup-token 生成 token 后粘贴。
  • API key:使用 Anthropic Console API key。

在哪里设置

入口做什么
Control UI打开 Agents,选择 Agent,然后在 Agent > Models 里选择 Anthropic。
Onboarding选择 Set up model providers,再选择 Anthropic 的 sign-in/token/API key。
CLI使用 fased models auth login --provider anthropic --method ...

API key

fased onboard --anthropic-api-key "$ANTHROPIC_API_KEY"
示例:
{
  env: { ANTHROPIC_API_KEY: "sk-ant-..." },
  agents: { defaults: { model: { primary: "anthropic/claude-opus-4-7" } } },
}

setup-token

setup-token 由 Claude Code CLI 创建:
claude setup-token
然后在 Agent > Models 粘贴,或在 Gateway 主机运行:
fased models auth setup-token --provider anthropic
fased models auth paste-token --provider anthropic

Prompt caching

Anthropic API key 路线支持 cacheRetention
缓存时长
none不缓存
short5 分钟
long1 小时
{
  agents: {
    defaults: {
      models: {
        "anthropic/claude-opus-4-7": {
          params: { cacheRetention: "long" },
        },
      },
    },
  },
}

1M context beta

对支持的 Opus/Sonnet 模型可以设置:
{
  agents: {
    defaults: {
      models: {
        "anthropic/claude-opus-4-7": {
          params: { context1m: true },
        },
      },
    },
  },
}
OAuth/subscription token 路线会自动跳过不兼容的 1M beta header。

故障排除

  • Claude subscription token 失效时,重新运行 claude setup-token 并粘贴到 Gateway 主机。
  • 运行 fased models status 查看当前认证 profile。
  • 新 Agent 不会自动继承另一个 Agent 的模型角色;在 Agent > Models 为该 Agent 选择模型。