{"id":95,"date":"2026-03-21T22:47:17","date_gmt":"2026-03-21T14:47:17","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/concepts-model-failover\/"},"modified":"2026-03-21T23:08:53","modified_gmt":"2026-03-21T15:08:53","slug":"concepts-model-failover","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/concepts-model-failover\/","title":{"rendered":"\u6a21\u578b\u6545\u969c\u8f6c\u79fb"},"content":{"rendered":"<h1>\u6a21\u578b\u6545\u969c\u8f6c\u79fb<\/h1>\n<p>OpenClaw \u5206\u4e24\u4e2a\u9636\u6bb5\u5904\u7406\u6545\u969c\uff1a<\/p>\n<ol>\n<li>\u5728\u5f53\u524d\u63d0\u4f9b\u5546\u5185\u8fdb\u884c<strong>\u8ba4\u8bc1\u914d\u7f6e\u6587\u4ef6\u8f6e\u6362<\/strong>\u3002<\/li>\n<li><strong>\u6a21\u578b\u56de\u9000<\/strong>\u5230 <code>agents.defaults.model.fallbacks<\/code> \u4e2d\u7684\u4e0b\u4e00\u4e2a\u6a21\u578b\u3002<\/li>\n<\/ol>\n<p>\u672c\u6587\u6863\u89e3\u91ca\u8fd0\u884c\u65f6\u89c4\u5219\u53ca\u5176\u80cc\u540e\u7684\u6570\u636e\u3002<\/p>\n<h2>\u8ba4\u8bc1\u5b58\u50a8\uff08\u5bc6\u94a5 + OAuth\uff09<\/h2>\n<p>OpenClaw \u5bf9 API \u5bc6\u94a5\u548c OAuth \u4ee4\u724c\u90fd\u4f7f\u7528<strong>\u8ba4\u8bc1\u914d\u7f6e\u6587\u4ef6<\/strong>\u3002<\/p>\n<ul>\n<li>\u5bc6\u94a5\u5b58\u50a8\u5728 <code>~\/.openclaw\/agents\/&lt;agentId&gt;\/agent\/auth-profiles.json<\/code>\uff08\u65e7\u7248\uff1a<code>~\/.openclaw\/agent\/auth-profiles.json<\/code>\uff09\u3002<\/li>\n<li>\u914d\u7f6e <code>auth.profiles<\/code> \/ <code>auth.order<\/code> <strong>\u4ec5\u7528\u4e8e\u5143\u6570\u636e\u548c\u8def\u7531<\/strong>\uff08\u4e0d\u542b\u5bc6\u94a5\uff09\u3002<\/li>\n<li>\u65e7\u7248\u4ec5\u5bfc\u5165 OAuth \u6587\u4ef6\uff1a<code>~\/.openclaw\/credentials\/oauth.json<\/code>\uff08\u9996\u6b21\u4f7f\u7528\u65f6\u5bfc\u5165\u5230 <code>auth-profiles.json<\/code>\uff09\u3002<\/li>\n<\/ul>\n<p>\u66f4\u591a\u8be6\u60c5\uff1a<a href=\"\/concepts\/oauth\">\/concepts\/oauth<\/a><\/p>\n<p>\u51ed\u8bc1\u7c7b\u578b\uff1a<\/p>\n<ul>\n<li><code>type: \"api_key\"<\/code> \u2192 <code>{ provider, key }<\/code><\/li>\n<li><code>type: \"oauth\"<\/code> \u2192 <code>{ provider, access, refresh, expires, email? }<\/code>\uff08\u67d0\u4e9b\u63d0\u4f9b\u5546\u8fd8\u6709 <code>projectId<\/code>\/<code>enterpriseUrl<\/code>\uff09<\/li>\n<\/ul>\n<h2>\u914d\u7f6e\u6587\u4ef6 ID<\/h2>\n<p>OAuth \u767b\u5f55\u521b\u5efa\u4e0d\u540c\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u4fbf\u591a\u4e2a\u8d26\u6237\u53ef\u4ee5\u5171\u5b58\u3002<\/p>\n<ul>\n<li>\u9ed8\u8ba4\uff1a\u5f53\u6ca1\u6709\u7535\u5b50\u90ae\u4ef6\u53ef\u7528\u65f6\u4e3a <code>provider:default<\/code>\u3002<\/li>\n<li>\u5e26\u7535\u5b50\u90ae\u4ef6\u7684 OAuth\uff1a<code>provider:&lt;email&gt;<\/code>\uff08\u4f8b\u5982 <code>google-antigravity:user@gmail.com<\/code>\uff09\u3002<\/li>\n<\/ul>\n<p>\u914d\u7f6e\u6587\u4ef6\u5b58\u50a8\u5728 <code>~\/.openclaw\/agents\/&lt;agentId&gt;\/agent\/auth-profiles.json<\/code> \u7684 <code>profiles<\/code> \u4e0b\u3002<\/p>\n<h2>\u8f6e\u6362\u987a\u5e8f<\/h2>\n<p>\u5f53\u4e00\u4e2a\u63d0\u4f9b\u5546\u6709\u591a\u4e2a\u914d\u7f6e\u6587\u4ef6\u65f6\uff0cOpenClaw \u6309\u4ee5\u4e0b\u987a\u5e8f\u9009\u62e9\uff1a<\/p>\n<ol>\n<li><strong>\u663e\u5f0f\u914d\u7f6e<\/strong>\uff1a<code>auth.order[provider]<\/code>\uff08\u5982\u679c\u8bbe\u7f6e\uff09\u3002<\/li>\n<li><strong>\u5df2\u914d\u7f6e\u7684\u914d\u7f6e\u6587\u4ef6<\/strong>\uff1a\u6309\u63d0\u4f9b\u5546\u8fc7\u6ee4\u7684 <code>auth.profiles<\/code>\u3002<\/li>\n<li><strong>\u5df2\u5b58\u50a8\u7684\u914d\u7f6e\u6587\u4ef6<\/strong>\uff1a<code>auth-profiles.json<\/code> \u4e2d\u8be5\u63d0\u4f9b\u5546\u7684\u6761\u76ee\u3002<\/li>\n<\/ol>\n<p>\u5982\u679c\u6ca1\u6709\u914d\u7f6e\u663e\u5f0f\u987a\u5e8f\uff0cOpenClaw \u4f7f\u7528\u8f6e\u8be2\u987a\u5e8f\uff1a<\/p>\n<ul>\n<li><strong>\u4e3b\u952e\uff1a<\/strong> \u914d\u7f6e\u6587\u4ef6\u7c7b\u578b\uff08<strong>OAuth \u4f18\u5148\u4e8e API \u5bc6\u94a5<\/strong>\uff09\u3002<\/li>\n<li><strong>\u6b21\u952e\uff1a<\/strong> <code>usageStats.lastUsed<\/code>\uff08\u6bcf\u79cd\u7c7b\u578b\u4e2d\u6700\u65e7\u7684\u4f18\u5148\uff09\u3002<\/li>\n<li><strong>\u51b7\u5374\/\u7981\u7528\u7684\u914d\u7f6e\u6587\u4ef6<\/strong>\u4f1a\u79fb\u5230\u672b\u5c3e\uff0c\u6309\u6700\u65e9\u8fc7\u671f\u65f6\u95f4\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<h3>\u4f1a\u8bdd\u7c98\u6027\uff08\u7f13\u5b58\u53cb\u597d\uff09<\/h3>\n<p>OpenClaw <strong>\u4e3a\u6bcf\u4e2a\u4f1a\u8bdd\u56fa\u5b9a\u6240\u9009\u7684\u8ba4\u8bc1\u914d\u7f6e\u6587\u4ef6<\/strong>\u4ee5\u4fdd\u6301\u63d0\u4f9b\u5546\u7f13\u5b58\u70ed\u5ea6\u3002\u5b83<strong>\u4e0d\u4f1a<\/strong>\u5728\u6bcf\u4e2a\u8bf7\u6c42\u65f6\u8f6e\u6362\u3002\u56fa\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6\u4f1a\u88ab\u91cd\u7528\u76f4\u5230\uff1a<\/p>\n<ul>\n<li>\u4f1a\u8bdd\u88ab\u91cd\u7f6e\uff08<code>\/new<\/code> \/ <code>\/reset<\/code>\uff09<\/li>\n<li>\u538b\u7f29\u5b8c\u6210\uff08\u538b\u7f29\u8ba1\u6570\u9012\u589e\uff09<\/li>\n<li>\u914d\u7f6e\u6587\u4ef6\u5904\u4e8e\u51b7\u5374\/\u7981\u7528\u72b6\u6001<\/li>\n<\/ul>\n<p>\u901a\u8fc7 <code>\/model \u2026@&lt;profileId&gt;<\/code> \u624b\u52a8\u9009\u62e9\u4f1a\u4e3a\u8be5\u4f1a\u8bdd\u8bbe\u7f6e<strong>\u7528\u6237\u8986\u76d6<\/strong>\uff0c\u5728\u65b0\u4f1a\u8bdd\u5f00\u59cb\u4e4b\u524d\u4e0d\u4f1a\u81ea\u52a8\u8f6e\u6362\u3002<\/p>\n<p>\u81ea\u52a8\u56fa\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u7531\u4f1a\u8bdd\u8def\u7531\u5668\u9009\u62e9\uff09\u88ab\u89c6\u4e3a<strong>\u504f\u597d<\/strong>\uff1a\u5b83\u4eec\u4f1a\u4f18\u5148\u5c1d\u8bd5\uff0c\u4f46 OpenClaw \u53ef\u80fd\u5728\u901f\u7387\u9650\u5236\/\u8d85\u65f6\u65f6\u8f6e\u6362\u5230\u53e6\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\u3002\u7528\u6237\u56fa\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6\u4f1a\u9501\u5b9a\u5230\u8be5\u914d\u7f6e\u6587\u4ef6\uff1b\u5982\u679c\u5931\u8d25\u4e14\u914d\u7f6e\u4e86\u6a21\u578b\u56de\u9000\uff0cOpenClaw \u4f1a\u79fb\u52a8\u5230\u4e0b\u4e00\u4e2a\u6a21\u578b\u800c\u4e0d\u662f\u5207\u6362\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<h3>\u4e3a\u4ec0\u4e48 OAuth \u53ef\u80fd&#8221;\u770b\u8d77\u6765\u4e22\u5931&#8221;<\/h3>\n<p>\u5982\u679c\u4f60\u4e3a\u540c\u4e00\u4e2a\u63d0\u4f9b\u5546\u540c\u65f6\u62e5\u6709 OAuth \u914d\u7f6e\u6587\u4ef6\u548c API \u5bc6\u94a5\u914d\u7f6e\u6587\u4ef6\uff0c\u9664\u975e\u56fa\u5b9a\uff0c\u5426\u5219\u8f6e\u8be2\u53ef\u80fd\u5728\u6d88\u606f\u4e4b\u95f4\u5207\u6362\u5b83\u4eec\u3002\u8981\u5f3a\u5236\u4f7f\u7528\u5355\u4e2a\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528 <code>auth.order[provider] = [\"provider:profileId\"]<\/code> \u56fa\u5b9a\uff0c\u6216<\/li>\n<li>\u901a\u8fc7 <code>\/model \u2026<\/code> \u4f7f\u7528\u6bcf\u4f1a\u8bdd\u8986\u76d6\u5e76\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u8986\u76d6\uff08\u5f53\u4f60\u7684 UI\/\u804a\u5929\u754c\u9762\u652f\u6301\u65f6\uff09\u3002<\/li>\n<\/ul>\n<h2>\u51b7\u5374\u65f6\u95f4<\/h2>\n<p>\u5f53\u914d\u7f6e\u6587\u4ef6\u56e0\u8ba4\u8bc1\/\u901f\u7387\u9650\u5236\u9519\u8bef\uff08\u6216\u770b\u8d77\u6765\u50cf\u901f\u7387\u9650\u5236\u7684\u8d85\u65f6\uff09\u800c\u5931\u8d25\u65f6\uff0cOpenClaw \u5c06\u5176\u6807\u8bb0\u4e3a\u51b7\u5374\u72b6\u6001\u5e76\u79fb\u52a8\u5230\u4e0b\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\u3002\u683c\u5f0f\/\u65e0\u6548\u8bf7\u6c42\u9519\u8bef\uff08\u4f8b\u5982 Cloud Code Assist \u5de5\u5177\u8c03\u7528 ID \u9a8c\u8bc1\u5931\u8d25\uff09\u88ab\u89c6\u4e3a\u503c\u5f97\u6545\u969c\u8f6c\u79fb\u7684\u60c5\u51b5\uff0c\u4f7f\u7528\u76f8\u540c\u7684\u51b7\u5374\u65f6\u95f4\u3002<\/p>\n<p>\u51b7\u5374\u65f6\u95f4\u4f7f\u7528\u6307\u6570\u9000\u907f\uff1a<\/p>\n<ul>\n<li>1 \u5206\u949f<\/li>\n<li>5 \u5206\u949f<\/li>\n<li>25 \u5206\u949f<\/li>\n<li>1 \u5c0f\u65f6\uff08\u4e0a\u9650\uff09<\/li>\n<\/ul>\n<p>\u72b6\u6001\u5b58\u50a8\u5728 <code>auth-profiles.json<\/code> \u7684 <code>usageStats<\/code> \u4e0b\uff1a<\/p>\n<p>&#8220;`json  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n{<br \/>\n  &#8220;usageStats&#8221;: {<br \/>\n    &#8220;provider:profile&#8221;: {<br \/>\n      &#8220;lastUsed&#8221;: 1736160000000,<br \/>\n      &#8220;cooldownUntil&#8221;: 1736160600000,<br \/>\n      &#8220;errorCount&#8221;: 2<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<pre><code>\n## \u8d26\u5355\u7981\u7528\n\n\u8d26\u5355\/\u989d\u5ea6\u5931\u8d25\uff08\u4f8b\u5982&quot;insufficient credits&quot;\/&quot;credit balance too low&quot;\uff09\u88ab\u89c6\u4e3a\u503c\u5f97\u6545\u969c\u8f6c\u79fb\u7684\u60c5\u51b5\uff0c\u4f46\u5b83\u4eec\u901a\u5e38\u4e0d\u662f\u6682\u65f6\u6027\u7684\u3002OpenClaw \u4e0d\u4f7f\u7528\u77ed\u51b7\u5374\u65f6\u95f4\uff0c\u800c\u662f\u5c06\u914d\u7f6e\u6587\u4ef6\u6807\u8bb0\u4e3a**\u7981\u7528**\uff08\u4f7f\u7528\u66f4\u957f\u7684\u9000\u907f\u65f6\u95f4\uff09\u5e76\u8f6e\u6362\u5230\u4e0b\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\/\u63d0\u4f9b\u5546\u3002\n\n\u72b6\u6001\u5b58\u50a8\u5728 `auth-profiles.json` \u4e2d\uff1a\n\n```json  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\n{\n  &quot;usageStats&quot;: {\n    &quot;provider:profile&quot;: {\n      &quot;disabledUntil&quot;: 1736178000000,\n      &quot;disabledReason&quot;: &quot;billing&quot;\n    }\n  }\n}\n<\/code><\/pre>\n<p>\u9ed8\u8ba4\u503c\uff1a<\/p>\n<ul>\n<li>\u8d26\u5355\u9000\u907f\u4ece <strong>5 \u5c0f\u65f6<\/strong>\u5f00\u59cb\uff0c\u6bcf\u6b21\u8d26\u5355\u5931\u8d25\u7ffb\u500d\uff0c\u4e0a\u9650\u4e3a <strong>24 \u5c0f\u65f6<\/strong>\u3002<\/li>\n<li>\u5982\u679c\u914d\u7f6e\u6587\u4ef6 <strong>24 \u5c0f\u65f6<\/strong>\u5185\u6ca1\u6709\u5931\u8d25\uff0c\u9000\u907f\u8ba1\u6570\u5668\u4f1a\u91cd\u7f6e\uff08\u53ef\u914d\u7f6e\uff09\u3002<\/li>\n<\/ul>\n<h2>\u6a21\u578b\u56de\u9000<\/h2>\n<p>\u5982\u679c\u67d0\u4e2a\u63d0\u4f9b\u5546\u7684\u6240\u6709\u914d\u7f6e\u6587\u4ef6\u90fd\u5931\u8d25\uff0cOpenClaw \u4f1a\u79fb\u52a8\u5230 <code>agents.defaults.model.fallbacks<\/code> \u4e2d\u7684\u4e0b\u4e00\u4e2a\u6a21\u578b\u3002\u8fd9\u9002\u7528\u4e8e\u8ba4\u8bc1\u5931\u8d25\u3001\u901f\u7387\u9650\u5236\u548c\u8017\u5c3d\u914d\u7f6e\u6587\u4ef6\u8f6e\u6362\u7684\u8d85\u65f6\uff08\u5176\u4ed6\u9519\u8bef\u4e0d\u4f1a\u63a8\u8fdb\u56de\u9000\uff09\u3002<\/p>\n<p>\u5f53\u8fd0\u884c\u4ee5\u6a21\u578b\u8986\u76d6\uff08\u94a9\u5b50\u6216 CLI\uff09\u5f00\u59cb\u65f6\uff0c\u5728\u5c1d\u8bd5\u4efb\u4f55\u914d\u7f6e\u7684\u56de\u9000\u4e4b\u540e\uff0c\u56de\u9000\u4ecd\u4f1a\u5728 <code>agents.defaults.model.primary<\/code> \u5904\u7ed3\u675f\u3002<\/p>\n<h2>\u76f8\u5173\u914d\u7f6e<\/h2>\n<p>\u53c2\u9605 <a href=\"\/gateway\/configuration\">Gateway \u7f51\u5173\u914d\u7f6e<\/a> \u4e86\u89e3\uff1a<\/p>\n<ul>\n<li><code>auth.profiles<\/code> \/ <code>auth.order<\/code><\/li>\n<li><code>auth.cooldowns.billingBackoffHours<\/code> \/ <code>auth.cooldowns.billingBackoffHoursByProvider<\/code><\/li>\n<li><code>auth.cooldowns.billingMaxHours<\/code> \/ <code>auth.cooldowns.failureWindowHours<\/code><\/li>\n<li><code>agents.defaults.model.primary<\/code> \/ <code>agents.defaults.model.fallbacks<\/code><\/li>\n<li><code>agents.defaults.imageModel<\/code> \u8def\u7531<\/li>\n<\/ul>\n<p>\u53c2\u9605<a href=\"\/concepts\/models\">\u6a21\u578b<\/a>\u4e86\u89e3\u66f4\u5e7f\u6cdb\u7684\u6a21\u578b\u9009\u62e9\u548c\u56de\u9000\u6982\u8ff0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6a21\u578b\u6545\u969c\u8f6c\u79fb OpenClaw \u5206\u4e24\u4e2a\u9636\u6bb5\u5904\u7406\u6545\u969c\uff1a \u5728\u5f53\u524d\u63d0\u4f9b\u5546\u5185\u8fdb\u884c\u8ba4\u8bc1\u914d\u7f6e\u6587\u4ef6\u8f6e\u6362\u3002 \u6a21\u578b\u56de\u9000\u5230 age [&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-95","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/95","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=95"}],"version-history":[{"count":1,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":390,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions\/390"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}