OpenClaw: Gateway, API और सुरक्षित पहला launch
OpenClaw install करने, BetterToken provider जोड़ने, Gateway और model जाँचने तथा न्यूनतम permissions के साथ पहला local launch करने की विधि।
विषय-सूची

BetterToken connection के लिए OpenClaw guide खोलें और provider को SecretRef से configure करें। Gateway को loopback पर foreground में चलाएँ और पहला test अलग workspace व नई session में करें — channels, community skills और dangerous tools के बिना।
पहली जाँच के लिए अलग key से शुरू करें। BetterToken खाता बनाएँ
त्वरित चरण-दर-चरण योजना
- BetterToken में API Key और working endpoint तैयार करें।
- Tool की config file या environment variables configure करें।
- Test request चलाकर response और token usage जाँचें।
OpenClaw वास्तव में क्या चलाता है
OpenClaw कई layers का बना है; एक layer की error दूसरी की समस्या जैसी लग सकती है।
| Layer | काम | क्या जाँचें |
|---|---|---|
| Provider API | Selected model को request भेजता है | Base URL, API Key, protocol, Model ID |
| Gateway | Local control plane और clients का connection | bind, auth, process, RPC status |
| Agent workspace | Agent की work directory सीमित करता है | path, accessible files, tool permissions |
| Session | Current conversation context और state रखता है | model बदलने पर नई session |
| Channels | Telegram, Discord और अन्य external inputs | पहले launch में आवश्यक नहीं |
इस setup में BetterToken केवल provider API है। वह OpenClaw website, installer, channels, community skills या third-party services की availability की guarantee नहीं देता। API endpoint की access और OpenClaw की downloads/integrations की access अलग-अलग जाँचें।
स्थायी Gateway के बिना OpenClaw install करें
पहली जाँच में official installer को --no-onboard के साथ लें; इससे setup wizard और provider check से पहले permanent service बनना रुकता है।
macOS, Linux या WSL2
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
Windows PowerShell
& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard
CLI जाँचें:
openclaw --version
Official installer supported Node.js version जाँचता और आवश्यकता पर install करता है। Third-party guide का पुराना Node pin न करें; current requirements OpenClaw install page पर हैं।
API Key उजागर किए बिना BetterToken provider configure करें
मुख्य OpenClaw file:
~/.openclaw/openclaw.json
पहले अलग workspace बनाएँ:
mkdir -p ~/openclaw-first-check
पहले run में BetterToken की GPT group से current Model ID लें। निम्न config openai-responses उपयोग करती है; model name से protocol न अनुमानें, openai-completions या अन्य mode को current BetterToken OpenClaw documentation से मिलाएँ।
{
"models": {
"mode": "merge",
"providers": {
"bettertoken": {
"baseUrl": "https://www.bettertoken.ai/v1",
"apiKey": {
"source": "env",
"provider": "default",
"id": "BETTERTOKEN_API_KEY"
},
"api": "openai-responses",
"models": [{"id": "YOUR_MODEL_ID", "name": "YOUR_MODEL_ID"}]
}
}
},
"agents": {"defaults": {
"workspace": "~/openclaw-first-check",
"model": {"primary": "bettertoken/YOUR_MODEL_ID"}
}},
"gateway": {"mode": "local", "bind": "loopback"},
"tools": {
"profile": "minimal",
"deny": ["group:runtime", "exec", "process", "sessions_spawn"],
"elevated": {"enabled": false}
}
}
YOUR_MODEL_ID placeholder है; इसे model catalog या अपने Key के Setup window से मिले full ID से बदलें। Base URL में /responses या /chat/completions न जोड़ें। apiKey OpenClaw SecretRef उपयोग करता है: BETTERTOKEN_API_KEY Gateway process की protected environment में हो, पर key openclaw.json में न लिखी जाए।
Config और पुराने generated files में plaintext credential न बचा हो, जाँचें:
openclaw secrets audit --check
Audit plaintext पाए तो interactive migration करें:
openclaw secrets configure --apply
Key को prompt, log, commit या agent workspace में copy न करें।
Configuration, Gateway और model कैसे जाँचें
1. Launch से पहले JSON जाँचें
openclaw config validate
यह Gateway चलाए बिना active schema validate करता है। Error में बताया field, quotes या braces ठीक करके फिर चलाएँ।
2. Provider और selected model जाँचें
openclaw models list --provider bettertoken
openclaw models status
List में bettertoken/YOUR_MODEL_ID होना चाहिए और status उसे resolved default दिखाए। models list read-only है, successful API call का प्रमाण नहीं; अलग short request आवश्यक है।
3. Gateway foreground में चलाएँ
दूसरे terminal में:
openclaw gateway --force
Process खुला रखें। पहले terminal में जाँचें:
openclaw gateway status --require-rpc
openclaw status
Local test में Gateway loopback पर listen करे, auth माँगे और working RPC probe लौटाए। पहले launch के लिए bind को lan, tailnet या 0.0.0.0 न करें।
4. नई session खोलें
openclaw tui --session first-check
खुली session में पहले वास्तविक route जाँचें:
/status
/model status
यदि दूसरा model चुना है तो bettertoken/YOUR_MODEL_ID सेट करें, clean session शुरू करें और दोनों जाँचें दोहराएँ:
/model bettertoken/YOUR_MODEL_ID
/new
/status
/model status
Files बदले बिना यह minimal prompt भेजें:
केवल JSON लौटाएँ: {"agent":"openclaw","sum":4}। tools का उपयोग न करें और files न बदलें।
पहला launch तब confirmed है जब TUI valid JSON लौटाए, current session में /status और /model status bettertoken/YOUR_MODEL_ID दिखाएँ, Dashboard में expected model/status/token usage वाला request दिखे और workspace में unexpected changes न हों। Test के बाद foreground Gateway को Ctrl+C से रोकें; केवल उसके बाद permanent service का निर्णय लें।
5. परीक्षण के बाद ही service install करें
openclaw gateway install
openclaw gateway restart
openclaw gateway status --require-rpc
Restart के लिए openclaw gateway restart लें; official runbook stop और start की chain से बदलने की सलाह नहीं देता।
पहला launch न्यूनतम permissions में क्यों होना चाहिए
Gateway default रूप से एक trusted boundary के लिए है। Tool-enabled agent files पढ़/बदल सकता, commands चला सकता और network access कर सकता है। Prompt injection केवल public chat से नहीं: malicious instruction page, document, attachment या log से भी आ सकती है।
पहले test में tools.profile को minimal, Gateway को loopback और channels को unconfigured रखें। Source और permissions जाँचे बिना community skills या plugins न install करें। Access बढ़ाने से पहले चलाएँ:
openclaw security audit --deep
tools.profile: "minimal" केवल base profile है, पूर्ण isolation का प्रमाण नहीं। उदाहरण runtime/control-plane tools, exec, process और sessions_spawn को भी deny करता है और elevated mode बंद रखता है। पहली tool-enabled session से पहले global और agents.entries.* overrides audit करें: वे host exec, elevated mode, filesystem write या runtime tools को फिर से enabled न करें। यह भी चलाएँ:
openclaw sandbox explain
बाद में file tools चाहिए हों तो पहले उस agent के लिए sandbox और workspace access तय करें, फिर दोनों audits दोहराएँ।
बाद में channel जोड़ें तो pairing या allowlist और अलग session scope से शुरू करें। Mutually untrusted users के लिए shared Gateway supported isolation boundary नहीं है।
पुरानी session पूर्व model क्यों उपयोग कर सकती है
agents.defaults.model.primary बदलने के बाद खुले conversation के लिए केवल JSON edit पर्याप्त नहीं। Config validate करें, Gateway restart करें और new session key बनाएँ:
openclaw config validate
openclaw gateway restart
openclaw tui --session after-model-change
यदि नई session फिर भी दूसरा provider ले, agents.defaults.model.primary, models.providers.bettertoken.models और openclaw models status मिलाएँ।
सामान्य errors
config validate fail होता है
JSON structure और supported api values जाँचें। जानबूझकर invalid config के साथ Gateway न चलाएँ; successful validation तक direct editor writes untrusted हैं।
Gateway शुरू नहीं होता या RPC probe fail है
पहले openclaw gateway status चलाएँ। EADDRINUSE port conflict या दूसरा Gateway process है; auth error Gateway credential और client mismatch है। Error हटाने के लिए auth बंद या bind external network पर न खोलें।
401, 404 या protocol error
401 में देखें SecretRef Gateway environment में resolve हो रहा है। GPT group के लिए openai-responses और https://www.bettertoken.ai/v1 लें। दूसरे provider में Docs का exact protocol लें; endpoint manually न जोड़ें।
Model JSON में है, पर दिखाई नहीं देती
models.providers.bettertoken.models के ID को agents.defaults.model.primary से मिलाएँ, फिर openclaw config validate, openclaw models list --provider bettertoken और openclaw models status चलाएँ।
FAQ
क्या Telegram या Discord तुरंत जोड़ना जरूरी है?
नहीं। पहले local provider, Gateway, model और new session confirm करें। Channels access surface बढ़ाते हैं और pairing/allowlist की अलग policy चाहिए।
API Key सीधे openclaw.json में लिख सकते हैं?
Technically plaintext supported हो सकता है, पर सुरक्षित launch के लिए SecretRef लें। Config में खुली key उसे पढ़ सकने वाले किसी भी process या agent tool को मिल सकती है।
Successful model request के बिना Gateway कैसे जाँचें?
openclaw gateway status --require-rpc RPC जाँचता है और openclaw models status model resolution तथा credential। Full end-to-end test केवल new session में short response और BetterToken Dashboard request दिखने पर पूरा है।