Protocol conversion, intelligent Key scheduling, and an observable AI gateway.
多协议转换、智能 Key 调度与可观测 AI 网关
About ·
Highlights ·
Quick Start ·
Evolution ·
Documentation
English Full README · 中文完整版
About
OpenAPI Multi-Key Proxy is a local, transparent gateway for AI coding clients and API applications. It accepts OpenAI Responses, OpenAI Chat Completions, and Anthropic Messages traffic, then routes or converts requests to heterogeneous upstream providers without forcing every client to speak the same protocol.
It is designed for operators who need more than a configuration switcher: multiple API Keys, health-aware scheduling, cooldown and recovery, protocol adaptation, model mapping, queues, dashboards, metrics, and safe process supervision in one small Node.js service.
Highlights
Capability
What it provides
3×3 protocol matrix
Responses ↔ Chat ↔ Messages conversion, including streaming terminal-state protection
Model-aware routing
Runtime upstream model probing and nearest compatible model adaptation
Intelligent Key scheduling
Reset-period priority, health score, cooldown, latency, round-robin, groups, and direct #N routing
Isolated Key pools for daily, advanced, and low-cost model tiers
Architecture
Quick Start
1. Install
bash
git clone https://github.com/aipayim/codex-proxy.git
cd codex-proxy
bash install.sh
2. Configure Keys
Edit the local keys.json created by the installer. Runtime configuration and credentials are intentionally local files and are not part of the public repository.
Open http://localhost:3456/ in a browser. The dashboard defaults to Chinese and can switch to English from its language control; the browser remembers the selection.
4. Connect a Client
Point an OpenAI-compatible client at http://localhost:3456/v1. Add groups such as B=3457 or C=3458 when different Key pools should serve different model tiers.
Evolution
This timeline records every tagged release from v2.26.0 through v2.60.0. Each entry intentionally keeps an English and Chinese explanation together so the public landing page remains English-first without losing release context for Chinese readers.
English: Fixed the broken tool-call chain when /v1/messages (Claude Code CLI) forwards to a Chat upstream: the request-direction converter now preserves full tool context by mapping tool_use → assistant tool_calls, tool_result → role:"tool" messages, removing the stray empty user message, and mapping tool_choice correctly (any → "required", tool → function), so multi-turn tool loops never break.
English: Added unsupported_path error classification: when an upstream rejects a request because the path/protocol is unsupported (e.g. anytokens' does not allow /v1/messages dispatch), the error is returned to the caller unchanged but is never written to the Key's failCode, so the key is not cooled down, locked, or judged invalid — other tasks sharing the key (local codex, LAN devices) keep working unaffected.
中文: 新增 unsupported_path 错误分类:上游因路径/协议不支持而拒绝请求时(如 anytokens 的 does not allow /v1/messages dispatch),错误如实回传调用方,但不写入 Key 的 failCode,不冷却、不锁定、不判失效——共享该 Key 的其他任务(本机 codex、局域网设备)不受影响。
English: Major overhaul of Responses SSE streaming lifecycle: added proper output_item.added / output_item.done message item lifecycle with openMessageItem / closeMessageItem, persistent outputItems tracking with correct output_index assignment, _itemClosed flag to prevent duplicate close events, toolCallNames / toolOutputIndices for tool call tracking, and item_id / output_index / content_index fields in all text delta events. Bare path normalization removed; clients should use standard /v1/... paths.
English: Added network mode setting (localhost / LAN) and LAN API key protection, allowing other devices on the same LAN to use this proxy for AI requests. Dashboard settings panel includes mode selection and key input; saving automatically restarts all port groups to apply the new bind address. LAN clients authenticate via Bearer token constant-time comparison. Local requests always bypass the LAN key.
中文: 新增网络模式设置(仅本机 / 局域网可用)与 LAN 连接密码保护,允许同一局域网内其他设备通过本机代理访问 AI 模型。Dashboard 设置面板提供网络模式切换和密码输入,保存后自动重启所有端口组以切换监听地址(localhost → 0.0.0.0)。局域网客户端通过 Bearer token 恒时比较进行认证,本机请求不受密码限制。
English: Restored localized Dashboard labels for batch Key actions, durations, task insight, database maintenance, group controls, and resume-project controls in both Chinese and English.
English: Corrected the published-release wording and replaced the broken Release-asset link to build-release.js with a source-repository documentation link.
English: Added Chinese/English Dashboard resources, a top-right language switch, and browser-local persistence of the selected language. Chinese remains the default and changing the language does not require a proxy restart.