https://github.com/cmochance/codex-app-transfer
Local desktop gateway that translates OpenAI Codex CLI's Responses API into Chat Completions for Kimi / DeepSeek / Zhipu GLM / Bailian and other OpenAI-compatible providers.
https://github.com/cmochance/codex-app-transfer
api-proxy chat-completions claude codex deepseek kimi llm-tools openai responses-api rust
Last synced: 17 days ago
JSON representation
Local desktop gateway that translates OpenAI Codex CLI's Responses API into Chat Completions for Kimi / DeepSeek / Zhipu GLM / Bailian and other OpenAI-compatible providers.
- Host: GitHub
- URL: https://github.com/cmochance/codex-app-transfer
- Owner: Cmochance
- License: mit
- Created: 2026-05-01T06:50:41.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-17T06:07:46.000Z (24 days ago)
- Last Synced: 2026-05-17T06:46:27.806Z (24 days ago)
- Topics: api-proxy, chat-completions, claude, codex, deepseek, kimi, llm-tools, openai, responses-api, rust
- Language: Rust
- Size: 22.2 MB
- Stars: 111
- Watchers: 0
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.en.md
- License: LICENSE.txt
- Agents: AGENTS.md
Awesome Lists containing this project
README
# Codex App Transfer
> [!IMPORTANT]
> ๐ด **Test coverage notice**
>
> This project has currently completed **end-to-end real-world testing only for Kimi For Coding and Xiaomi MiMo (Token Plan)**.
>
> Other built-in chat-completions-compatible providers (including **DeepSeek, Kimi (Moonshot Platform), Xiaomi MiMo (Pay for Token), Zhipu GLM, Aliyun Bailian (API Key / Token Plan), MiniMax**) **have not undergone long-term real-world regression** โ they sit at unit-test + occasional user-report level only.
>
> If you'd be willing to **provide an API key from another provider for testing**, it would be deeply appreciated! Reach out via **QQ: `3216202644`** or email โ the author guarantees the **API key will only be used for actual testing of this project**.
็ฎไฝไธญๆ |
English |
Changelog
Codex App Transfer is a lightweight desktop config + forwarding tool for the **OpenAI Codex App**. It runs a local gateway that translates Codex App's Responses API requests (HTTP streaming / non-streaming + `/responses`) into Chat Completions and other upstream formats, then forwards them to your chosen provider. The desktop UI manages providers, model mappings, the forwarding port, and the logs panel, letting Codex App talk to any third-party chat/completions inference service.
After starting forwarding, Codex App talks to this tool at `127.0.0.1:18080`. Closing the window minimizes the app to the system tray; right-click the tray icon and choose "Exit" to fully quit.
Current version **v2.1.14** (see [Changelog](docs/CHANGELOG.md) and [Releases](https://github.com/Cmochance/codex-app-transfer/releases)).
## Preview
| Dashboard | Providers |
|---|---|
|  |  |
| **Settings** | **Logs** |
|  |  |
### Codex App in action
With any provider enabled, Codex App's model picker shows ` / `-style real model names. Tool loops / `previous_response_id` history replay / thinking-mode reasoning_content injection are all handled transparently by the local proxy:

## What it does
- Manage multiple providers; map OpenAI model names (`gpt-5.5` / `gpt-5.4` / `gpt-5.4-mini` / `gpt-5.3-codex` / `gpt-5.2`) to the provider's real model IDs
- Translate Codex App's Responses API streaming / non-streaming requests into upstream protocols: Chat Completions, Gemini Native (`:streamGenerateContent`), Gemini CLI OAuth (Cloud Code Assist), Anthropic Messages (`/v1/messages`), Grok Web (`/rest/app-chat/conversations/new`), Responses passthrough, etc.
- Multi-turn tool conversation context + `previous_response_id` history replay + autocompact expansion + thinking / reasoning_content injection โ all aligned with the OpenAI Responses API protocol
- Codex App's freeform `apply_patch` tool (edit-file +/- diff UI) works on chat-completions providers: the adapter bridges Responses `custom_tool_call` โ chat `function_call` wire forms, the model emits V4A-format patches, Codex App renders the diff (issue #235)
- **Two-layer session history persistence**: L1 in-memory LRU + L2 sqlite with 30-day TTL (`~/.codex-app-transfer/sessions.db`), preserving history across `.app` restarts
- Codex App config guardrails: snapshots `~/.codex/{config.toml,auth.json}` before apply; restores via per-key smart merge on exit / next start
- **Codex Doc Management** (Sidebar โ Codex):
- **Agents**: raw read/write `AGENTS.md` at any path with file system picker; auto-classify project-root / subdir via `.git/` detection with chip labels
- **Memories**: fixed two entries `~/.codex/memories/MEMORY.md` (main index) + `memory_summary.md` (auto summary) โ the only two user-editable AI memory indexes that codex actually reads
- **Skills**: scan `~/.codex/skills//SKILL.md` for raw editing; "Open folder" button shells out to `open` so users edit non-SKILL.md companion files (scripts / examples / templates) in Finder/Explorer
- **MCP**: structured JSON editing on the `[mcp_servers.*]` section of `~/.codex/config.toml` (`toml_edit` round-trip preserves comments + sibling config sections); Plugins sub-tab scans `~/.codex/plugins/cache/` for installed bundles (enable toggle / uninstall); all writes are atomic + independent history per SHA-256 path hash (no cross-tab interference)
- Real-time logs panel auto-refreshing every 2s; unified `tracing::warn!(error_id, detail)` with stable tokens โ operators can grep / aggregate
- Feedback dialog automatically attaches diagnostic material (environment info, sanitized config, recent error snapshot with full request / response) โ fewer back-and-forth follow-ups
- Chinese / English UI; light / dark / green / orange / gray / white themes
- Cross-platform single-instance lock (double-click brings the existing window forward) + cross-process file lock prevents multi-instance config-write lost-updates
- Windows / macOS / Linux system tray
## Download
Latest: `https://github.com/Cmochance/codex-app-transfer/releases/latest`
Recommended asset naming:
```text
Codex-App-Transfer-v-Windows-x64-Setup.exe Windows NSIS installer (recommended)
Codex-App-Transfer-v-Windows-x64.msi Windows MSI (enterprise MDM / GPO)
Codex-App-Transfer-v-macOS-arm64.dmg macOS Apple Silicon
Codex-App-Transfer-v-macOS-x64.dmg macOS Intel x64 (v2.1.0+, closes #61)
Codex-App-Transfer-v-Linux-x86_64.deb Debian / Ubuntu
Codex-App-Transfer-v-Linux-x86_64.AppImage Generic Linux x86_64; `chmod +x` and run
```
Each binary ships with `.sha256` and `.sig` (RSA-3072 PKCS#1 v1.5 + SHA-256); the public key `Codex-App-Transfer-release-public.pem` is published as a release asset โ download it from [Releases](https://github.com/Cmochance/codex-app-transfer/releases) to verify signatures.
Windows builds are not Authenticode-signed yet, so Windows may show an "unknown publisher" warning โ use the `.sha256` / `.sig` to verify download integrity.
macOS builds are **not yet signed with an Apple Developer ID** and **not yet Notarized**, so Gatekeeper blocks first launch with "cannot be opened because it is from an unidentified developer". Workarounds: `right-click โ Open` to allow once; or verify download integrity with `.sha256` / `.sig`, then click "Open Anyway" under `System Settings โ Privacy & Security`.
## Quick Start
1. Launch Codex App Transfer; the desktop window opens
2. On the dashboard, click the top-right "+" โ pick a preset or add a custom provider; fill in API Base URL, API Key, then "Fetch models" and add model mappings
3. Click the **Apply** button at the bottom and confirm restarting Codex App to start using it (if a provider is already configured, just click the **Apply** button on its card on the home page)
## Provider compatibility matrix
| Provider | Multi-turn | autocompact | tool_call_repair | Notes |
|---|---|---|---|---|
| Kimi (Moonshot Platform / Kimi For Coding) | โ
| โ
| โ
| Thinking 3-layer defense |
| DeepSeek V4 (incl. Max thinking) | โ
| โ
| โ
| Vision input stripped to avoid 400 |
| Xiaomi MiMo (Token Plan / Pay for Token) | โ
| โ
| โ
| Image-only requests get space text-part fallback |
| MiniMax M2.x / Text-01 | โ
| โ
| โ
| `role=system` โ user (v2.1.6 fix for 400) |
| Google AI Studio (`gemini_native`) | โ
| โ
| โ
| Auto-selects Gemini 3 `/v1alpha` + Gemini 2.x `/v1beta` |
| Google Gemini CLI OAuth | โ
| โ
| โ
| Browser login once; no API key needed |
| Anthropic Messages (custom Claude-compatible) | โ
(PR #153) | โ
(PR #153) | โ
(PR #153) | `apiFormat=anthropic_messages`; Claude preset pending real validation |
| Grok Web (SuperGrok / X Premium+) | โ
| โ
| โ
(v2.1.6 adds tool_calls flatten) | Experimental, TOS gray area, personal use only |
| Google Antigravity OAuth | โ
| โ
| โ
| Backend ready, UI pending |
| Zhipu GLM / Alibaba Cloud Bailian | โ ๏ธ experimental | โ | โ | OpenAI Chat-compatible reverse proxy |
| Responses passthrough (custom) | โ | โ | โ | Direct upstream connection, bypasses proxy (suitable for OpenAI official / native Responses reverse proxy); โ ๏ธ Plugins/MCP `namespace` tool bundle is NOT flattened โ some upstreams silently drop tools |
## Model mapping
Codex App prompts by OpenAI model names; third-party providers use real IDs like `deepseek-v4-pro` / `kimi-k2.6` / `glm-5.1` / `gemini-3-pro`.
This tool maps via `provider.models[slot]` (`gpt-5.5` โ `deepseek-v4-pro` etc.); Codex App's model picker shows ` / ` real names. Upstream `chatcmpl-...` response IDs are auto-rewritten to Codex App-validatable `resp_`, preserving deployment-affinity encoding so `previous_response_id` is consistent across turns.
## Development (v2 / Rust)
```bash
git clone https://github.com/Cmochance/codex-app-transfer.git
cd codex-app-transfer
cargo tauri dev # launch desktop window with hot-reload
cargo test --workspace --lib # run unit tests
make mac-app # local macOS bundle to dist/mac/
```
Fixture reverse-diff (contract tests):
```bash
cargo run --bin xtask -- gen-fixtures
```
Bundling (refer to `.github/workflows/release.yml`):
```bash
cargo tauri build --bundles app,dmg # macOS arm64
cargo tauri build --bundles nsis,msi # Windows x64
cargo tauri build --bundles deb,appimage # Linux x86_64
```
### Tweaking the UI
`frontend/css/` is organized as a small component library โ no need to grep the whole `style.css`:
| What to tweak | Where to edit |
|---|---|
| Theme colors / radius / shadow / spacing (design tokens) | `frontend/css/tokens.css` (129 vars + 6 themes) |
| Global reset / body font / focus ring | `frontend/css/base.css` |
| Buttons / cards / forms / badges / modals etc. | `frontend/css/components/.css` |
| Page-specific styles for dashboard / providers / proxy / settings / guide | `frontend/css/pages/.css` |
| Responsive breakpoints (1100px / 720px) | `frontend/css/responsive.css` |
Preview every component + variant + theme switching:
```bash
# Open directly in your browser (no dev server needed)
open frontend/gallery.html # macOS
xdg-open frontend/gallery.html # Linux
start frontend/gallery.html # Windows
```
`gallery.html` has a theme picker + dark/light toggle at the top, refresh after editing component css to see changes. `frontend/index.html`'s `` does not need to change โ `style.css` is just an `@import` entry that aggregates every sub-file.
To add a new component: create `components/.css` + add a line `@import url("components/.css");` to `style.css` + add a section in `gallery.html`.
## Troubleshooting
### Codex models can't run `curl` and similar network commands / approval prompt stuck
`curl` requires elevated permissions. Third-party models currently cannot trigger the macOS escalation prompt, so this app writes `sandbox_mode = "danger-full-access"` + `approval_policy = "never"` into `~/.codex/config.toml` by default on apply. On Windows, or if you have other reasons, you can turn this off in Settings โ "Allow Codex network tools (full-access mode)" (#215).
> **โ ๏ธ Security trade-off**: full-access mode lets the model read/write any file and run every command without approval = **fully trust the model** (equivalent to Codex's official "Full access" tier). With the toggle off, Codex falls back to the read-only sandbox + on-request approval. macOS still cannot trigger the elevation prompt, so there is no network access โ only the selected model's built-in `web_search` capability is usable. If the model doesn't support `web_search`, all search calls return empty results.
### Codex App reports `404 Not Found url: http://127.0.0.1:18080/responses`
Old versions only exposed `/v1/responses`; Codex CLI 0.126+ falls back to `/responses` (without `/v1/`). This tool added the route alias โ **v1.0.1 and later all support it** (current v2.x series ships it by default, no extra config needed).
### Codex App reports `stream disconnected before completion`
Usually means `response.id` / `response.model` weren't returned in the shape Codex App expects. This tool rewrites upstream `chatcmpl-...` to `resp_` while preserving the requested model name โ confirm forwarding logs show `resp_...` instead of `chatcmpl-...`.
### Upstream 400: `thinking is enabled but reasoning_content is missing`
Kimi / DeepSeek with thinking enabled require historical assistant messages with `tool_call` to carry `reasoning_content`. This tool **auto-fills a default empty string since v1.0.1** and maps reasoning items from Responses input to the corresponding assistant message.
### Upstream 400: `'reasoning_effort' does not support 'xhigh'`
If Codex user config sets `model_reasoning_effort` to `xhigh` / `max`, this tool auto-degrades to `high`. `auto` / `none` etc. (which the Chat endpoint doesn't accept) are dropped.
### MiniMax 400: `invalid message role: system (2013)`
v2.1.5 and earlier did not convert `role=system` to `role=user`, causing MiniMax `/v1/chat/completions` to 400 the entire request. v2.1.6+ fixes this (closes #139): all `role=system` messages are converted to `role=user` with content prefixed by `[System]\n`.
### Port conflicts
v2 only listens on `18080` (forwarding) by default; the admin UI now uses Tauri in-process `cas://` and no longer occupies 18081. Use `netstat -ano | findstr :18080` to find usage, or change the port in Settings โ Port and restart forwarding.
### Windows "unknown publisher" warning
The current Windows build is not Authenticode-signed. The Release page provides `.sha256` and `.sig` to verify the installer hasn't been tampered with.
### Self-host / custom update URL
From v2.1.12+ the client **enforces** RSA-3072 PKCS#1-v1.5-SHA256 verification on `latest.json` and every installer. The upgrade flow fetches `.sig` alongside the file and verifies against the build-time embedded official public key (`release/Codex-App-Transfer-release-public.pem`). Failure is fatal โ no SHA256-only fallback.
**A custom update URL must be self-signed to work**:
1. Fork the repo and replace `release/Codex-App-Transfer-release-public.pem` with your own public key.
2. Run `cargo run -p xtask --release -- release-bundle` with the matching private key to sign `latest.json` and every installer.
3. Rebuild the client so the public key is embedded.
4. Users point Settings โ Update URL at your `latest.json` endpoint.
Design intent: the client trusts only the build-time embedded public key and never lets a runtime URL replace it, blocking MITM rewrites of `latest.json` (the public PEM lives in `release/` but pulling it from the same origin as the update URL would dissolve the trust anchor).
### Logs
- App UI: real-time panel below the forwarding page, auto-refreshes every 2s
- Disk: `~/.codex-app-transfer/logs/proxy-YYYY-MM-DD.log` โ click "View Logs" to open directly
- "Clear logs" moves the current log to `logs/backup/` with a timestamp suffix โ never deletes outright
## Tech Stack
- **Backend / forwarding**: Rust 1.80+ ยท axum 0.8 ยท reqwest 0.12 (rustls-tls) ยท tokio
- **Protocol adapters**: `crates/adapters/` โ Responses โ Chat / Gemini Native / Gemini CLI OAuth / Anthropic Messages / Grok Web (request body + streaming response state machine + reasoning_content + tool_calls)
- **Frontend**: HTML + CSS + vanilla JavaScript + Bootstrap 5.3.3 (localized, no CDN dependency)
- **Desktop shell**: Tauri 2 + tray-icon 0.23; the `cas://` URI scheme glues frontend/ and axum in-process, no TCP loopback
- **Storage**: `~/.codex-app-transfer/config.json` (config, compatible with v1.x), `~/.codex-app-transfer/sessions.db` (L2 sqlite session persistence), `~/.codex/{config.toml,auth.json}` (Codex App integration)
- **Packaging**: `cargo tauri build` single command produces dmg/AppImage/deb/exe/msi; `xtask release-bundle` finalizes sha256 + RSA-3072 sig + latest.json + draft GitHub release
## Disclaimer
This project focuses on **OpenAI Codex App** integration; it is **not** an official OpenAI / Anthropic / Google / xAI project and does not reuse their trademarks / logos / release identities.
Upstream API keys / OAuth tokens are stored locally in `~/.codex-app-transfer/` (Unix 0600 + atomic write); the forwarding service only listens on `127.0.0.1` and does not hijack the system proxy. Apart from the feedback feature, this tool performs no third-party network access.
Some experimental providers (Grok Web / Gemini CLI OAuth / Antigravity OAuth) involve upstream TOS gray areas โ Grok Web reverse-proxies grok.com's Web backend, Gemini CLI OAuth uses the undocumented internal endpoint `cloudcode-pa.googleapis.com/v1internal` โ strictly limited to **personal use**, **must not** be deployed as a public service, **carries a real account-ban risk**, **users assume the risk**.
## Acknowledgements
> Overview list below. For the full **borrowing form / itemized list / corresponding file:line in this codebase**, see [ACKNOWLEDGEMENTS.md](./ACKNOWLEDGEMENTS.md).
- [`farion1231/cc-switch`](https://github.com/farion1231/cc-switch) โ provider switching paradigm inspiration
- [`lonr-6/cc-desktop-switch`](https://github.com/lonr-6/cc-desktop-switch) โ v1.x desktop shell skeleton + README structure reference
- [`BerriAI/litellm`](https://github.com/BerriAI/litellm) โ bidirectional protocol translation patterns
- [`tauri-apps/tauri`](https://tauri.app/) โ v2 + `cas://` architecture base
- [`openai/codex`](https://github.com/openai/codex) โ autocompact prompt base structure + compact protocol reverse-reference
- [`Piebald-AI/claude-code-system-prompts`](https://github.com/Piebald-AI/claude-code-system-prompts) โ autocompact anchor bullets
- [`7as0nch/mimo2codex`](https://github.com/7as0nch/mimo2codex) โ MiMo protocol reference
- [`router-for-me/CLIProxyAPI`](https://github.com/router-for-me/CLIProxyAPI) โ Gemini OAuth wire-level reference
- [`chenyme/grok2api`](https://github.com/chenyme/grok2api) โ Grok Web reverse-engineering reference + dynamic statsig algorithm + tool_calls flatten pattern
- [`galaxywk223/codex-plugin-unlocker`](https://github.com/galaxywk223/codex-plugin-unlocker) โ Codex Desktop Plugins unlock injection script (React Context-value walk-up + DOM enable + MutationObserver, MIT)
- [`QwenLM/qwen-code`](https://github.com/QwenLM/qwen-code) โ Alibaba's official Qwen CLI, Bailian Token Plan (`*.maas.aliyuncs.com`) hardcoded model registry pattern (`TOKEN_PLAN_MODELS` in `packages/cli/src/auth/providers/alibaba/tokenPlan.ts`, Apache-2.0)
- [`BigPizzaV3/CodexPlusPlus`](https://github.com/BigPizzaV3/CodexPlusPlus) โ Windows MSIX Codex Desktop CDP injection path (`IApplicationActivationManager` COM + AUMID auto-resolve + cmdline serialization, `codex_session_delete/launcher.py`, MIT)
- [`borawong/AiMaMi`](https://github.com/borawong/AiMaMi) โ Codex asset "managed-block" design: marker + parse/preview/apply/rollback/clear/history six operations + Protected mode (`src-tauri/src/core/custom_instructions.rs:1-130`, MIT) โ our `src-tauri/src/admin/services/managed_block.rs` borrows the algorithm; marker prefix changed to `cas:` for project isolation
### Community contributors
Contributors who improved this project via PRs (in reverse-chronological order of first commit; full list at [Contributors](https://github.com/Cmochance/codex-app-transfer/graphs/contributors)):
- [@lukegood](https://github.com/lukegood) โ MiniMax M2.x compatibility ([#47](https://github.com/Cmochance/codex-app-transfer/pull/47))
- [@cw881014](https://github.com/cw881014) โ early protocol-layer fixes, 3 PRs ([#1](https://github.com/Cmochance/codex-app-transfer/pull/1) / [#7](https://github.com/Cmochance/codex-app-transfer/pull/7) / [#12](https://github.com/Cmochance/codex-app-transfer/pull/12))
If you've submitted a PR and want to rename / add a link / remove yourself, open an issue.
## License
MIT License. Full text at [LICENSE.txt](LICENSE.txt).