Anthropic (Claude)
Anthropic entwickelt die Claude-Modellfamilie und bietet Zugriff über eine API. In OpenClaw kannst du dich mit einem API-Key oder einem setup-token authentifizieren.
Option A: Anthropic API-Key
Am besten für: Standard-API-Zugriff und nutzungsbasierte Abrechnung. Erstelle deinen API-Key in der Anthropic Console.
CLI-Setup
openclaw onboard
# wähle: Anthropic API key
# oder nicht-interaktiv
openclaw onboard --anthropic-api-key "$ANTHROPIC_API_KEY"
Config-Beispiel
{
env: { ANTHROPIC_API_KEY: "sk-ant-..." },
agents: { defaults: { model: { primary: "anthropic/claude-opus-4-5" } } },
}
Prompt Caching (Anthropic API)
OpenClaw unterstützt Anthropics Prompt-Caching-Feature. Das funktioniert nur mit der API – bei Subscription-Auth werden Cache-Einstellungen nicht berücksichtigt.
Konfiguration
Nutze den Parameter cacheRetention in deiner Modell-Config:
| Wert | Cache-Dauer | Beschreibung |
|---|---|---|
none | Kein Caching | Prompt-Caching deaktivieren |
short | 5 Minuten | Standard bei API-Key-Auth |
long | 1 Stunde | Erweiterter Cache (benötigt Beta-Flag) |
{
agents: {
defaults: {
models: {
"anthropic/claude-opus-4-5": {
params: { cacheRetention: "long" },
},
},
},
},
}
Standardwerte
Bei Verwendung der Anthropic API-Key-Authentifizierung wendet OpenClaw automatisch cacheRetention: "short" (5-Minuten-Cache) für alle Anthropic-Modelle an. Du kannst das überschreiben, indem du cacheRetention explizit in deiner Config setzt.
Legacy-Parameter
Der ältere Parameter cacheControlTtl wird aus Kompatibilitätsgründen noch unterstützt:
"5m"entsprichtshort"1h"entsprichtlong
Wir empfehlen die Migration zum neuen Parameter cacheRetention.
OpenClaw fügt das Beta-Flag extended-cache-ttl-2025-04-11 für Anthropic-API-Requests hinzu. Behalte es bei, wenn du Provider-Header überschreibst (siehe /gateway/configuration).
Option B: Claude setup-token
Am besten für: Nutzung deines Claude-Abonnements.
Wo du ein setup-token bekommst
Setup-Tokens werden von der Claude Code CLI erstellt, nicht von der Anthropic Console. Du kannst das auf jedem Rechner ausführen:
claude setup-token
Füge den Token in OpenClaw ein (Wizard: Anthropic token (paste setup-token)), oder führe es auf dem Gateway-Host aus:
openclaw models auth setup-token --provider anthropic
Falls du den Token auf einem anderen Rechner generiert hast, füge ihn so ein:
openclaw models auth paste-token --provider anthropic
CLI-Setup
# Setup-Token während des Onboardings einfügen
openclaw onboard --auth-choice setup-token
Config-Beispiel
{
agents: { defaults: { model: { primary: "anthropic/claude-opus-4-5" } } },
}
Hinweise
- Generiere den setup-token mit
claude setup-tokenund füge ihn ein, oder führeopenclaw models auth setup-tokenauf dem Gateway-Host aus. - Falls du “OAuth token refresh failed …” bei einem Claude-Abonnement siehst, authentifiziere dich neu mit einem setup-token. Siehe /gateway/troubleshooting#oauth-token-refresh-failed-anthropic-claude-subscription.
- Auth-Details und Wiederverwendungsregeln findest du unter /concepts/oauth.
Troubleshooting
401-Fehler / Token plötzlich ungültig
- Claude-Subscription-Auth kann ablaufen oder widerrufen werden. Führe
claude setup-tokenerneut aus und füge ihn auf dem Gateway-Host ein. - Falls der Claude-CLI-Login auf einem anderen Rechner läuft, nutze
openclaw models auth paste-token --provider anthropicauf dem Gateway-Host.
No API key found for provider “anthropic”
- Auth ist pro Agent. Neue Agents erben nicht die Keys des Haupt-Agents.
- Führe das Onboarding für diesen Agent erneut aus, oder füge einen setup-token / API-Key auf dem Gateway-Host ein und prüfe mit
openclaw models status.
No credentials found for profile anthropic:default
- Führe
openclaw models statusaus, um zu sehen, welches Auth-Profil aktiv ist. - Führe das Onboarding erneut aus, oder füge einen setup-token / API-Key für dieses Profil ein.
No available auth profile (all in cooldown/unavailable)
- Prüfe
openclaw models status --jsonaufauth.unusableProfiles. - Füge ein weiteres Anthropic-Profil hinzu oder warte auf das Ende des Cooldowns.
Mehr: /gateway/troubleshooting und /help/faq.