Anthropic
OpenClaw で Anthropic Claude を利用:API Key または setup-token に対応。
Anthropic は Claude モデルファミリーを構築し、API 経由でアクセスを提供します。OpenClaw では、API Key または setup-token で認証できます。
オプション A:Anthropic API Key
最適: 標準 API アクセスと従量課金。
Anthropic Console で API Key を作成します。
#
CLI Setup
openclaw onboard openclaw onboard --anthropic-api-key "$ANTHROPIC_API_KEY"
#
設定スニペット
{
env: { ANTHROPIC_API_KEY: "sk-ant-..." },
agents: { defaults: { model: { primary: "anthropic/claude-opus-4-5" } } },
}Prompt caching(Anthropic API)
OpenClaw は Anthropic の prompt caching 機能をサポートしています。注意:この機能は API Key 認証でのみ機能します;サブスクリプション認証はキャッシュ設定を適用しません。
#
Configuration
モデル設定で ''cacheRetention'' パラメータを使用します:
| 値 | キャッシュ期間 | 説明 |
| -- | ---- |
| ''none'' | キャッシュなし | prompt caching を無効化 |
| ''short'' | 5 分間 | API Key 認証のデフォルト |
| ''long'' | 1 時間 | 拡張キャッシュ(beta flag が必要) |
{
agents: {
defaults: {
models: {
"anthropic/claude-opus-4-5": {
params: { cacheRetention: "long" },
},
},
},
},
}#
デフォルトの動作
Anthropic API Key 認証を使用する場合、OpenClaw はすべての Anthropic モデルに自動的に ''cacheRetention: "short"''(5 分間キャッシュ)を適用します。設定で明示的に ''cacheRetention'' を設定して上書きできます。
#
レガシーパラメータ(互換性)
レガシー ''cacheControlTtl'' は履歴設定との互換性のために保持されています:
- ''"5m"'' は ''short'' に対応
- ''"1h"'' は ''long'' に対応
新しい ''cacheRetention'' パラメータへの移行を推奨します。
OpenClaw は Anthropic API リクエストに ''extended-cache-ttl-2025-04-11'' beta flag を含めます;provider headers を上書きする場合、この flag を保持してください(''/gateway/configuration'' を参照)。
オプション B:Claude setup-token
最適: Claude サブスクリプションを使用する場合。
#
setup-token の取得方法
setup-token は Claude Code CLI によって生成され、Anthropic Console では作成されません。任意のマシンで実行できます:
claude setup-token
token を OpenClaw に貼り付けます(ウィザード:Anthropic token(setup-token を貼り付け))、または gateway ホストで実行します:
openclaw models auth setup-token --provider anthropic
token が別のマシンで生成された場合、gateway ホストで貼り付けます:
openclaw models auth paste-token --provider anthropic
#
CLI Setup
openclaw onboard --auth-choice setup-token
#
設定スニペット
{
agents: { defaults: { model: { primary: "anthropic/claude-opus-4-5" } } },
}Notes
- ''claude setup-token'' で生成して貼り付けるか、gateway ホストで ''openclaw models auth setup-token'' を実行します。
- Claude サブスクリプションで "OAuth token refresh failed …" が表示される場合、setup-token で再認証してください。''/gateway/troubleshooting#oauth-token-refresh-failed-anthropic-claude-subscription'' を参照してください。
- 認証の詳細と再利用ルールについては ''/concepts/oauth'' を参照してください。
トラブルシューティング
401 / token が突然無効
- Claude サブスクリプション認証が期限切れまたは取り消されている可能性があります。''claude setup-token'' を再実行し、''gateway ホスト'' で貼り付けます。
- Claude CLI ログインが別のマシンにある場合、gateway ホストで ''openclaw models auth paste-token --provider anthropic'' を使用します。
No API key found for provider "anthropic"
- 認証は エージェントごと に保存されます。新しいエージェントはプライマリエージェントのキーを継承しません。
- そのエージェントのオンボーディングを再実行するか、gateway ホストで setup-token / API key を貼り付け、''openclaw models status'' で検証します。
''No credentials found for profile ''anthropic:default''''
- ''openclaw models status'' を実行して、現在の認証プロファイルを確認します。
- オンボーディングを再実行するか、そのプロファイルの setup-token / API key を貼り付けます。
No available auth profile(すべて cooldown/unavailable)
- ''openclaw models status --json'' を実行して ''auth.unusableProfiles'' を確認します。
- 別の Anthropic プロファイルを追加するか、cooldown が終了するまで待ちます。
詳細:''/gateway/troubleshooting'' と ''/help/faq''。