This pull request introduces full feature parity and explicit UI support for the OpenAI Codex backend (chatgpt.com/backend-api/codex/responses). The codebase is now entirely backend-agnostic and smoothly transitions between Anthropic Claude and OpenAI Codex schemas based on current authentication, without losing features like reasoning animations, token billing, or multi-modal visual inputs.
- Native Vision Translation: Anthropic
base64image schemas now map precisely to the Codex expectedinput_imagepayloads. - Strict Payload Mapping: Refactored the internal mapping logic to translate
msg.contentitems precisely intoinput_text, sidestepping OpenAI's strictv1/responsesvalidation rules (Invalid value: 'text'). - Tool Logic Fixes: Properly routed
tool_resultitems into top-levelfunction_call_outputobjects to guarantee that local CLI tool executions (File Reads, Bash loops) cleanly feed back into Codex logic without throwing "No tool output found" errors. - Cache Stripping: Cleanly stripped Anthropic-only
cache_controlannotations from tool bindings and prompts prior to transmission so the Codex API doesn't reject malformed JSON.
- Model Cleanups (
model.ts): UpdatedgetPublicModelDisplayNameandgetClaudeAiUserDefaultModelDescriptionto recognize Codex GPT strings. Models likegpt-5.1-codex-maxnow beautifully map toCodex 5.1 Maxin the CLI visual outputs instead of passing the raw proxy IDs. - Default Reroutes: Made
getDefaultMainLoopModelSettingaware ofisCodexSubscriber(), automatically defaulting togpt-5.2-codexinstead ofsonnet46. - Billing Visuals (
logoV2Utils.ts): RefactoredformatModelAndBillinglogic to renderCodex API Billingproudly inside the terminal header when authenticated.
- Thinking Animations:
codex-fetch-adapternow intentionally intercepts the proprietaryresponse.reasoning.deltaSSE frames emitted bycodex-maxmodels. It wraps them into Anthropic<thinking>events, ensuring the standard CLI "Thinking..." spinner continues to function flawlessly for OpenAI reasoning. - Token Accuracy: Bound logic to track
response.completedcompletion events, fetchingusage.input_tokensandoutput_tokens. These are injected natively into the finalmessage_stoptoken handler, meaning Codex queries correctly trigger the terminal's Token/Price tracker summary logic.
- Configured
.gitignoreto securely and durably exclude theopenclaw/gateway directory from staging commits.