You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Codex as an OpenAI-compatible API — use your ChatGPT subscription
services/codex_api.py is the mirror image of claude-code-api: it wraps the local
`codex` CLI so anything speaking the OpenAI chat API can drive your ChatGPT/Codex
subscription. No API key — auth is whatever `codex login` established.
POST /v1/chat/completions GET /v1/models GET /health
Wired end to end: a `codex` service on :8010 (aios start codex), a chat target
and dashboard chip/panel, an entry in the hub's own /v1/models, the interconnect
URL for other agents, and option 2 in the setup wizard next to the Claude
subscription — so both subscription routes are offered before any API key is.
Three real bugs found by testing it against the live CLI rather than assuming:
- Passing a model name that the account can't use makes codex exit 1 with
"model is not supported". The bridge now sends no -m at all unless explicitly
asked, letting codex use whatever it's configured for.
- Codex is a *workspace* agent. Pointed at the AIOS repo with -C it answered
every question with "Ready. What would you like me to work on in <repo>?"
instead of the question. It now runs in a neutral scratch dir, overridable
with AIOS_CODEX_WORKDIR when repo context is actually wanted.
- The big one: on Windows `codex` resolves to codex.CMD, and cmd.exe mangles
newlines inside an argv argument — so every multi-line prompt (i.e. every real
one, since system+user get flattened) silently arrived truncated and produced
a generic greeting. The prompt is now piped via stdin with "-", which is
correct on both platforms.
Uses --output-last-message rather than scraping stdout, because codex streams
reasoning, tool calls and token counts to the terminal and the final answer
can't be reliably picked out of that.
Verified live: healthy on :8010, correct answers to both a factual and a coding
question through the bridge, and through the hub after restart —
"`zip()` pairs items from multiple iterables into tuples, stopping when the
shortest is exhausted."
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
<divid="codex" class="view"><divclass="vhead"><h2>⌁ Codex</h2><spanclass="sub">OpenAI Codex via your ChatGPT subscription</span></div><divclass="vbody pad" id="codexBody"></div></div>
319
+
316
320
<divid="claudecode" class="view"><divclass="vhead"><h2>◈ claude-code</h2><spanclass="sub">Claude Code as an OpenAI-compatible API</span></div><divclass="vbody pad" id="claudecodeBody"></div></div>
317
321
318
322
<!-- CANVAS (generative UI any agent can edit) -->
if(v==='opencode')agentPanel('opencode','opencodeBody','The headless coding-agent engine. Chat with it from the Chat tab (target “opencode”) or call its HTTP API/SDK.',peers.opencode);
752
756
if(v==='crewai')agentPanel('crewai','crewaiBody','Role-based multi-agent crews. Chat with it from the Chat tab (target “CrewAI”). It can call the other agents via the hub.',peers.crewai);
757
+
if(v==='codex')agentPanel('codex','codexBody','OpenAI Codex, wrapped as an OpenAI-compatible API by <span class="mono">services/codex_api.py</span>. Auth is your <span class="mono">codex login</span> — no API key. Chat with it here (target <b>Codex</b>) or POST to <span class="mono">'+(peers.codex||'http://127.0.0.1:8010')+'/v1</span>.',peers.codex);
753
758
if(v==='claudecode')agentPanel('claudecode','claudecodeBody','Claude Code exposed as an OpenAI-compatible API. Chat with it (target “claude-code”), or point any tool at <span class="mono">'+(peers.claudecode||'http://127.0.0.1:8000')+'/v1</span>. Needs the <span class="mono">claude</span> CLI installed + authenticated.',peers.claudecode);
0 commit comments