Anthropic (Claude)¶
Anthropic Claude मॉडल परिवार बनाता है और API के माध्यम से एक्सेस प्रदान करता है। In OpenClaw you can authenticate with an API key or a setup-token.
विकल्प A: Anthropic API कुंजी¶
सर्वोत्तम उपयोग: मानक API एक्सेस और उपयोग-आधारित बिलिंग। Create your API key in the Anthropic Console.
CLI सेटअप¶
openclaw onboard
# choose: Anthropic API key
# or non-interactive
openclaw onboard --anthropic-api-key "$ANTHROPIC_API_KEY"
कॉन्फ़िग स्निपेट¶
{
env: { ANTHROPIC_API_KEY: "sk-ant-..." },
agents: { defaults: { model: { primary: "anthropic/claude-opus-4-6" } } },
}
प्रॉम्प्ट कैशिंग (Anthropic API)¶
OpenClaw, Anthropic की प्रॉम्प्ट कैशिंग सुविधा का समर्थन करता है। यह केवल API-only है; सब्सक्रिप्शन ऑथेंटिकेशन कैश सेटिंग्स का पालन नहीं करता।
कॉन्फ़िगरेशन¶
अपने मॉडल विन्यास में cacheRetention पैरामीटर का उपयोग करें:
| मान | कैश अवधि | Description |
|---|---|---|
none |
No caching | Prompt caching अक्षम करें |
short |
5 minutes | API Key प्रमाणीकरण के लिए डिफ़ॉल्ट |
long |
1 hour | विस्तारित कैश (beta फ़्लैग आवश्यक) |
{
agents: {
defaults: {
models: {
"anthropic/claude-opus-4-6": {
params: { cacheRetention: "long" },
},
},
},
},
}
Defaults¶
When using Anthropic API Key authentication, OpenClaw automatically applies cacheRetention: "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:
claude setup-token
टोकन को OpenClaw में पेस्ट करें (विज़ार्ड: Anthropic token (paste setup-token)), या इसे Gateway होस्ट पर चलाएँ:
openclaw models auth setup-token --provider anthropic
यदि आपने टोकन किसी दूसरी मशीन पर बनाया है, तो उसे पेस्ट करें:
openclaw models auth paste-token --provider anthropic
CLI सेटअप (setup-token)¶
# Paste a setup-token during onboarding
openclaw onboard --auth-choice setup-token
Config snippet (setup-token)¶
{
agents: { defaults: { model: { primary: "anthropic/claude-opus-4-6" } } },
}
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का उपयोग करें।
प्रदाता "anthropic" के लिए कोई API कुंजी नहीं मिली
- 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 कुंजी पेस्ट करें।
कोई उपलब्ध auth प्रोफ़ाइल नहीं (सभी cooldown/अनुपलब्ध)
openclaw models status --jsonमेंauth.unusableProfilesकी जाँच करें।- कोई अन्य Anthropic प्रोफ़ाइल जोड़ें या cooldown समाप्त होने की प्रतीक्षा करें।
और अधिक: /gateway/troubleshooting और /help/faq।