📦james-6-23 / codex2api
← 返回首页
Codex2API 是一个基于 Go + Gin + React/Vite 的 Codex 反向代理与管理后台项目
#2api#codex🌐 codex2api-latest-vu8j.onrender.com📅 创建于 2026-03-24🔄 更新于 2026-10-27

📄 仓库 README

在 GitHub 查看 ↗
来自 GitHub 仓库自述文件 · 版权归原作者所有

Codex2API

English | 中文

Go Gin React Vite Database Cache API Docker

Turn a Codex account pool into an observable, schedulable, operations-ready OpenAI / Anthropic compatible gateway. Codex2API is not a thin forwarding proxy. It is a long-running Codex access hub: it exposes /v1/chat/completions, /v1/responses, /v1/messages, Images, Videos (Grok Imagine), and Models endpoints while managing Refresh Token / Access Token accounts, health scoring, dynamic concurrency, rate-limit recovery, usage tracking, and admin operations behind the scenes.

Run it as a full PostgreSQL + Redis production stack or as a single-container SQLite + in-memory cache deployment. Point Codex CLI, Claude Code, the OpenAI SDK, or any compatible client at one Base URL, then manage accounts, proxies, API keys, prompt filtering, image workflows, and runtime settings from the built-in dashboard.

One compatible gatewayOpenAI-style Chat Completions / Responses / Images, Anthropic Messages, prefixless compatibility routes, and native Codex Responses forwarding are all exposed through one service.
Account-pool schedulerSelection is driven by account status, health tier, scheduler score, dynamic concurrency, cooldown recovery, and recent usage so unhealthy accounts are avoided automatically. Supports round_robin and remaining_quota modes, with per-account credit billing flags.
Visual admin consoleThe embedded React / Vite dashboard covers account import and testing, API keys, proxy pools, image studio (text-to-image + image-to-image), prompt filtering, usage analytics, operations, scheduler board, and system settings.
Two deployment shapesUse PostgreSQL + Redis for production or SQLite + Memory for lightweight single-node deployments; Docker images, source builds, local development, and the interactive deploy script are ready to use. SQLite mode binds to 127.0.0.1 by default for security.
Billing and observabilityPer-account 5h/7d windowed USD cost tracking, credit quota support, API key usage tracking, OAuth PKCE token acquisition, prompt filtering, and a usage dashboard with request logs and trend charts.
Quality checkCompare selected accounts, models, and reasoning effort with an editable pelican-on-a-bicycle HTML/SVG animation challenge. Run up to three background tests across accounts, keep persistent test history, and review isolated animation previews, source, timing/token metrics, and HTML downloads.

Sponsors

ProxyLane 住宅代理:首单七折 CODEX2API30

ProxyLane 提供住宅代理,支持 HTTP / HTTPS / SOCKS5,提供中文界面及 USDT 付款。
免费 3GB 测试流量,限前 50 名,兑换码:CODEX2API3GB。
首次购买使用优惠码 CODEX2API30 享七折优惠。

RapidProxy 代理 IP:动态住宅 $0.55/GB 起,静态住宅 $5/IP/月

RapidProxy 为开发者和企业提供高性能代理 IP 服务,覆盖全球 200+ 国家和地区的 9000 万+ 住宅 IP,支持智能轮换、精准地理定位、流量永不过期及高并发连接。
广泛适用于网页采集、AI 数据获取、SEO 监控和电商分析,支持 HTTP / HTTPS / SOCKS5 协议。
支持免费试用,九折优惠码:RAPID10

IPWO 住宅代理

IPWO 提供覆盖 195+ 地区的住宅代理 IP 资源,支持动态、静态及不限量住宅代理方案。
可用于区域化访问测试、网页数据采集和跨境业务等场景,支持 HTTP / HTTPS / SOCKS5 协议。
支持免费测试,九折优惠码:0203


Live Demo

The demo is only for trying the admin dashboard and basic UI flows. Do not upload real Refresh Tokens, Access Tokens, API keys, or any other sensitive data.


Screenshots

Screenshots use demo data. The actual dashboard depends on your account pool, request logs, and runtime environment.

CodexProxy Dashboard

More admin dashboard screenshots | Accounts | Dashboard Trends | | --- | --- | | ![Accounts](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/accounts.png) | ![Dashboard Trends](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/dashboard-trends.png) | | Image Studio | Prompt Filter | | --- | --- | | ![Image Studio](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/image-studio.png) | ![Prompt Filter](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/prompt-filter.png) | | Operations | Usage | | --- | --- | | ![Operations](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/operations.png) | ![Usage](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/usage.png) | | Usage Guide | API Reference | | --- | --- | | ![Usage Guide](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/guide.png) | ![API Reference](https://raw.githubusercontent.com/james-6-23/codex2api/HEAD/docs/screenshots/api-reference.png) |

Contents


Quick Start

For detailed deployment instructions, see DEPLOYMENT.md.

Deployment Modes

Mode File Use Case
Docker image deployment docker-compose.yml Recommended for servers and test environments using the prebuilt image
Local source container build docker-compose.local.yml Full container verification after local source changes
SQLite lightweight deployment docker-compose.sqlite.yml Single-node deployment without PostgreSQL or Redis
SQLite local source build docker-compose.sqlite.local.yml Local source verification for the lightweight SQLite mode
Local development go run . + npm run dev Backend and frontend development

Commands

Standard image mode:

git clone https://github.com/james-6-23/codex2api.git
cd codex2api
cp .env.example .env
docker compose pull
docker compose up -d
docker compose logs -f codex2api

Standard local build mode:

cp .env.example .env
docker compose -f docker-compose.local.yml up -d --build
docker compose -f docker-compose.local.yml logs -f codex2api

SQLite image mode:

cp .env.sqlite.example .env
docker compose -f docker-compose.sqlite.yml pull
docker compose -f docker-compose.sqlite.yml up -d
docker compose -f docker-compose.sqlite.yml logs -f codex2api

SQLite local build mode:

cp .env.sqlite.example .env
docker compose -f docker-compose.sqlite.local.yml up -d --build
docker compose -f docker-compose.sqlite.local.yml logs -f codex2api

After startup:

  • Admin dashboard: http://localhost:8080/admin/
  • Health check: http://localhost:8080/health

Notes:

  • Standard and SQLite modes both read .env.
  • Before switching deployment modes, replace .env with the matching example file.
  • The SQLite lightweight mode runs a single codex2api container and stores data at /data/codex2api.db.
  • SQLite compose files bind to 127.0.0.1 by default for security. To expose the SQLite service on all interfaces, set BIND_HOST=0.0.0.0 in .env or override the port binding in the compose file. The standard compose files bind to 0.0.0.0 by default.
  • The image studio library is stored under /data/images; uploaded admin backgrounds are stored under /data/backgrounds; Docker configurations persist /data.
  • docker compose down does not delete named volumes by default. Data is removed only by commands such as docker compose down -v, docker volume rm, or docker volume prune.

Antigravity channel (experimental API Key path)

Antigravity accounts are managed as a dedicated Google channel with browser/imported OAuth credentials and an optional Google API Key credential shape. Admin tooling includes secret-bearing JSON/ZIP credential export plus sanitized state, explicit control-plane sync, and bounded capability probing. OAuth reques

📈 近 7 天 Star 趋势

每日新增 Star(柱)与累计 Star(线)· 数据来自 GitHub

🏆 排名变化趋势

在各榜单中的排名历史(数字越小越靠前)

📋 历史上榜记录

每次快照的详细数据
日期 榜单 排名 周期新增 总 STAR