{"id":22584,"date":"2010-05-14T08:15:07","date_gmt":"2010-05-14T08:15:07","guid":{"rendered":"https:\/\/scannn.com\/lidge-jun-opencodex-universal-provider-proxy-for-openai-codex-claude-code-use-any-llm-claude-gemini-grok-deepseek-ollama-with-codex-cli-app-sdk-and-claude-code-%c2%b7-gi\/"},"modified":"2010-05-14T08:15:07","modified_gmt":"2010-05-14T08:15:07","slug":"lidge-jun-opencodex-universal-provider-proxy-for-openai-codex-claude-code-use-any-llm-claude-gemini-grok-deepseek-ollama-with-codex-cli-app-sdk-and-claude-code-%c2%b7-gi","status":"publish","type":"post","link":"https:\/\/scannn.com\/lv\/lidge-jun-opencodex-universal-provider-proxy-for-openai-codex-claude-code-use-any-llm-claude-gemini-grok-deepseek-ollama-with-codex-cli-app-sdk-and-claude-code-%c2%b7-gi\/","title":{"rendered":"lidge-jun\/opencodex: Universal provider proxy for OpenAI Codex & Claude Code \u2014 use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama\u2026) with Codex CLI, App, SDK, and Claude Code \u00b7 GitHub"},"content":{"rendered":"\n<div id=\"\">\n<p align=\"center\" dir=\"auto\"><b>Universal provider proxy for OpenAI Codex &amp; Claude Code<\/b> \u2014 use any LLM with Codex CLI, App, SDK, and Claude Code.<\/p>\n<p align=\"center\" dir=\"auto\"><code>npm install -g @bitkyc08\/opencodex<\/code> \u00b7 <code>ocx start<\/code> \u00b7 <b>localhost:10100<\/b><\/p>\n<p align=\"center\" dir=\"auto\">\n  <a href=\"https:\/\/www.npmjs.com\/package\/@bitkyc08\/opencodex\" rel=\"nofollow\"><\/a><br \/>\n  <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/LICENSE\"><img decoding=\"async\" src=\"https:\/\/camo.githubusercontent.com\/0373a598fc838f89a653fd1d3f5adbb548a5285990240436a8dc26467f86c505\/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f406269746b796330382f6f70656e636f6465783f636f6c6f723d626c7565\" alt=\"license\" data-canonical-src=\"https:\/\/img.shields.io\/npm\/l\/@bitkyc08\/opencodex?color=blue\" style=\"max-width: 100%;\"\/><\/a><br \/>\n  <a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\/\/camo.githubusercontent.com\/0444bf0de8f15de40656580055feccec6be57a8536a3611f1b4912607fe57e6f\/68747470733a2f2f696d672e736869656c64732e696f2f6e6f64652f762f406269746b796330382f6f70656e636f6465783f6c6f676f3d6e6f64652e6a73266c6162656c3d6e6f6465\"><img decoding=\"async\" src=\"https:\/\/camo.githubusercontent.com\/0444bf0de8f15de40656580055feccec6be57a8536a3611f1b4912607fe57e6f\/68747470733a2f2f696d672e736869656c64732e696f2f6e6f64652f762f406269746b796330382f6f70656e636f6465783f6c6f676f3d6e6f64652e6a73266c6162656c3d6e6f6465\" alt=\"node version\" data-canonical-src=\"https:\/\/img.shields.io\/node\/v\/@bitkyc08\/opencodex?logo=node.js&amp;label=node\" style=\"max-width: 100%;\"\/><\/a>\n<\/p>\n<p align=\"center\" dir=\"auto\">\n  <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/assets\/banner.png\"><img decoding=\"async\" src=\"https:\/\/github.com\/lidge-jun\/opencodex\/raw\/main\/assets\/banner.png\" alt=\"opencodex \u2014 Universal provider proxy for Codex, use any LLM\" width=\"820\" style=\"max-width: 100%;\"\/><\/a>\n<\/p>\n<p align=\"center\" dir=\"auto\">\n  <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/README.md\">English<\/a> \u00b7 <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/README.ko.md\">\ud55c\uad6d\uc5b4<\/a> \u00b7 <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/README.zh-CN.md\">\u7b80\u4f53\u4e2d\u6587<\/a> \u00b7 <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/README.ru.md\">\u0420\u0443\u0441\u0441\u043a\u0438\u0439<\/a> \u00b7 <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/README.ja.md\">\u65e5\u672c\u8a9e<\/a> \u00b7  <a href=\"https:\/\/lidge-jun.github.io\/opencodex\/\" rel=\"nofollow\"><b>Full documentation \u2192<\/b><\/a>\n<\/p>\n<p align=\"center\" dir=\"auto\">\n  <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/assets\/architecture.png\"><img decoding=\"async\" src=\"https:\/\/github.com\/lidge-jun\/opencodex\/raw\/main\/assets\/architecture.png\" alt=\"opencodex architecture \u2014 Codex CLI routes through opencodex proxy to any LLM provider\" width=\"820\" style=\"max-width: 100%;\"\/><\/a>\n<\/p>\n<p dir=\"auto\">Use Claude, Gemini, Grok, GLM, DeepSeek, Kimi, Qwen, Ollama, or any other LLM with Codex \u2014 and with <strong>Claude Code<\/strong> \u2014 without waiting for anyone to add support.<\/p>\n<p dir=\"auto\">opencodex is a lightweight local proxy that translates Codex&#8217;s Responses API into whatever your provider speaks. Streaming, tool calls, reasoning tokens, images \u2014 everything works, in both directions.<\/p>\n<p align=\"center\" dir=\"auto\">\n  <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/assets\/demo.gif\"><img decoding=\"async\" src=\"https:\/\/github.com\/lidge-jun\/opencodex\/raw\/main\/assets\/demo.gif\" alt=\"opencodex demo \u2014 running a task in the Codex app on a routed non-OpenAI model\" width=\"820\" data-animated-image=\"\" style=\"max-width: 100%;\"\/><\/a>\n<\/p>\n<p align=\"center\" dir=\"auto\"><sub><b>Codex, running any model.<\/b> Pick a provider and go \u2014 same Codex workflow, different brain.<\/sub><\/p>\n<p dir=\"auto\">It can also manage a <strong>ChatGPT account pool<\/strong> for Codex auth. Add multiple ChatGPT \/ Codex accounts,<br \/>\nrefresh their 5h \/ weekly \/ 30d quota in the dashboard, and let new sessions auto-route to the<br \/>\nlowest-usage healthy account. Existing Codex threads stay pinned to the account that started them,<br \/>\nso long SSH, tmux, or mobile-connected sessions do not jump accounts mid-conversation.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"Codex CLI \/ App \/ SDK \u2500\u2500\/v1\/responses\u2500\u2500&#x25b6; opencodex \u2500\u2500&#x25b6; Any provider&#10;                                              \u2502&#10;              Anthropic \u00b7 Google \u00b7 xAI \u00b7 Kimi \u00b7 Ollama Cloud \u00b7 Groq&#10;              OpenRouter \u00b7 Azure \u00b7 DeepSeek \u00b7 GLM \u00b7 \u2026and OpenAI itself\">\n<pre class=\"notranslate\"><code>Codex CLI \/ App \/ SDK \u2500\u2500\/v1\/responses\u2500\u2500&#x25b6; opencodex \u2500\u2500&#x25b6; Any provider\n                                              \u2502\n              Anthropic \u00b7 Google \u00b7 xAI \u00b7 Kimi \u00b7 Ollama Cloud \u00b7 Groq\n              OpenRouter \u00b7 Azure \u00b7 DeepSeek \u00b7 GLM \u00b7 \u2026and OpenAI itself\n<\/code><\/pre>\n<\/div>\n<section class=\"js-render-needs-enrichment render-needs-enrichment position-relative\" data-identity=\"8b250bf2-da22-401c-b175-03e26e83abf0\" data-host=\"https:\/\/viewscreen.githubusercontent.com\" data-src=\"https:\/\/viewscreen.githubusercontent.com\/markdown\/mermaid?docs_host=https%3A%2F%2Fdocs.github.com\" data-type=\"mermaid\" aria-label=\"mermaid rendered output container\">\n<div class=\"js-render-enrichment-target\" data-json=\"{&quot;data&quot;:&quot;flowchart LR\\n  codex[Codex session&amp;lt;br\/&amp;gt;CLI, App, SSH, mobile] --&amp;gt; proxy[opencodex]\\n  proxy --&amp;gt; existing{Existing thread?}\\n  existing --&amp;gt;|yes| pinned[Keep the same&amp;lt;br\/&amp;gt;ChatGPT account]\\n  existing --&amp;gt;|new session| quota[Refresh quota&amp;lt;br\/&amp;gt;5h, weekly, 30d]\\n  quota --&amp;gt; pick[Pick lowest-usage&amp;lt;br\/&amp;gt;healthy account]\\n  pick --&amp;gt; upstream[ChatGPT \/ Codex backend]\\n  pinned --&amp;gt; upstream\\n  upstream --&amp;gt; outcomes[Quota \/ auth outcome]\\n  outcomes --&amp;gt;|429| cooldown[Cooldown + failover]\\n  outcomes --&amp;gt;|401 \/ 403| reauth[Mark reauth needed]\\n  cooldown --&amp;gt; quota\\n&quot;}\" data-plain=\"flowchart LR&#10;  codex[Codex session&lt;br\/&gt;CLI, App, SSH, mobile] --&gt; proxy[opencodex]&#10;  proxy --&gt; existing{Existing thread?}&#10;  existing --&gt;|yes| pinned[Keep the same&lt;br\/&gt;ChatGPT account]&#10;  existing --&gt;|new session| quota[Refresh quota&lt;br\/&gt;5h, weekly, 30d]&#10;  quota --&gt; pick[Pick lowest-usage&lt;br\/&gt;healthy account]&#10;  pick --&gt; upstream[ChatGPT \/ Codex backend]&#10;  pinned --&gt; upstream&#10;  upstream --&gt; outcomes[Quota \/ auth outcome]&#10;  outcomes --&gt;|429| cooldown[Cooldown + failover]&#10;  outcomes --&gt;|401 \/ 403| reauth[Mark reauth needed]&#10;  cooldown --&gt; quota&#10;\" dir=\"auto\">\n<div class=\"render-plaintext-hidden\" dir=\"auto\">\n<pre lang=\"mermaid\" aria-label=\"Raw mermaid code\">flowchart LR\n  codex[Codex session&lt;br\/&gt;CLI, App, SSH, mobile] --&gt; proxy[opencodex]\n  proxy --&gt; existing{Existing thread?}\n  existing --&gt;|yes| pinned[Keep the same&lt;br\/&gt;ChatGPT account]\n  existing --&gt;|new session| quota[Refresh quota&lt;br\/&gt;5h, weekly, 30d]\n  quota --&gt; pick[Pick lowest-usage&lt;br\/&gt;healthy account]\n  pick --&gt; upstream[ChatGPT \/ Codex backend]\n  pinned --&gt; upstream\n  upstream --&gt; outcomes[Quota \/ auth outcome]\n  outcomes --&gt;|429| cooldown[Cooldown + failover]\n  outcomes --&gt;|401 \/ 403| reauth[Mark reauth needed]\n  cooldown --&gt; quota\n<\/pre>\n<\/p><\/div>\n<\/p><\/div>\n<p>  <span class=\"js-render-enrichment-loader d-flex flex-justify-center flex-items-center width-full\" style=\"min-height:100px\" role=\"presentation\"><br \/>\n    <span data-view-component=\"true\"><br \/>\n  <svg style=\"box-sizing: content-box; color: var(--color-icon-primary);\" width=\"16\" height=\"16\" viewbox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" data-view-component=\"true\" class=\"octospinner mx-auto tmp-mx-auto anim-rotate\">\n    <circle cx=\"8\" cy=\"8\" r=\"7\" stroke=\"currentColor\" stroke-opacity=\"0.25\" stroke-width=\"2\" vector-effect=\"non-scaling-stroke\" fill=\"none\"\/>\n    <path d=\"M15 8a7.002 7.002 0 00-7-7\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" vector-effect=\"non-scaling-stroke\"\/>\n<\/svg>    <span class=\"sr-only\">Loading<\/span><br \/>\n<\/span><br \/>\n  <\/span><br \/>\n<\/section>\n<p><markdown-accessiblity-table><\/p>\n<table>\n<thead>\n<tr>\n<th>OS<\/th>\n<th>Status<\/th>\n<th>Service manager<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>macOS (arm64 \/ x64)<\/td>\n<td>Fully supported<\/td>\n<td>launchd<\/td>\n<\/tr>\n<tr>\n<td>Linux (x64 \/ arm64)<\/td>\n<td>Fully supported<\/td>\n<td>systemd (user unit)<\/td>\n<\/tr>\n<tr>\n<td>Windows (x64)<\/td>\n<td>Fully supported<\/td>\n<td>Task Scheduler (hidden) \/ opt-in native service (<code>--native<\/code>, WinSW)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/markdown-accessiblity-table><\/p>\n<p dir=\"auto\">Requires <a href=\"https:\/\/nodejs.org\" rel=\"nofollow\">Node<\/a> 18+. The Bun runtime is bundled automatically on <code>npm install<\/code> \u2014 no separate Bun install needed. All three platforms work natively (no WSL needed on Windows).<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Install (bundles the Bun runtime automatically \u2014 only Node 18+ required)&#10;# Prefer a user-owned Node (nvm\/fnm) \u2014 avoid `sudo npm install -g \u2026`&#10;npm install -g @bitkyc08\/opencodex&#10;&#10;# Interactive setup (writes config, injects into Codex, and offers autostart shim install)&#10;ocx init&#10;&#10;# Start the proxy&#10;ocx start&#10;&#10;# If you skipped it during init, install the on-demand autostart shim later&#10;ocx codex-shim install&#10;&#10;# Use Codex normally \u2014 it now routes through opencodex&#10;codex &quot;Write a hello world in Rust&quot;\">\n<pre><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Install (bundles the Bun runtime automatically \u2014 only Node 18+ required)<\/span>\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Prefer a user-owned Node (nvm\/fnm) \u2014 avoid `sudo npm install -g \u2026`<\/span>\nnpm install -g @bitkyc08\/opencodex\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Interactive setup (writes config, injects into Codex, and offers autostart shim install)<\/span>\nocx init\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Start the proxy<\/span>\nocx start\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> If you skipped it during init, install the on-demand autostart shim later<\/span>\nocx codex-shim install\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Use Codex normally \u2014 it now routes through opencodex<\/span>\ncodex <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>Write a hello world in Rust<span class=\"pl-pds\">\"<\/span><\/span><\/pre>\n<\/div>\n<details>\n<summary><b>&#8220;bundled Bun runtime is missing&#8221; \/ npm blocked Bun install scripts?<\/b><\/summary>\n<p dir=\"auto\">opencodex bundles the Bun runtime as a dependency and runs it via a Node<br \/>\nlauncher, so you do <strong>not<\/strong> need to install Bun yourself. If you see a<br \/>\n&#8220;bundled Bun runtime is missing&#8221; error, the install skipped lifecycle scripts<br \/>\n(including npm blocking bun&#8217;s postinstall under <code>allowScripts<\/code>) or optional<br \/>\ndependencies. Reinstall without those flags, allowing bun&#8217;s install script:<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"npm install -g --allow-scripts=bun @bitkyc08\/opencodex   # no --ignore-scripts, no --omit=optional&#10;&#10;# if the original install used sudo, keep using sudo:&#10;sudo npm install -g --allow-scripts=bun @bitkyc08\/opencodex\">\n<pre>npm install -g --allow-scripts=bun @bitkyc08\/opencodex   <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> no --ignore-scripts, no --omit=optional<\/span>\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> if the original install used sudo, keep using sudo:<\/span>\nsudo npm install -g --allow-scripts=bun @bitkyc08\/opencodex<\/pre>\n<\/div>\n<p dir=\"auto\">npm&#8217;s own warning suggests an abbreviated command without the package name \u2014<br \/>\nthat would reinstall the current directory, so always pass<br \/>\n<code>@bitkyc08\/opencodex<\/code> explicitly.<\/p>\n<p dir=\"auto\">If you installed with <code>sudo<\/code> into a root-owned prefix, the sudo reinstall above<br \/>\nunblocks that prefix \u2014 but prefer migrating to a user-owned Node (nvm, fnm, or<br \/>\na user npm prefix) when you can.<\/p>\n<\/details>\n<p dir=\"auto\">The fastest way to add a provider is through the web dashboard:<\/p>\n<p dir=\"auto\">This opens the dashboard at <code>http:\/\/localhost:10100<\/code>. From there:<\/p>\n<ol dir=\"auto\">\n<li>Click <strong>&#8220;Add Provider&#8221;<\/strong><\/li>\n<li>Pick from <strong>40+ built-in providers<\/strong> \u2014 or enter a custom OpenAI-compatible endpoint<\/li>\n<li>Paste your API key (or log in via OAuth for Anthropic, xAI, and Kimi)<\/li>\n<li>Models are <strong>auto-discovered<\/strong> from the provider&#8217;s <code>\/v1\/models<\/code> endpoint<\/li>\n<\/ol>\n<p dir=\"auto\">Your new provider is ready to use immediately. No restart needed.<\/p>\n<p dir=\"auto\">You can also add providers through <code>ocx init<\/code> (interactive CLI) or by editing <code>~\/.opencodex\/config.json<\/code> directly.<\/p>\n<p dir=\"auto\">Target any configured provider and model using the <code>provider\/model<\/code> syntax:<\/p>\n<p dir=\"auto\">Providers whose own model ids contain <code>\/<\/code> (zenmux, openrouter, nvidia, \u2026) are exposed to<br \/>\nCodex with inner slashes aliased to <code>-<\/code> (e.g. <code>zenmux\/moonshotai-kimi-k3-free<\/code>); the<br \/>\nproxy transparently routes them back to the native id, and the raw full-slash form keeps<br \/>\nworking too.<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Use Claude Opus through Anthropic&#10;codex -m &quot;anthropic\/claude-opus-4-8&quot; &quot;Explain this stack trace&quot;&#10;&#10;# Use Gemini through Google&#10;codex -m &quot;google\/gemini-3-pro&quot; &quot;Write unit tests for auth.ts&quot;&#10;&#10;# Use GLM through Ollama Cloud&#10;codex -m &quot;ollama-cloud\/glm-5.2&quot; &quot;Write a SQL migration&quot;&#10;&#10;# Use a local model through Ollama&#10;codex -m &quot;ollama\/llama3&quot; &quot;Refactor this function&quot;\">\n<pre><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Use Claude Opus through Anthropic<\/span>\ncodex -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>anthropic\/claude-opus-4-8<span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>Explain this stack trace<span class=\"pl-pds\">\"<\/span><\/span>\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Use Gemini through Google<\/span>\ncodex -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>google\/gemini-3-pro<span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>Write unit tests for auth.ts<span class=\"pl-pds\">\"<\/span><\/span>\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Use GLM through Ollama Cloud<\/span>\ncodex -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>ollama-cloud\/glm-5.2<span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>Write a SQL migration<span class=\"pl-pds\">\"<\/span><\/span>\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Use a local model through Ollama<\/span>\ncodex -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>ollama\/llama3<span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>Refactor this function<span class=\"pl-pds\">\"<\/span><\/span><\/pre>\n<\/div>\n<p dir=\"auto\">When you omit the <code>provider\/<\/code> prefix, opencodex routes to the default provider \u2014 or auto-matches based on the model name pattern (e.g., <code>claude-*<\/code> routes to Anthropic, <code>gpt-*<\/code> routes to OpenAI).<\/p>\n<p dir=\"auto\">Routed models also appear in the <strong>Codex App<\/strong> model picker with per-model reasoning effort controls:<\/p>\n<p dir=\"auto\">Current Codex builds can expose <code>low<\/code>, <code>medium<\/code>, <code>high<\/code>, <code>xhigh<\/code>, <code>max<\/code>, and <code>ultra<\/code> reasoning<br \/>\ncontrols when a model advertises them. opencodex keeps <code>xhigh<\/code> and <code>max<\/code> distinct unless a provider<br \/>\nconfig explicitly maps one to the other. <code>ultra<\/code> mirrors upstream Codex semantics: it selects<br \/>\nmaximum reasoning plus proactive multi-agent delegation in the client, and is converted to <code>max<\/code><br \/>\nbefore any request reaches a provider. Routed models advertise it only when a provider config opts<br \/>\nin via <code>reasoningEfforts<\/code>.<\/p>\n<p dir=\"auto\">GPT-5.6 Sol\/Terra\/Luna are seeded as rollout-ready catalog entries for the OpenAI API key and<br \/>\nOpenRouter presets (<code>gpt-5.6-sol<\/code>, <code>gpt-5.6-terra<\/code>, <code>gpt-5.6-luna<\/code>; OpenRouter uses<br \/>\n<code>openai\/...<\/code>). They remain preview-gated by upstream availability; opencodex only prepares the<br \/>\nrouting and catalog metadata for accounts and providers that can serve them.<\/p>\n<p align=\"center\" dir=\"auto\">\n  <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/assets\/codex-app-picker.png\"><img decoding=\"async\" src=\"https:\/\/github.com\/lidge-jun\/opencodex\/raw\/main\/assets\/codex-app-picker.png\" alt=\"Codex App showing opencodex routed models with reasoning effort picker\" width=\"480\" style=\"max-width: 100%;\"\/><\/a>\n<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">OpenAI provider account modes<\/h2>\n<p><a id=\"user-content-openai-provider-account-modes\" class=\"anchor\" aria-label=\"Permalink: OpenAI provider account modes\" href=\"#openai-provider-account-modes\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\/><\/svg><\/a><\/div>\n<p><markdown-accessiblity-table><\/p>\n<table>\n<thead>\n<tr>\n<th>Provider ID<\/th>\n<th>Route<\/th>\n<th>Credential<\/th>\n<th>Behavior<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>openai<\/code><\/td>\n<td>Codex login<\/td>\n<td>Main + added Codex accounts<\/td>\n<td>Pool by default; optional Direct mode<\/td>\n<\/tr>\n<tr>\n<td><code>openai-apikey<\/code><\/td>\n<td>OpenAI API<\/td>\n<td>API key\/key pool<\/td>\n<td>No Codex account routing<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/markdown-accessiblity-table><\/p>\n<ul dir=\"auto\">\n<li>Pool includes the main Codex login and added accounts, with affinity, quota, cooldown, and failover.<\/li>\n<li>Direct short-circuits pool state and uses only the current caller\/main-login bearer.<\/li>\n<li>Fresh installs and configs with no persisted mode default to Pool. Change the mode on the<br \/>\ndashboard&#8217;s <strong>Providers<\/strong> page; model ids stay bare in either mode.<\/li>\n<li>The legacy public provider id <code>chatgpt<\/code> is hidden after migration. The original config is retained<br \/>\nonce at <code>~\/.opencodex\/config.json.pre-openai-tiers-v2.bak<\/code>; restore it with<br \/>\n<code>cp ~\/.opencodex\/config.json.pre-openai-tiers-v2.bak ~\/.opencodex\/config.json<\/code>.<\/li>\n<li>Current configs use <code>openaiProviderTierVersion: 2<\/code>. Earlier v1 three-provider configs migrate<br \/>\nautomatically into the single <code>openai<\/code> row.<\/li>\n<li>The API tier includes Pro virtual models (<code>gpt-5.6-sol-pro<\/code>, <code>gpt-5.6-terra-pro<\/code>,<br \/>\n<code>gpt-5.6-luna-pro<\/code>). At the wire level, each rewrites to its base model with<br \/>\n<code>reasoning.mode: \"pro\"<\/code>.<\/li>\n<li>Its catalog is fixed to eight ids: <code>gpt-5.5<\/code>, <code>gpt-5.6<\/code>, Sol\/Terra\/Luna, and the three<br \/>\ncorresponding Pro virtual ids. There is no generic <code>gpt-5.6-pro<\/code> alias.<\/li>\n<li>Compact requests keep the selected tier but send the base model without a reasoning object.<\/li>\n<li>Official API metadata is 1,050,000 context tokens and 922,000 max input tokens.<\/li>\n<\/ul>\n<p dir=\"auto\">Use <code>gpt-5.6-sol<\/code> for the configured <code>openai<\/code> account mode and<br \/>\n<code>openai-apikey\/gpt-5.6-sol<\/code> for the API key. Codex-login and API credentials never fall through to<br \/>\none another.<\/p>\n<p dir=\"auto\">Open <strong>Codex Auth<\/strong> in the dashboard to add accounts and choose which account should handle the<br \/>\nnext Codex session. opencodex keeps these behaviors:<\/p>\n<ul dir=\"auto\">\n<li><strong>Existing sessions keep affinity.<\/strong> A thread id is bound to the selected account and reused on<br \/>\nlater turns, so a long request or a mobile\/SSH-attached session keeps using the same account.<\/li>\n<li><strong>New sessions can auto-route.<\/strong> When auto-switch is enabled, opencodex compares the hottest known<br \/>\nquota window across 5h, weekly, and 30d usage, then picks a lower-usage eligible account for new<br \/>\nsessions once the active account crosses the threshold.<\/li>\n<li><strong>Quota lookup is built in.<\/strong> The dashboard can refresh all account quotas in one click, and the<br \/>\nrequest log labels pool traffic with non-PII account ordinals.<\/li>\n<li><strong>Failures fail closed.<\/strong> Token failures mark reauthentication instead of falling back to another<br \/>\ncredential silently; 429 quota responses put the account in cooldown and can fail over future work<br \/>\nto another eligible pool account.<\/li>\n<\/ul>\n<ul dir=\"auto\">\n<li><strong>Use any LLM with Codex.<\/strong> 5 protocol adapters cover Anthropic Messages, Google Gemini, Azure, OpenAI Responses passthrough, and every OpenAI-compatible Chat Completions endpoint \u2014 that&#8217;s 40+ providers out of the box.<\/li>\n<li><strong>Use any LLM with Claude Code too.<\/strong> The same daemon serves the Anthropic Messages API (<code>\/v1\/messages<\/code> + <code>count_tokens<\/code>): <code>ocx claude<\/code> launches Claude Code fully wired, and routed models appear in its native <code>\/model<\/code> picker via gateway model discovery (<code>claude-ocx-&lt;provider&gt;--&lt;model&gt;<\/code> aliases, Claude Code 2.1.129+). Configure slots and model maps on the dashboard&#8217;s Claude page.<\/li>\n<li><strong>Pool ChatGPT accounts safely.<\/strong> Keep existing Codex threads on one account while new sessions<br \/>\ncan auto-pick a lower-usage account from the pool, with quota refresh and non-PII request labels.<\/li>\n<li><strong>Log in once, skip the API key.<\/strong> OAuth support for xAI, Anthropic, and Kimi means you can authenticate with your existing account. Tokens auto-refresh. Or forward your <code>codex login<\/code>, paste an API key, or use <code>${ENV_VAR}<\/code> references \u2014 your call.<\/li>\n<li><strong>Works everywhere Codex does.<\/strong> Injects into Codex CLI, TUI, App, and SDK automatically. Routed models show up in Codex&#8217;s model picker just like native ones.<\/li>\n<li><strong>History-safe injection.<\/strong> On local installs the proxy points Codex&#8217;s own built-in <code>openai<\/code> provider at itself via a single <code>openai_base_url<\/code> line \u2014 new threads keep their native provider tag, so ongoing chat history is never remapped and an unclean shutdown can&#8217;t hide it. (Threads re-tagged by older versions are migrated back once on the first start; remote\/LAN binds use a dedicated provider entry instead, since they need an API-key header.)<\/li>\n<li><strong>Delegate to the right model.<\/strong> Feature up to five routed or native models in Codex&#8217;s subagent picker from the dashboard or config \u2014 route complex tasks to a reasoning model, fast tasks to a cheap one. On the v2 multi-agent surface (GPT-5.6 Sol\/Terra) the proxy injects compact delegation guidance: a preferred sub-agent model and effort (<code>injectionModel<\/code> \/ <code>injectionEffort<\/code>), the featured-model roster with the effort ladder each supports, and the <code>fork_turns<\/code> rules that let cross-model <code>spawn_agent<\/code> calls apply their overrides. Known limitation: when a native parent spawns a routed child, the task body can currently arrive backend-encrypted and be lost (<a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/issues\/92\" data-hovercard-type=\"issue\" data-hovercard-url=\"\/lidge-jun\/opencodex\/issues\/92\/hovercard\">#92<\/a>) \u2014 use the v1 surface for reliable cross-provider delegation. Want your own wording? Set <code>injectionPrompt<\/code> with <code>{{model}}<\/code> \/ <code>{{effort}}<\/code> \/ <code>{{roster}}<\/code> placeholders.<\/li>\n<li><strong>Prepare for preview-gated OpenAI rollouts.<\/strong> GPT-5.6 Sol\/Terra\/Luna entries preserve the upstream effort ladders. Direct\/Multi use the 372k Codex contract; OpenAI API and OpenRouter use 1.05M metadata when upstream access is available.<\/li>\n<li><strong>Give any model superpowers.<\/strong> Non-OpenAI models get real web search and image understanding via a <code>gpt-5.4-mini<\/code> sidecar over your ChatGPT login.<\/li>\n<li><strong>Generate images natively.<\/strong> Codex&#8217;s standalone <code>image_gen<\/code> tool uses <code>POST \/v1\/images\/generations<\/code> for generation and <code>POST \/v1\/images\/edits<\/code> for edits; it is separate from the hosted Responses <code>image_generation<\/code> tool.<\/li>\n<li><strong>See what&#8217;s happening.<\/strong> The web dashboard shows providers, OAuth status, model selection, and a live request log, including cached\/cache-write token counts when upstream reports them \u2014 no more guessing why a request failed.<\/li>\n<li><strong>Runs in the background.<\/strong> Install as a system service (launchd \/ systemd \/ Task Scheduler) and forget about it. On macOS\/Linux the proxy starts at login; on Windows the default Task Scheduler backend starts at logon (windowless), or use <code>ocx service install --native<\/code> for a real Windows service that starts at boot.<\/li>\n<li><strong>Clean exit, zero residue.<\/strong> <code>ocx stop<\/code> (or the dashboard&#8217;s Stop button) shuts down the proxy, stops the background service if one is installed, and restores Codex to its original configuration. Plain <code>codex<\/code> works exactly as it did before \u2014 no leftover config, no orphaned processes.<\/li>\n<\/ul>\n<p><markdown-accessiblity-table><\/p>\n<table>\n<thead>\n<tr>\n<th>Provider<\/th>\n<th>Adapter<\/th>\n<th>Auth<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>OpenAI (ChatGPT login)<\/td>\n<td><code>openai-responses<\/code><\/td>\n<td>forward (no key)<\/td>\n<\/tr>\n<tr>\n<td>OpenAI (API key)<\/td>\n<td><code>openai-responses<\/code><\/td>\n<td>key<\/td>\n<\/tr>\n<tr>\n<td>Umans AI Coding Plan<\/td>\n<td><code>anthropic<\/code><\/td>\n<td>key<\/td>\n<\/tr>\n<tr>\n<td>Anthropic Claude<\/td>\n<td><code>anthropic<\/code><\/td>\n<td>oauth \/ key<\/td>\n<\/tr>\n<tr>\n<td>xAI Grok<\/td>\n<td><code>openai-chat<\/code><\/td>\n<td>oauth \/ key<\/td>\n<\/tr>\n<tr>\n<td>Kimi (Moonshot)<\/td>\n<td><code>openai-chat<\/code><\/td>\n<td>oauth \/ key<\/td>\n<\/tr>\n<tr>\n<td>Google Gemini<\/td>\n<td><code>google<\/code><\/td>\n<td>key<\/td>\n<\/tr>\n<tr>\n<td>Azure OpenAI<\/td>\n<td><code>azure-openai<\/code><\/td>\n<td>key<\/td>\n<\/tr>\n<tr>\n<td>Cursor (experimental)<\/td>\n<td><code>cursor<\/code><\/td>\n<td>dashboard\/local config; live transport; unsafe native local exec is opt-in<\/td>\n<\/tr>\n<tr>\n<td>Ollama Cloud + 17-provider catalog<\/td>\n<td><code>openai-chat<\/code><\/td>\n<td>key<\/td>\n<\/tr>\n<tr>\n<td>Ollama \/ vLLM \/ LM Studio (local)<\/td>\n<td><code>openai-chat<\/code><\/td>\n<td>key (usually blank)<\/td>\n<\/tr>\n<tr>\n<td>Any OpenAI-compatible endpoint<\/td>\n<td><code>openai-chat<\/code><\/td>\n<td>key<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/markdown-accessiblity-table><\/p>\n<p dir=\"auto\">Plus DeepSeek, Groq, OpenRouter, Together, Fireworks, Cerebras, Mistral, Hugging Face, NVIDIA NIM, MiniMax, Qwen Cloud, and more. See the full list with <code>ocx init<\/code> or in the <a href=\"https:\/\/lidge-jun.github.io\/opencodex\/reference\/configuration\/\" rel=\"nofollow\">provider docs<\/a>.<\/p>\n<p dir=\"auto\">Cursor support is a staged experimental bridge: it appears in <code>ocx init<\/code> and the dashboard Add<br \/>\nProvider picker as a local config with Cursor&#8217;s static public model catalog. Live<br \/>\nHTTP\/2 transport is enabled when a Cursor access token is configured. Cursor server-driven native<br \/>\nread\/write\/delete\/ls\/grep\/shell\/fetch execution is disabled by default because it bypasses Codex&#8217;s<br \/>\napproval and sandbox path; set <code>unsafeAllowNativeLocalExec: true<\/code> only for trusted local<br \/>\nexperiments.<br \/>\nMCP, screen recording, and computer-use are exposed through executor hooks; when no local executor<br \/>\nis configured, opencodex returns typed no-executor results instead of policy-blocking the request.<br \/>\nCursor OAuth and live model discovery are enabled for the experimental Cursor adapter.<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"ocx init                       # interactive setup&#10;ocx start [--port 10100]       # start the proxy; falls back to a free port if busy&#10;ocx stop                       # stop + restore native Codex&#10;ocx restore                    # restore without stopping (alias: ocx eject)&#10;ocx uninstall                  # remove service\/shim\/config and restore native Codex&#10;ocx ensure                     # start if needed + refresh Codex config\/cache&#10;ocx sync                       # refresh models + re-inject into Codex&#10;ocx codex-shim install         # run `ocx ensure` whenever `codex` is launched&#10;ocx status                     # is the proxy running?&#10;ocx login &lt;provider&gt;          # OAuth login (xai, anthropic, kimi, cursor, ...)&#10;ocx logout &lt;provider&gt;          # remove a stored login&#10;ocx account &lt;list|current|use&gt; # list\/switch accounts &amp; API-key pools (masked; also refresh\/auto-switch\/remove\/add-key)&#10;ocx gui                        # open the web dashboard&#10;ocx claude [args...]           # launch Claude Code wired to the proxy (model discovery on)&#10;ocx service [install|start|stop|status|uninstall]   # install\/update\/start background service&#10;ocx update [--tag preview]     # update opencodex; preview installs stay on @preview\">\n<pre>ocx init                       <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> interactive setup<\/span>\nocx start [--port 10100]       <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> start the proxy; falls back to a free port if busy<\/span>\nocx stop                       <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> stop + restore native Codex<\/span>\nocx restore                    <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> restore without stopping (alias: ocx eject)<\/span>\nocx uninstall                  <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> remove service\/shim\/config and restore native Codex<\/span>\nocx ensure                     <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> start if needed + refresh Codex config\/cache<\/span>\nocx sync                       <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> refresh models + re-inject into Codex<\/span>\nocx codex-shim install         <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> run `ocx ensure` whenever `codex` is launched<\/span>\nocx status                     <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> is the proxy running?<\/span>\nocx login <span class=\"pl-k\">&lt;<\/span>provider<span class=\"pl-k\">&gt;<\/span>          <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> OAuth login (xai, anthropic, kimi, cursor, ...)<\/span>\nocx <span class=\"pl-c1\">logout<\/span> <span class=\"pl-k\">&lt;<\/span>provider<span class=\"pl-k\">&gt;<\/span>          <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> remove a stored login<\/span>\nocx account <span class=\"pl-k\">&lt;<\/span>list<span class=\"pl-k\">|<\/span>current<span class=\"pl-k\">|<\/span>use<span class=\"pl-k\">&gt;<\/span> <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> list\/switch accounts &amp; API-key pools (masked; also refresh\/auto-switch\/remove\/add-key)<\/span>\nocx gui                        <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> open the web dashboard<\/span>\nocx claude [args...]           <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> launch Claude Code wired to the proxy (model discovery on)<\/span>\nocx service [install<span class=\"pl-k\">|<\/span>start<span class=\"pl-k\">|<\/span>stop<span class=\"pl-k\">|<\/span>status<span class=\"pl-k\">|<\/span>uninstall]   <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> install\/update\/start background service<\/span>\nocx update [--tag preview]     <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> update opencodex; preview installs stay on @preview<\/span><\/pre>\n<\/div>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Autostart: service vs shim<\/h3>\n<p><a id=\"user-content-autostart-service-vs-shim\" class=\"anchor\" aria-label=\"Permalink: Autostart: service vs shim\" href=\"#autostart-service-vs-shim\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\/><\/svg><\/a><\/div>\n<p dir=\"auto\">opencodex has two ways to auto-start the proxy:<\/p>\n<p><markdown-accessiblity-table><\/p>\n<table>\n<thead>\n<tr>\n<th\/>\n<th><code>ocx service<\/code> \/ <code>ocx service install<\/code><\/th>\n<th><code>ocx codex-shim install<\/code><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>How<\/strong><\/td>\n<td>OS service manager (launchd \/ systemd \/ schtasks)<\/td>\n<td>Wraps script launchers for <code>codex<\/code>; real <code>codex.exe<\/code> is left untouched<\/td>\n<\/tr>\n<tr>\n<td><strong>When<\/strong><\/td>\n<td>Always running after login<\/td>\n<td>On-demand \u2014 runs <code>ocx ensure<\/code> when <code>codex<\/code> is launched<\/td>\n<\/tr>\n<tr>\n<td><strong>Restart<\/strong><\/td>\n<td>Auto-restarts on crash<\/td>\n<td>Starts once per <code>codex<\/code> invocation<\/td>\n<\/tr>\n<tr>\n<td><strong>Codex updates<\/strong><\/td>\n<td>Unaffected<\/td>\n<td>Repairs on next <code>ocx codex-shim install<\/code> or <code>ocx update<\/code><\/td>\n<\/tr>\n<tr>\n<td><strong>Remove<\/strong><\/td>\n<td><code>ocx service uninstall<\/code><\/td>\n<td><code>ocx codex-shim uninstall<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/markdown-accessiblity-table><\/p>\n<p dir=\"auto\">Use the <strong>service<\/strong> for always-on proxy (recommended for development machines). Use the <strong>shim<\/strong> for<br \/>\nlightweight, on-demand proxy startup without a background daemon. Shim autostart is enabled by default<br \/>\nand can be disabled from the GUI dashboard. If the configured proxy port is already busy, <code>ocx start<\/code><br \/>\nautomatically picks another free local port and updates Codex to use it.<\/p>\n<p dir=\"auto\">Before removing the npm package, clean up local state:<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"ocx uninstall&#10;npm uninstall -g @bitkyc08\/opencodex\">\n<pre>ocx uninstall\nnpm uninstall -g @bitkyc08\/opencodex<\/pre>\n<\/div>\n<p dir=\"auto\"><code>ocx uninstall<\/code> stops the proxy, removes any installed service, removes the Codex shim, restores<br \/>\nnative Codex config\/catalog\/history, and deletes <code>~\/.opencodex<\/code>.<\/p>\n<p dir=\"auto\">Config lives at <code>~\/.opencodex\/config.json<\/code>. If the file cannot be parsed (e.g. truncated or<br \/>\nmanually broken JSON), opencodex backs it up to <code>config.json.invalid-&lt;timestamp&gt;<\/code>, prints a warning,<br \/>\nand falls back to defaults \u2014 so your original file is never silently lost.<\/p>\n<p dir=\"auto\">Here&#8217;s a typical multi-provider setup:<\/p>\n<div class=\"highlight highlight-source-json notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"{&#10;  &quot;port&quot;: 10100,&#10;  &quot;defaultProvider&quot;: &quot;anthropic&quot;,&#10;  &quot;providers&quot;: {&#10;    &quot;anthropic&quot;: {&#10;      &quot;adapter&quot;: &quot;anthropic&quot;,&#10;      &quot;baseUrl&quot;: &quot;https:\/\/api.anthropic.com&quot;,&#10;      &quot;authMode&quot;: &quot;oauth&quot;,&#10;      &quot;defaultModel&quot;: &quot;claude-sonnet-4-6&quot;&#10;    },&#10;    &quot;ollama-cloud&quot;: {&#10;      &quot;adapter&quot;: &quot;openai-chat&quot;,&#10;      &quot;baseUrl&quot;: &quot;https:\/\/ollama.com\/v1&quot;,&#10;      &quot;apiKey&quot;: &quot;${OLLAMA_API_KEY}&quot;,&#10;      &quot;defaultModel&quot;: &quot;glm-5.2&quot;&#10;    }&#10;  }&#10;}\">\n<pre>{\n  <span class=\"pl-ent\">\"port\"<\/span>: <span class=\"pl-c1\">10100<\/span>,\n  <span class=\"pl-ent\">\"defaultProvider\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>anthropic<span class=\"pl-pds\">\"<\/span><\/span>,\n  <span class=\"pl-ent\">\"providers\"<\/span>: {\n    <span class=\"pl-ent\">\"anthropic\"<\/span>: {\n      <span class=\"pl-ent\">\"adapter\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>anthropic<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"baseUrl\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>https:\/\/api.anthropic.com<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"authMode\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>oauth<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"defaultModel\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>claude-sonnet-4-6<span class=\"pl-pds\">\"<\/span><\/span>\n    },\n    <span class=\"pl-ent\">\"ollama-cloud\"<\/span>: {\n      <span class=\"pl-ent\">\"adapter\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>openai-chat<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"baseUrl\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>https:\/\/ollama.com\/v1<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"apiKey\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>${OLLAMA_API_KEY}<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"defaultModel\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>glm-5.2<span class=\"pl-pds\">\"<\/span><\/span>\n    }\n  }\n}<\/pre>\n<\/div>\n<p dir=\"auto\">Provider entries can also annotate routed catalog metadata. Use <code>contextWindow<\/code> for a provider-wide<br \/>\nCodex-visible context cap, <code>modelContextWindows<\/code> for model-specific caps, and<br \/>\n<code>modelInputModalities<\/code> for model-specific catalog input hints such as <code>[\"text\"]<\/code> or<br \/>\n<code>[\"text\", \"image\"]<\/code>. Context values cap live <code>\/models<\/code> metadata; they never raise a smaller live<br \/>\ncontext window. The bundled GPT-5.6 Sol\/Terra\/Luna fallback metadata uses a 1,050,000-token context<br \/>\nwindow for OpenAI API key and OpenRouter catalog entries; it does not bypass upstream preview<br \/>\naccess. See the configuration reference for the full field list.<\/p>\n<blockquote>\n<p dir=\"auto\"><strong>GLM-5.2 1M context via Z.AI:<\/strong> through the <code>openai-chat<\/code> adapter, both <code>glm-5.2<\/code><br \/>\nand <code>glm-5.2[1m]<\/code> work \u2014 opencodex strips the trailing <code>[1m]<\/code> suffix before<br \/>\nsending the request, since OpenAI-compatible endpoints reject the bracketed id<br \/>\n(Z.AI 400 code 1211). The <code>[1m]<\/code> suffix is a Claude-Code \/ Anthropic-endpoint<br \/>\nconvention; to use it natively, point the <code>anthropic<\/code> adapter at Z.AI&#8217;s coding<br \/>\nbase (<code>https:\/\/api.z.ai\/api\/coding\/paas\/v4<\/code>). Set the 1M context window via the<br \/>\nmodel catalog (<code>modelContextWindows<\/code>), not the model name.<\/p>\n<\/blockquote>\n<p dir=\"auto\">Local models work too. Point opencodex at any OpenAI-compatible server running on your machine:<\/p>\n<div class=\"highlight highlight-source-json notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"{&#10;  &quot;port&quot;: 10100,&#10;  &quot;defaultProvider&quot;: &quot;ollama&quot;,&#10;  &quot;providers&quot;: {&#10;    &quot;ollama&quot;: {&#10;      &quot;adapter&quot;: &quot;openai-chat&quot;,&#10;      &quot;baseUrl&quot;: &quot;http:\/\/localhost:11434\/v1&quot;,&#10;      &quot;authMode&quot;: &quot;key&quot;,&#10;      &quot;apiKey&quot;: &quot;&quot;,&#10;      &quot;defaultModel&quot;: &quot;llama3&quot;&#10;    },&#10;    &quot;vllm&quot;: {&#10;      &quot;adapter&quot;: &quot;openai-chat&quot;,&#10;      &quot;baseUrl&quot;: &quot;http:\/\/localhost:8000\/v1&quot;,&#10;      &quot;authMode&quot;: &quot;key&quot;,&#10;      &quot;apiKey&quot;: &quot;&quot;,&#10;      &quot;defaultModel&quot;: &quot;Qwen\/Qwen3-32B&quot;&#10;    }&#10;  }&#10;}\">\n<pre>{\n  <span class=\"pl-ent\">\"port\"<\/span>: <span class=\"pl-c1\">10100<\/span>,\n  <span class=\"pl-ent\">\"defaultProvider\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>ollama<span class=\"pl-pds\">\"<\/span><\/span>,\n  <span class=\"pl-ent\">\"providers\"<\/span>: {\n    <span class=\"pl-ent\">\"ollama\"<\/span>: {\n      <span class=\"pl-ent\">\"adapter\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>openai-chat<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"baseUrl\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>http:\/\/localhost:11434\/v1<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"authMode\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>key<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"apiKey\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"defaultModel\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>llama3<span class=\"pl-pds\">\"<\/span><\/span>\n    },\n    <span class=\"pl-ent\">\"vllm\"<\/span>: {\n      <span class=\"pl-ent\">\"adapter\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>openai-chat<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"baseUrl\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>http:\/\/localhost:8000\/v1<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"authMode\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>key<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"apiKey\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"defaultModel\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>Qwen\/Qwen3-32B<span class=\"pl-pds\">\"<\/span><\/span>\n    }\n  }\n}<\/pre>\n<\/div>\n<p dir=\"auto\">WebSocket transport is off by default. Set <code>\"websockets\": true<\/code> only if you want Codex to advertise and use the Responses WebSocket path instead of HTTP\/SSE.<\/p>\n<p dir=\"auto\">By default opencodex binds to <code>127.0.0.1<\/code> (loopback) and requires no extra authentication.<br \/>\nIf you set <code>\"hostname\": \"0.0.0.0\"<\/code> to expose the proxy on the LAN, opencodex requires a bearer token<br \/>\nto protect both the management API (<code>\/api\/*<\/code>) and the data-plane (<code>\/v1\/responses<\/code>,<br \/>\n<code>\/v1\/images\/generations<\/code>, and <code>\/v1\/images\/edits<\/code>):<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"export OPENCODEX_API_AUTH_TOKEN=&quot;your-secret-token&quot;&#10;ocx start\">\n<pre><span class=\"pl-k\">export<\/span> OPENCODEX_API_AUTH_TOKEN=<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>your-secret-token<span class=\"pl-pds\">\"<\/span><\/span>\nocx start<\/pre>\n<\/div>\n<p dir=\"auto\">The proxy refuses to start without this variable when binding beyond loopback. If you install a<br \/>\nbackground service for LAN access, export the same variable before <code>ocx service install<\/code> so the<br \/>\nservice manager receives it.<br \/>\nClients (scripts, remote machines) must include the token in every request:<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"x-opencodex-api-key: your-secret-token\">\n<pre class=\"notranslate\"><code>x-opencodex-api-key: your-secret-token\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">The token is compared in constant time to prevent timing attacks.<\/p>\n<p dir=\"auto\">opencodex automatically remaps Codex resume history so old OpenAI chats and opencodex-created project<br \/>\nthreads stay visible in Codex App while the proxy is active. opencodex records the original provider\/source metadata in<br \/>\n<code>~\/.opencodex\/codex-history-backup.json<\/code>. <code>ocx stop<\/code> \/ <code>ocx restore<\/code> restores backed-up OpenAI rows<br \/>\nto OpenAI, and ejects any remaining opencodex user threads to OpenAI as well so native Codex does not<br \/>\ntry to resume a thread whose provider no longer exists in <code>config.toml<\/code>.<\/p>\n<p dir=\"auto\">If you tested an older development build where <code>syncResumeHistory<\/code> already remapped history before<br \/>\nbackup support existed, you can also run the explicit recovery command:<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"ocx recover-history --legacy-openai\">\n<pre>ocx recover-history --legacy-openai<\/pre>\n<\/div>\n<p dir=\"auto\">See the <strong><a href=\"https:\/\/lidge-jun.github.io\/opencodex\/reference\/configuration\/\" rel=\"nofollow\">Configuration reference<\/a><\/strong> for every field.<\/p>\n<p dir=\"auto\">The public docs \u2014 install, providers, routing, sidecars, Codex integration, Codex App model picker, and CLI\/config reference \u2014 are built from <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/docs-site\"><code>docs-site\/<\/code><\/a> and published to <strong><a href=\"https:\/\/lidge-jun.github.io\/opencodex\/\" rel=\"nofollow\">lidge-jun.github.io\/opencodex<\/a><\/strong>.<\/p>\n<p dir=\"auto\">Maintainer source-of-truth notes live under <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/structure\"><code>structure\/<\/code><\/a>. Historical investigations remain under <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/docs\"><code>docs\/<\/code><\/a>.<br \/>\nContributor setup lives in <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/CONTRIBUTING.md\"><code>CONTRIBUTING.md<\/code><\/a>, and security reporting guidance<br \/>\nlives in <a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/SECURITY.md\"><code>SECURITY.md<\/code><\/a>.<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"git clone https:\/\/github.com\/lidge-jun\/opencodex.git&#10;cd opencodex&#10;bun install&#10;bun run dev:proxy    # start the proxy API in dev mode&#10;bun run dev:gui      # start the dashboard dev server in another terminal&#10;bun x tsc --noEmit   # typecheck\">\n<pre>git clone https:\/\/github.com\/lidge-jun\/opencodex.git\n<span class=\"pl-c1\">cd<\/span> opencodex\nbun install\nbun run dev:proxy    <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> start the proxy API in dev mode<\/span>\nbun run dev:gui      <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> start the dashboard dev server in another terminal<\/span>\nbun x tsc --noEmit   <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> typecheck<\/span><\/pre>\n<\/div>\n<p dir=\"auto\"><code>bun run dev<\/code> remains an alias for <code>bun run dev:proxy<\/code> for compatibility. In a source checkout,<br \/>\nthe proxy API exposes <code>\/healthz<\/code>, <code>\/v1\/responses<\/code>, <code>POST \/v1\/images\/generations<\/code>,<br \/>\n<code>POST \/v1\/images\/edits<\/code>, and <code>\/api\/*<\/code>; <code>GET \/<\/code> serves the packaged dashboard only after<br \/>\n<code>bun run build:gui<\/code> has produced <code>gui\/dist<\/code>. While hacking on the dashboard, run the frontend separately:<\/p>\n<p dir=\"auto\">See <strong><a href=\"https:\/\/github.com\/lidge-jun\/opencodex\/blob\/main\/CONTRIBUTING.md\">Contributing<\/a><\/strong>.<\/p>\n<p dir=\"auto\">opencodex is an independent, community-maintained project and is <strong>not affiliated with or endorsed by OpenAI, Anthropic, or any other provider<\/strong>.<\/p>\n<p dir=\"auto\">Some providers \u2014 notably Anthropic (Claude) \u2014 may suspend or restrict accounts that route API traffic through third-party proxies. <strong>Use at your own risk (UAYOR).<\/strong> Before connecting a provider, review its Terms of Service to confirm that proxy-based access is permitted. The opencodex maintainers are not responsible for any account actions taken by upstream providers.<\/p>\n<p dir=\"auto\">MIT<\/p>\n<\/div>\n<p><a href=\"https:\/\/github.com\/lidge-jun\/opencodex?utm_source=tldrai\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Universal provider proxy for OpenAI Codex &amp; Claude Code \u2014 use any LLM with Codex CLI, App, SDK, and Claude Code. npm install -g @bitkyc08\/opencodex \u00b7 ocx start \u00b7 localhost:10100 English \u00b7 \ud55c\uad6d\uc5b4 \u00b7 \u7b80\u4f53\u4e2d\u6587 \u00b7 \u0420\u0443\u0441\u0441\u043a\u0438\u0439 \u00b7 \u65e5\u672c\u8a9e \u00b7 Full documentation \u2192 Use Claude, Gemini, Grok, GLM, DeepSeek, Kimi, Qwen, Ollama, or any other [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":22585,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[143],"tags":[],"class_list":["post-22584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/posts\/22584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/comments?post=22584"}],"version-history":[{"count":0,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/posts\/22584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/media\/22585"}],"wp:attachment":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/media?parent=22584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/categories?post=22584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/tags?post=22584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}