{"id":221,"date":"2026-03-21T22:47:23","date_gmt":"2026-03-21T14:47:23","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/providers-litellm\/"},"modified":"2026-03-21T23:08:57","modified_gmt":"2026-03-21T15:08:57","slug":"providers-litellm","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/providers-litellm\/","title":{"rendered":"Litellm"},"content":{"rendered":"<h1>Litellm<\/h1>\n<h1>LiteLLM<\/h1>\n<p><a href=\"https:\/\/litellm.ai\">LiteLLM<\/a> \u662f\u4e00\u4e2a\u5f00\u6e90 LLM \u7f51\u5173\uff0c\u53ef\u4e3a 100+ \u6a21\u578b\u63d0\u4f9b\u5546\u63d0\u4f9b\u7edf\u4e00 API\u3002\u901a\u8fc7 LiteLLM \u8def\u7531 OpenClaw\uff0c\u4f60\u53ef\u4ee5\u83b7\u5f97\u96c6\u4e2d\u5f0f\u6210\u672c\u8ddf\u8e2a\u3001\u65e5\u5fd7\u8bb0\u5f55\uff0c\u4ee5\u53ca\u5728\u4e0d\u66f4\u6539 OpenClaw \u914d\u7f6e\u7684\u60c5\u51b5\u4e0b\u5207\u6362\u540e\u7aef\u7684\u7075\u6d3b\u6027\u3002<\/p>\n<h2>\u4e3a\u4ec0\u4e48\u8981\u5c06 LiteLLM \u4e0e OpenClaw \u642d\u914d\u4f7f\u7528\uff1f<\/h2>\n<ul>\n<li><strong>\u6210\u672c\u8ddf\u8e2a<\/strong> \u2014\u2014 \u7cbe\u786e\u67e5\u770b OpenClaw \u5728\u6240\u6709\u6a21\u578b\u4e0a\u7684\u82b1\u8d39<\/li>\n<li><strong>\u6a21\u578b\u8def\u7531<\/strong> \u2014\u2014 \u65e0\u9700\u66f4\u6539\u914d\u7f6e\uff0c\u5373\u53ef\u5728 Claude\u3001GPT-4\u3001Gemini\u3001Bedrock \u4e4b\u95f4\u5207\u6362<\/li>\n<li><strong>\u865a\u62df\u5bc6\u94a5<\/strong> \u2014\u2014 \u4e3a OpenClaw \u521b\u5efa\u5e26\u6709\u652f\u51fa\u9650\u5236\u7684\u5bc6\u94a5<\/li>\n<li><strong>\u65e5\u5fd7\u8bb0\u5f55<\/strong> \u2014\u2014 \u63d0\u4f9b\u5b8c\u6574\u7684\u8bf7\u6c42\/\u54cd\u5e94\u65e5\u5fd7\uff0c\u4fbf\u4e8e\u8c03\u8bd5<\/li>\n<li><strong>\u56de\u9000<\/strong> \u2014\u2014 \u5982\u679c\u4f60\u7684\u4e3b\u8981\u63d0\u4f9b\u5546\u5b95\u673a\uff0c\u53ef\u81ea\u52a8\u6545\u969c\u5207\u6362<\/li>\n<\/ul>\n<h2>\u5feb\u901f\u5f00\u59cb<\/h2>\n<h3>\u901a\u8fc7\u65b0\u624b\u5f15\u5bfc<\/h3>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\nopenclaw onboard &#8211;auth-choice litellm-api-key<\/p>\n<pre><code>\n### \u624b\u52a8\u8bbe\u7f6e\n\n1. \u542f\u52a8 LiteLLM Proxy\uff1a\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\npip install 'litellm[proxy]'\nlitellm --model claude-opus-4-6\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u5c06 OpenClaw \u6307\u5411 LiteLLM\uff1a<\/li>\n<\/ol>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\nexport LITELLM_API_KEY=&#8221;your-litellm-key&#8221;<\/p>\n<p>openclaw<\/p>\n<pre><code>\n\u5c31\u662f\u8fd9\u6837\u3002OpenClaw \u73b0\u5728\u4f1a\u901a\u8fc7 LiteLLM \u8fdb\u884c\u8def\u7531\u3002\n\n## \u914d\u7f6e\n\n### \u73af\u5883\u53d8\u91cf\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\nexport LITELLM_API_KEY=&quot;sk-litellm-key&quot;\n<\/code><\/pre>\n<h3>\u914d\u7f6e\u6587\u4ef6<\/h3>\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  models: {<br \/>\n    providers: {<br \/>\n      litellm: {<br \/>\n        baseUrl: &#8220;http:\/\/localhost:4000&#8221;,<br \/>\n        apiKey: &#8220;${LITELLM_API_KEY}&#8221;,<br \/>\n        api: &#8220;openai-completions&#8221;,<br \/>\n        models: [<br \/>\n          {<br \/>\n            id: &#8220;claude-opus-4-6&#8221;,<br \/>\n            name: &#8220;Claude Opus 4.6&#8221;,<br \/>\n            reasoning: true,<br \/>\n            input: [&#8220;text&#8221;, &#8220;image&#8221;],<br \/>\n            contextWindow: 200000,<br \/>\n            maxTokens: 64000,<br \/>\n          },<br \/>\n          {<br \/>\n            id: &#8220;gpt-4o&#8221;,<br \/>\n            name: &#8220;GPT-4o&#8221;,<br \/>\n            reasoning: false,<br \/>\n            input: [&#8220;text&#8221;, &#8220;image&#8221;],<br \/>\n            contextWindow: 128000,<br \/>\n            maxTokens: 8192,<br \/>\n          },<br \/>\n        ],<br \/>\n      },<br \/>\n    },<br \/>\n  },<br \/>\n  agents: {<br \/>\n    defaults: {<br \/>\n      model: { primary: &#8220;litellm\/claude-opus-4-6&#8221; },<br \/>\n    },<br \/>\n  },<br \/>\n}<\/p>\n<pre><code>\n## \u865a\u62df\u5bc6\u94a5\n\n\u4e3a OpenClaw \u521b\u5efa\u4e00\u4e2a\u5e26\u652f\u51fa\u9650\u5236\u7684\u4e13\u7528\u5bc6\u94a5\uff1a\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\ncurl -X POST &quot;http:\/\/localhost:4000\/key\/generate&quot; \n  -H &quot;Authorization: Bearer $LITELLM_MASTER_KEY&quot; \n  -H &quot;Content-Type: application\/json&quot; \n  -d '{\n    &quot;key_alias&quot;: &quot;openclaw&quot;,\n    &quot;max_budget&quot;: 50.00,\n    &quot;budget_duration&quot;: &quot;monthly&quot;\n  }'\n<\/code><\/pre>\n<p>\u5c06\u751f\u6210\u7684\u5bc6\u94a5\u7528\u4f5c <code>LITELLM_API_KEY<\/code>\u3002<\/p>\n<h2>\u6a21\u578b\u8def\u7531<\/h2>\n<p>LiteLLM \u53ef\u4ee5\u5c06\u6a21\u578b\u8bf7\u6c42\u8def\u7531\u5230\u4e0d\u540c\u540e\u7aef\u3002\u5728\u4f60\u7684 LiteLLM <code>config.yaml<\/code> \u4e2d\u8fdb\u884c\u914d\u7f6e\uff1a<\/p>\n<p>&#8220;`yaml  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\nmodel_list:<br \/>\n  &#8211; model_name: claude-opus-4-6<br \/>\n    litellm_params:<br \/>\n      model: claude-opus-4-6<br \/>\n      api_key: os.environ\/ANTHROPIC_API_KEY<\/p>\n<ul>\n<li>model_name: gpt-4o<br \/>\n    litellm_params:<br \/>\n      model: gpt-4o<br \/>\n      api_key: os.environ\/OPENAI_API_KEY<\/li>\n<\/ul>\n<pre><code>\nOpenClaw \u4f1a\u7ee7\u7eed\u8bf7\u6c42 `claude-opus-4-6` \u2014\u2014 \u8def\u7531\u7531 LiteLLM \u5904\u7406\u3002\n\n## \u67e5\u770b\u4f7f\u7528\u60c5\u51b5\n\n\u68c0\u67e5 LiteLLM \u7684\u4eea\u8868\u677f\u6216 API\uff1a\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\n# \u5bc6\u94a5\u4fe1\u606f\ncurl &quot;http:\/\/localhost:4000\/key\/info&quot; \n  -H &quot;Authorization: Bearer sk-litellm-key&quot;\n\n# \u652f\u51fa\u65e5\u5fd7\ncurl &quot;http:\/\/localhost:4000\/spend\/logs&quot; \n  -H &quot;Authorization: Bearer $LITELLM_MASTER_KEY&quot;\n<\/code><\/pre>\n<h2>\u8bf4\u660e<\/h2>\n<ul>\n<li>LiteLLM \u9ed8\u8ba4\u8fd0\u884c\u5728 <code>http:\/\/localhost:4000<\/code><\/li>\n<li>OpenClaw \u901a\u8fc7\u517c\u5bb9 OpenAI \u7684 <code>\/v1\/chat\/completions<\/code> \u7aef\u70b9\u8fde\u63a5<\/li>\n<li>\u6240\u6709 OpenClaw \u529f\u80fd\u90fd\u53ef\u901a\u8fc7 LiteLLM \u4f7f\u7528 \u2014\u2014 \u6ca1\u6709\u9650\u5236<\/li>\n<\/ul>\n<h2>\u53e6\u8bf7\u53c2\u89c1<\/h2>\n<ul>\n<li><a href=\"https:\/\/docs.litellm.ai\">LiteLLM \u6587\u6863<\/a><\/li>\n<li><a href=\"\/concepts\/model-providers\">\u6a21\u578b\u63d0\u4f9b\u5546<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Litellm LiteLLM LiteLLM \u662f\u4e00\u4e2a\u5f00\u6e90 LLM \u7f51\u5173\uff0c\u53ef\u4e3a 100+ \u6a21\u578b\u63d0\u4f9b\u5546\u63d0\u4f9b\u7edf\u4e00  [&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-221","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/221","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=221"}],"version-history":[{"count":1,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/221\/revisions"}],"predecessor-version":[{"id":516,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/221\/revisions\/516"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}