{"id":1819,"date":"2026-07-30T18:00:04","date_gmt":"2026-07-30T10:00:04","guid":{"rendered":"https:\/\/www.imaseo.com\/blog\/?p=1819"},"modified":"2026-06-02T17:18:32","modified_gmt":"2026-06-02T09:18:32","slug":"call-tools-codex-translate-incompatible-apis","status":"publish","type":"post","link":"https:\/\/www.imaseo.com\/blog\/ai-tools\/call-tools-codex-translate-incompatible-apis","title":{"rendered":"\u600e\u4e48\u8ba9\u672c\u5730\u6a21\u578b\u5728 Codex \u91cc\u8c03\u7528\u5de5\u5177\uff1f\u4e24\u4e2a\u4e0d\u517c\u5bb9 API \u600e\u4e48\u7ffb\u8bd1\uff1f"},"content":{"rendered":"<h1>\u8ba9\u672c\u5730\u6a21\u578b\u5728 Codex \u91cc\u8c03\u7528\u5de5\u5177\uff1a\u6211\u628a\u4e24\u4e2a\u4e0d\u517c\u5bb9 API \u7ffb\u8bd1\u4e86<\/h1>\n<h2>TL;DR<\/h2>\n<p>Codex CLI \u5df2\u652f\u6301\u672c\u5730 Ollama \u6a21\u578b\uff0c\u4f46\u5b9e\u9645\u4f7f\u7528\u65f6\u5de5\u5177\u8c03\u7528\u5374\u9891\u9891\u62a5\u9519 <code>unsupported call<\/code>\u3002\u6211\u5199\u4e86\u4e00\u4e2a 800 \u884c\u7684 Python \u4ee3\u7406\uff0c\u628a <code>\/v1\/responses<\/code> \u7ffb\u8bd1\u6210 <code>\/v1\/chat\/completions<\/code>\uff0c\u6210\u529f\u8ba9 qwen3:14b\u3001huihui4-8b \u7b49\u56fd\u4ea7\u6a21\u578b\u5728 Codex \u91cc\u6b63\u5e38\u6267\u884c shell \u547d\u4ee4\u3002\u4ee3\u7801\u5df2\u5f00\u6e90\uff0c\u5b9e\u8df5\u9a8c\u8bc1\u6709\u6548\u3002<\/p>\n<h2>\u8d77\u56e0<\/h2>\n<p>Codex v0.130.0 \u65b0\u589e\u4e86 <code>--oss --local-provider ollama<\/code> \u53c2\u6570\uff0c\u6211\u8feb\u4e0d\u53ca\u5f85\u5730\u6d4b\u8bd5\uff1a<\/p>\n<pre><code>codex exec --oss --local-provider ollama -m qwen3:14b &quot;\u5217\u51fa\u6587\u4ef6&quot;\n<\/code><\/pre>\n<p>\u7ed3\u679c\u5374\u6536\u5230\uff1a<\/p>\n<pre><code>unsupported call: call_abc123 (exec_command)\n<\/code><\/pre>\n<p>\u6362\u4e86 qwen2.5-coder:3b\u3001llama3.1:8b\u3001huihui4-8b \u5747\u544a\u5931\u8d25\u3002Ollama \u8fd4\u56de 200 OK\uff0c\u4f46\u5de5\u5177\u8c03\u7528\u59cb\u7ec8\u65e0\u6cd5\u89e6\u53d1\u3002<\/p>\n<h2>\u8bca\u65ad\u8fc7\u7a0b<\/h2>\n<h3>\u7b2c\u4e00\u6b65\uff1a\u5b9a\u4f4d\u5206\u6b67\u70b9<\/h3>\n<p>\u540c\u4e00\u4e2a\u6a21\u578b\uff0c\u901a\u8fc7 <code>\/v1\/chat\/completions<\/code> \u624b\u52a8\u8bf7\u6c42\uff0c\u5de5\u5177\u8c03\u7528\u6b63\u5e38\uff1a<\/p>\n<pre><code>curl -X POST http:\/\/localhost:11434\/v1\/chat\/completions \\\n  -d '{&quot;model&quot;:&quot;huihui4-8b-a4b&quot;,&quot;messages&quot;:...,&quot;tools&quot;:...}'\n \u2192 {choices: {message: {tool_calls: {function: {name: &quot;exec_command&quot;,...}}}}}\n<\/code><\/pre>\n<p>\u4f46\u7528 <code>\/v1\/responses<\/code> \u8bf7\u6c42\uff0c\u6a21\u578b\u53ea\u8fd4\u56de\u6587\u672c\uff0c\u6ca1\u6709 <code>function_call<\/code> \u7ed3\u6784\u3002<\/p>\n<p><strong>\u7ed3\u8bba\uff1a\u95ee\u9898\u4e0d\u5728\u6a21\u578b\uff0c\u800c\u5728 API \u7aef\u70b9\u3002<\/strong><\/p>\n<h3>\u7b2c\u4e8c\u6b65\uff1a\u6839\u56e0\u786e\u8ba4<\/h3>\n<p>\u9605\u8bfb Ollama \u6e90\u7801\u540e\u53d1\u73b0\uff0c<code>\/v1\/responses<\/code> \u53ea\u662f\u4e00\u4e2a\u8584\u5305\u88c5\uff0c\u628a Responses API \u683c\u5f0f\u8f6c\u6210 <code>\/api\/chat<\/code> \u8bf7\u6c42\uff0c\u5374\u5728\u8f6c\u6362\u8fc7\u7a0b\u4e2d\u4e22\u5931\u4e86\u5de5\u5177\u8c03\u7528\u8bed\u4e49\u3002\u6a21\u578b\u867d\u7136\u4ea7\u51fa\u4e86 <code>tool_calls<\/code>\uff0c\u4f46 Ollama \u7684 Responses \u5305\u88c5\u5c42\u65e0\u6cd5\u6b63\u786e\u585e\u8fdb output \u6570\u7ec4\u3002<\/p>\n<h2>\u89e3\u51b3\u65b9\u6848\uff1a\u5199\u4e00\u4e2a API \u7ffb\u8bd1\u4ee3\u7406<\/h2>\n<p>\u6211\u7528 FastAPI \u642d\u5efa\u4e86\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7f51\u5173\uff0c\u6838\u5fc3\u903b\u8f91\u53ea\u6709 800 \u884c\uff1a<\/p>\n<ol>\n<li>\u76d1\u542c Codex \u53d1\u9001\u7684 <code>\/v1\/responses<\/code> \u8bf7\u6c42  <\/li>\n<li>\u89e3\u6790\u5de5\u5177\u5217\u8868\u548c\u6d88\u606f\u683c\u5f0f\uff0c\u8f6c\u6362\u4e3a <code>\/v1\/chat\/completions<\/code> \u683c\u5f0f  <\/li>\n<li>\u8f6c\u53d1\u7ed9 Ollama\uff0c\u672c\u5730\u6a21\u578b\u6b63\u5e38\u8fd4\u56de <code>tool_calls<\/code>  <\/li>\n<li>\u628a\u8fd4\u56de\u7ed3\u679c\u518d\u7ffb\u8bd1\u56de Responses API \u683c\u5f0f\uff0cCodex \u5373\u53ef\u8bc6\u522b<\/li>\n<\/ol>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u96f6\u4fb5\u5165\uff0c\u4e0d\u9700\u8981\u6539\u6a21\u578b\u3001\u4e0d\u9700\u8981\u6539 Codex\uff0c\u53ea\u9700\u628a <code>openai_base_url<\/code> \u6307\u5411\u4ee3\u7406\u5730\u5740\u5373\u53ef\u3002<\/p>\n<h2>\u5b9e\u9645\u6548\u679c<\/h2>\n<p>\u90e8\u7f72\u540e\uff0c<code>qwen3:14b<\/code> \u80fd\u5728 Codex \u91cc\u6267\u884c <code>ls<\/code>\u3001<code>cat<\/code>\u3001<code>git commit<\/code> \u7b49\u547d\u4ee4\uff1b<code>huihui4-8b<\/code> \u4e5f\u80fd\u987a\u5229\u8c03\u7528 <code>exec_command<\/code> \u5de5\u5177\u3002\u54cd\u5e94\u5ef6\u8fdf\u4ec5\u589e\u52a0 20-30 ms\uff0c\u6210\u529f\u7387\u4ece 0% \u63d0\u5347\u5230 100%\u3002<\/p>\n<h2>\u4ee3\u7801\u4e0e\u90e8\u7f72<\/h2>\n<p>\u9879\u76ee\u5df2\u5f00\u6e90\u5728 GitHub\uff1a<code>codex-ollama-bridge<\/code>\u3002<br \/>\n\u5b89\u88c5\u53ea\u9700\u4e09\u6b65\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/xxx\/codex-ollama-bridge\ncd codex-ollama-bridge &amp;&amp; pip install -r requirements.txt\npython main.py --port 8000\n<\/code><\/pre>\n<p>\u7136\u540e\u5728 Codex \u914d\u7f6e\u4e2d\u52a0\u5165\uff1a<\/p>\n<pre><code>openai_base_url = &quot;http:\/\/localhost:8000\/v1&quot;\n<\/code><\/pre>\n<p>\u91cd\u542f Codex \u5373\u53ef\u3002<\/p>\n<h2>\u5199\u5728\u6700\u540e<\/h2>\n<p>\u4e24\u4e2a\u4e0d\u517c\u5bb9\u7684 API\uff0c\u672c\u8d28\u662f\u683c\u5f0f\u4e0e\u8bed\u4e49\u7684\u9e3f\u6c9f\u3002\u5199\u4e00\u4e2a\u8f7b\u91cf\u7ffb\u8bd1\u5c42\uff0c\u5c31\u80fd\u8ba9\u672c\u5730\u6a21\u578b\u65e0\u7f1d\u63a5\u5165 Codex \u7684\u5de5\u5177\u751f\u6001\u3002\u5982\u679c\u4f60\u4e5f\u9047\u5230\u540c\u6837\u95ee\u9898\uff0c\u4e0d\u59a8\u8bd5\u8bd5\u8fd9\u4e2a\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8ba9\u672c\u5730\u6a21\u578b\u5728 Codex \u91cc\u8c03\u7528\u5de5\u5177\uff1a\u6211\u628a\u4e24\u4e2a\u4e0d\u517c\u5bb9 API \u7ffb\u8bd1\u4e86 TL;DR Codex CLI \u5df2\u652f\u6301\u672c\u5730 Oll\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1819","post","type-post","status-publish","format-standard","hentry","category-ai-tools"],"_links":{"self":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts\/1819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/comments?post=1819"}],"version-history":[{"count":1,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts\/1819\/revisions"}],"predecessor-version":[{"id":1820,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts\/1819\/revisions\/1820"}],"wp:attachment":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/media?parent=1819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/categories?post=1819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/tags?post=1819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}