codex-bridge  by wujfeng712-ui

Local proxy for unified AI CLI access

Created 2 months ago
255 stars

Top 98.8% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a zero-dependency local proxy that enables the Codex CLI to interact with DeepSeek, Xiaomi MiMo, and OpenAI models. It addresses the challenge of integrating diverse LLM APIs with the Codex CLI's specific Responses API by offering bi-directional protocol translation. This allows users to leverage a wider range of powerful models through a single, unified interface without modifying the Codex client, benefiting developers and power users seeking flexibility in their AI tooling.

How It Works

The codex-bridge acts as an intermediary, translating requests between the Codex CLI's Responses API and the Chat Completions API used by DeepSeek and MiMo, while also supporting OpenAI's Responses API. It intelligently routes requests based on the model name, supporting features like streaming Server-Sent Events (SSE), tool call round-trips, and mapping Codex's reasoning effort levels to upstream provider capabilities. Its architecture prioritizes flexibility and compatibility, ensuring seamless integration.

Quick Start & Requirements

  • Primary install / run command:
    1. git clone https://github.com/wujfeng712-ui/codex-bridge.git
    2. cd codex-bridge
    3. cp env.example .env
    4. Edit .env with necessary API keys (e.g., PROXY_AUTH_KEY, DEEPSEEK_API_KEY).
    5. node --env-file=.env proxy.mjs
    6. Configure Codex CLI (~/.codex/config.toml) to use http://127.0.0.1:4000/v1 as the base_url with model_provider = "local_proxy".
  • Non-default prerequisites and dependencies: Node.js 18+, macOS / Linux / Windows, and at least one upstream API key (DeepSeek, MiMo, or OpenAI).
  • Links: GitHub repository: https://github.com/wujfeng712-ui/codex-bridge.git

Highlighted Details

  • Multi-provider routing for DeepSeek, MiMo, and OpenAI, auto-selected by model name.
  • Bi-directional protocol translation (Responses API ↔ Chat Completions) with streaming SSE support.
  • Per-provider reasoning effort translation and thinking-mode tool-call round-trip caching.
  • Inbound authentication gate (PROXY_AUTH_KEY, PROXY_KEYS) with optional per-key provider locking.
  • Built-in web_fetch tool for handling URL-heavy conversations and bypassing sandbox restrictions.
  • Single-file, zero-dependency implementation (proxy.mjs ~2000 lines).

Maintenance & Community

The provided README does not contain specific details regarding maintainers, community channels (e.g., Discord, Slack), sponsorships, or a public roadmap.

Licensing & Compatibility

  • License type: MIT License.
  • Compatibility notes: The MIT license is permissive and generally compatible with commercial use and linking within closed-source projects.

Limitations & Caveats

The proxy requires Node.js version 18 or higher; older versions require alternative startup methods. While robust, users must configure upstream API keys and potentially adjust timeouts (UPSTREAM_TIMEOUT_MS) for slow provider responses. Troubleshooting guidance is provided for common issues like port conflicts and authentication errors.

Health Check
Last Commit

2 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
2
Star History
32 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.