{"id":146,"date":"2026-03-21T22:47:19","date_gmt":"2026-03-21T14:47:19","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/help-environment\/"},"modified":"2026-03-21T23:08:55","modified_gmt":"2026-03-21T15:08:55","slug":"help-environment","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/help-environment\/","title":{"rendered":"\u73af\u5883\u53d8\u91cf"},"content":{"rendered":"<h1>\u73af\u5883\u53d8\u91cf<\/h1>\n<p>OpenClaw \u4ece\u591a\u4e2a\u6765\u6e90\u62c9\u53d6\u73af\u5883\u53d8\u91cf\u3002\u89c4\u5219\u662f<strong>\u6c38\u4e0d\u8986\u76d6\u73b0\u6709\u503c<\/strong>\u3002<\/p>\n<h2>\u4f18\u5148\u7ea7\uff08\u4ece\u9ad8\u5230\u4f4e\uff09<\/h2>\n<ol>\n<li><strong>\u8fdb\u7a0b\u73af\u5883<\/strong>\uff08Gateway \u7f51\u5173\u8fdb\u7a0b\u4ece\u7236 shell\/\u5b88\u62a4\u8fdb\u7a0b\u5df2\u6709\u7684\u5185\u5bb9\uff09\u3002<\/li>\n<li><strong>\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684 <code>.env<\/code><\/strong>\uff08dotenv \u9ed8\u8ba4\uff1b\u4e0d\u8986\u76d6\uff09\u3002<\/li>\n<li><strong>\u5168\u5c40 <code>.env<\/code><\/strong> \u4f4d\u4e8e <code>~\/.openclaw\/.env<\/code>\uff08\u5373 <code>$OPENCLAW_STATE_DIR\/.env<\/code>\uff1b\u4e0d\u8986\u76d6\uff09\u3002<\/li>\n<li><strong>\u914d\u7f6e <code>env<\/code> \u5757<\/strong> \u4f4d\u4e8e <code>~\/.openclaw\/openclaw.json<\/code>\uff08\u4ec5\u5728\u7f3a\u5931\u65f6\u5e94\u7528\uff09\u3002<\/li>\n<li><strong>\u53ef\u9009\u7684\u767b\u5f55 shell \u5bfc\u5165<\/strong>\uff08<code>env.shellEnv.enabled<\/code> \u6216 <code>OPENCLAW_LOAD_SHELL_ENV=1<\/code>\uff09\uff0c\u4ec5\u5bf9\u7f3a\u5931\u7684\u9884\u671f\u952e\u540d\u5e94\u7528\u3002<\/li>\n<\/ol>\n<p>\u5982\u679c\u914d\u7f6e\u6587\u4ef6\u5b8c\u5168\u7f3a\u5931\uff0c\u6b65\u9aa4 4 \u5c06\u88ab\u8df3\u8fc7\uff1b\u5982\u679c\u542f\u7528\u4e86 shell \u5bfc\u5165\uff0c\u5b83\u4ecd\u4f1a\u8fd0\u884c\u3002<\/p>\n<h2>\u914d\u7f6e <code>env<\/code> \u5757<\/h2>\n<p>\u4e24\u79cd\u7b49\u6548\u65b9\u5f0f\u8bbe\u7f6e\u5185\u8054\u73af\u5883\u53d8\u91cf\uff08\u90fd\u662f\u975e\u8986\u76d6\u7684\uff09\uff1a<\/p>\n<p>&#8220;`json5  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n{<br \/>\n  env: {<br \/>\n    OPENROUTER_API_KEY: &#8220;sk-or-&#8230;&#8221;,<br \/>\n    vars: {<br \/>\n      GROQ_API_KEY: &#8220;gsk-&#8230;&#8221;,<br \/>\n    },<br \/>\n  },<br \/>\n}<\/p>\n<pre><code>\n## Shell \u73af\u5883\u5bfc\u5165\n\n`env.shellEnv` \u8fd0\u884c\u4f60\u7684\u767b\u5f55 shell \u5e76\u4ec5\u5bfc\u5165**\u7f3a\u5931\u7684**\u9884\u671f\u952e\u540d\uff1a\n\n```json5  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\n{\n  env: {\n    shellEnv: {\n      enabled: true,\n      timeoutMs: 15000,\n    },\n  },\n}\n<\/code><\/pre>\n<p>\u73af\u5883\u53d8\u91cf\u7b49\u6548\u9879\uff1a<\/p>\n<ul>\n<li><code>OPENCLAW_LOAD_SHELL_ENV=1<\/code><\/li>\n<li><code>OPENCLAW_SHELL_ENV_TIMEOUT_MS=15000<\/code><\/li>\n<\/ul>\n<h2>\u914d\u7f6e\u4e2d\u7684\u73af\u5883\u53d8\u91cf\u66ff\u6362<\/h2>\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>${VAR_NAME}<\/code> \u8bed\u6cd5\u5728\u914d\u7f6e\u5b57\u7b26\u4e32\u503c\u4e2d\u76f4\u63a5\u5f15\u7528\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<p><code>json5  theme={\"theme\":{\"light\":\"min-light\",\"dark\":\"min-dark\"}}<br \/>\n{<br \/>\n  models: {<br \/>\n    providers: {<br \/>\n      \"vercel-gateway\": {<br \/>\n        apiKey: \"${VERCEL_GATEWAY_API_KEY}\",<br \/>\n      },<br \/>\n    },<br \/>\n  },<br \/>\n}<\/code><\/p>\n<p>\u5b8c\u6574\u8be6\u60c5\u53c2\u89c1<a href=\"\/gateway\/configuration#env-var-substitution-in-config\">\u914d\u7f6e\uff1a\u73af\u5883\u53d8\u91cf\u66ff\u6362<\/a>\u3002<\/p>\n<h2>\u76f8\u5173\u5185\u5bb9<\/h2>\n<ul>\n<li><a href=\"\/gateway\/configuration\">Gateway \u7f51\u5173\u914d\u7f6e<\/a><\/li>\n<li><a href=\"\/help\/faq#env-vars-and-env-loading\">\u5e38\u89c1\u95ee\u9898\uff1a\u73af\u5883\u53d8\u91cf\u548c .env \u52a0\u8f7d<\/a><\/li>\n<li><a href=\"\/concepts\/models\">\u6a21\u578b\u6982\u8ff0<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883\u53d8\u91cf OpenClaw \u4ece\u591a\u4e2a\u6765\u6e90\u62c9\u53d6\u73af\u5883\u53d8\u91cf\u3002\u89c4\u5219\u662f\u6c38\u4e0d\u8986\u76d6\u73b0\u6709\u503c\u3002 \u4f18\u5148\u7ea7\uff08\u4ece\u9ad8\u5230\u4f4e\uff09 \u8fdb\u7a0b\u73af\u5883\uff08Ga [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-146","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=146"}],"version-history":[{"count":1,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/146\/revisions"}],"predecessor-version":[{"id":441,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/146\/revisions\/441"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}