Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

codex-proxy

> 编程语言
Open source

API proxy tool

99 stars0 likes5 views
WebsiteGitHub

About

API proxy tool

OpenAPI Multi-Key Proxy

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
️ Resilience controls Quota classification, transient capacity backoff, request queues, auto-lock, auto-recovery, and no-progress watchdogs
Operations dashboard Key cards, trends, logs, events, cost estimates, concurrency ticker, WebSocket updates, and Prometheus metrics
Task Insight Optional local task-session aggregation, tool/file signals, usage, cost, and LLM distillation
Safe administration In-memory Dashboard auth, authenticated management APIs, graceful restart, drain/cancel/force controls
Multi-port groups 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.

3. Start and Open the Dashboard

bash
bash start-proxy.sh
curl http://localhost:3456/__status

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.

v2.60.0 Messages→Chat tool-call chain fix (Claude Code CLI)

  • 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.
  • 中文: 修复 /v1/messages(Claude Code CLI)→ Chat 上游时工具调用链断裂:请求方向转换器现完整保留工具上下文,tool_use → assistant tool_calls、tool_result → role:"tool" 消息,移除残留空白 user 消息,并正确映射 tool_choice(any → "required"、tool → function),多轮工具循环不再断裂。
  • Full changelog

v2.59.0 ️ unsupported_path error classification protects shared keys

  • 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、局域网设备)不受影响。
  • Full changelog

v2.58.0 Responses SSE streaming protocol compliance

  • 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.
  • 中文: 大幅改进 Responses SSE 流式生命周期:新增 output_item.added / output_item.done 消息项生命周期(openMessageItem / closeMessageItem)、持久 outputItems 追踪与正确 output_index 分配、_itemClosed 标志防止重复关闭、toolCallNames / toolOutputIndices 工具调用追踪、所有文本 delta 事件包含 item_id / output_index / content_index 字段。移除裸路径归一化,客户端应使用标准 /v1/... 路径。
  • Full changelog

v2.57.0 LAN access mode

  • 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 恒时比较进行认证,本机请求不受密码限制。
  • Full changelog

v2.56.0 ️ Safer update dialog and Release notes

  • English: Added conditional safe-upgrade guidance, explicit sensitive-file backup warnings, and escaped restricted Markdown rendering for GitHub Release notes in the Dashboard.
  • 中文: 新增按版本状态显示的安全升级指引、敏感文件备份警告,并为 Dashboard GitHub Release 说明加入 HTML 转义的受限 Markdown 渲染。
  • Full changelog

v2.55.2 Dashboard localization fix

  • 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.
  • 中文: 恢复批量 Key 操作、时长、任务洞察、数据库维护、分组控制和恢复项目控制等 Dashboard 文案的中英文国际化显示。
  • Full changelog

v2.55.1 README release-status and link fix

  • English: Corrected the published-release wording and replaced the broken Release-asset link to build-release.js with a source-repository documentation link.
  • 中文: 修正已发布版本状态说明,并将 Release 资产中不存在的 build-release.js 链接改为源码仓库文档链接。
  • Full changelog

v2.55.0 Dashboard bilingual interface

  • 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.
  • 中文: Dashboard 新增中文/English 双语资源、右上角语言切换按钮和浏览器本地语言记忆。默认仍为中文,切换语言不需要重启代理。
  • Full changelog

v2.54.0 Stop-reason tracking and cost trends

  • English: Added end-to-end stopReason tracking for truncated Chat and Responses streams, plus the cost-trend fix that restores correct bar scaling.
  • 中文: 新增 Chat/Responses 截断流的 stopReason 全链路跟踪,并修复费用趋势图柱状图比例与显示问题。
  • Full changelog

v2.53.1 Unified request/actual model display

  • English: Unified request-model and actual-upstream-model labels across logs, trends, model statistics, and cost estimation.
  • 中文: 统一日志、趋势图、模型统计和费用估算中的请求模型与实际模型显示口径。

v2.53.0 Full protocol matrix

  • English: Added the 3×3 protocol adaptation matrix, dynamic upstream protocol discovery, and protocol-aware Chat fallback.
  • 中文: 新增 3×3 全协议适配矩阵、上游协议动态探测及协议感知的 Chat 回退。

v2.52.0 Model adaptation

  • English: Added upstream capability probing and nearest compatible model-name mapping.
  • 中文: 新增上游模型能力探测与模型名就近映射,自动适配客户端与上游模型差异。

v2.51.1 Discussion form cleanup

  • English: Fixed stale fields remaining in the GitHub Discussions session-flow form.
  • 中文: 修复 GitHub 会话流发起表单残留字段问题。

v2.51.0 GitHub Discussions session flow

  • English: Added Dashboard browsing, caching, posting, replying, and fallback handling for repository Discussions.
  • 中文: 新增 Dashboard GitHub Discussions 浏览、缓存、发帖、回复及降级处理能力。

v2.50.1 Self-contained Release dependency

  • English: Bundled the ws dependency into Release assets so an extracted package can run immediately.
  • 中文: Release 资产内置 ws 依赖,解压后即可运行。

v2.50.0 WebSocket backpressure and OOM governance

  • English: Throttled and merged Dashboard snapshots, capped WebSocket buffers, and added reconnect recovery.
  • 中文: 新增 Dashboard 状态推送节流合并、WebSocket 发送背压上限和自动重连恢复,治理后台标签页 OOM。

v2.49.0 Quota-aware recovery

  • English: Exempted quota-exhausted Keys from false auto-recovery and hardened 429 classification.
  • 中文: 自动恢复跳过配额耗尽 Key,并加固 429/配额错误分类,避免误恢复后再次失败。

v2.48.0 ⏱️ No-progress stream watchdog

  • English: Added a no-progress timeout for accepted coding streams and fixed quota-429 queue behavior.
  • 中文: 新增编码流无进展看门狗,并修复配额 429 导致的队列风暴与长期挂起。

v2.47.0 ♻️ Controlled autoResume stall restart

  • English: Added verified runner-stall detection and one controlled restart per idle period.
  • 中文: 新增恢复 runner 停滞检测、身份校验及每个闲置周期一次的受控重启。

v2.46.0 ️ SQLite log maintenance

  • English: Added optional Codex SQLite maintenance with bounded cleanup, validation, and busy-database yielding.
  • 中文: 新增可选 Codex SQLite 日志维护,支持结构校验、限量清理和数据库忙时让步。

v2.45.1 ⚡ SSE capacity backoff

  • English: Treated explicit model_at_capacity SSE errors as transient capacity backoff instead of hard Key failure.
  • 中文: 将 SSE 中明确的 model_at_capacity 按瞬时容量退避处理,不再误判为 Key 硬失败。

v2.45.0 Stream terminal consistency

  • English: Added consistent terminal-state protection for Responses, Messages, and bidirectional conversions.
  • 中文: 统一 Responses、Messages 及双向转换流的终态、EOF、错误和超时保护。

v2.44.0 Task Insight

  • English: Added optional task-session aggregation, tool/file signals, usage tracking, reports, and LLM distillation.
  • 中文: 新增可选任务洞察,支持任务会话、工具/文件信号、用量、报告和 LLM 蒸馏。

v2.43.0 Safe autoResume leases

  • English: Replaced directory scanning with verifiable runner leases and added deterministic fixed-session resume.
  • 中文: 用可验证 runner 租约替代目录扫描,并新增固定会话模式,避免误杀和恢复错会话。

v2.42.0 Off-peak scheduling preview

  • English: Added live preview support for Key timezone and off-peak scheduling windows.
  • 中文: 新增 Key 时区与错峰时间窗口的面板实时预览。

v2.41.0 ️ Source release baseline

  • English: Added release-baseline.txt provenance detection for source installations without build metadata.
  • 中文: 新增 release-baseline.txt,使无构建元数据的源码安装也能识别版本基线。

v2.40.0 ️ Capacity resilience and TTY recovery

  • English: Added transient capacity backoff, bounded queue waiting, PTY-backed autoResume, and safer retry behavior.
  • 中文: 新增容量瞬态退避、队列等待上限、PTY 闲置恢复及更安全的重试行为。

v2.39.1 WSL launcher path fix

  • English: Converted WSL paths to Windows form before launching v

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言