Anthropic (Claude)
Anthropic builds the Claude model family and provides access via an API. In OpenClaw you can authenticate with an API key or a setup-token.विकल्प A: Anthropic API कुंजी
Best for: standard API access and usage-based billing. Create your API key in the Anthropic Console.CLI सेटअप
कॉन्फ़िग स्निपेट
प्रॉम्प्ट कैशिंग (Anthropic API)
OpenClaw supports Anthropic’s prompt caching feature. This is API-only; subscription auth does not honor cache settings.कॉन्फ़िगरेशन
अपने मॉडल विन्यास मेंcacheRetention पैरामीटर का उपयोग करें:
| मान | कैश अवधि | Description |
|---|---|---|
none | No caching | Prompt caching अक्षम करें |
short | 5 minutes | API Key प्रमाणीकरण के लिए डिफ़ॉल्ट |
long | 1 hour | विस्तारित कैश (beta फ़्लैग आवश्यक) |
Defaults
When using Anthropic API Key authentication, OpenClaw automatically appliescacheRetention: "short" (5-minute cache) for all Anthropic models. You can override this by explicitly setting cacheRetention in your config.
Legacy parameter
पुरानाcacheControlTtl पैरामीटर पिछड़े अनुकूलन के लिए अभी भी समर्थित है:
"5m"का मैपिंगshortसे होता है"1h"का मैपिंगlongसे होता है
cacheRetention पैरामीटर पर माइग्रेट करने की अनुशंसा करते हैं।
OpenClaw में Anthropic API अनुरोधों के लिए extended-cache-ttl-2025-04-11 beta फ़्लैग शामिल है; यदि आप प्रदाता हेडर ओवरराइड करते हैं तो इसे बनाए रखें (देखें /gateway/configuration)।
विकल्प B: Claude setup-token
उपयुक्त: अपनी Claude सब्सक्रिप्शन का उपयोग करने के लिए।setup-token कहाँ प्राप्त करें
Setup-tokens are created by the Claude Code CLI, not the Anthropic Console. You can run this on any machine:CLI सेटअप (setup-token)
Config snippet (setup-token)
Notes
claude setup-tokenके साथ setup-token जनरेट करें और उसे पेस्ट करें, या Gateway होस्ट परopenclaw models auth setup-tokenचलाएँ।- If you see “OAuth token refresh failed …” on a Claude subscription, re-auth with a setup-token. See /gateway/troubleshooting#oauth-token-refresh-failed-anthropic-claude-subscription.
- प्रमाणीकरण विवरण + पुनः उपयोग नियम /concepts/oauth में हैं।
Troubleshooting
401 त्रुटियाँ / टोकन अचानक अमान्य- Claude subscription auth can expire or be revoked. Re-run
claude setup-tokenand paste it into the gateway host. - यदि Claude CLI लॉगिन किसी दूसरी मशीन पर है, तो Gateway होस्ट पर
openclaw models auth paste-token --provider anthropicका उपयोग करें।
- Auth is per agent. New agents don’t inherit the main agent’s keys.
- उस एजेंट के लिए onboarding पुनः चलाएँ, या Gateway होस्ट पर setup-token / API कुंजी पेस्ट करें,
फिर
openclaw models statusके साथ सत्यापित करें।
anthropic:default के लिए कोई क्रेडेंशियल नहीं मिले
- यह देखने के लिए
openclaw models statusचलाएँ कि कौन-सा auth प्रोफ़ाइल सक्रिय है। - onboarding पुनः चलाएँ, या उस प्रोफ़ाइल के लिए setup-token / API कुंजी पेस्ट करें।
openclaw models status --jsonमेंauth.unusableProfilesकी जाँच करें।- कोई अन्य Anthropic प्रोफ़ाइल जोड़ें या cooldown समाप्त होने की प्रतीक्षा करें।