OpenCodex
Single Go binary — OpenAI-compatible API proxy + dashboard.
SQLite storage. Routes via Codex CLI binary (Cloudflare bypass native).
Quick Start
# 1. Start app-server daemon with real token
codex app-server daemon stop
CODEX_ACCESS_TOKEN="eyJhbG..." codex app-server daemon start
# 2. Configure
cp .env.example .env
# Edit .env → set DASHBOARD_PASSWORD
# 3. Run
./opencodex
# 4. Open http://localhost:8080
# Login with password from .env
Docker
# Build & run
docker compose up -d
# Or manual
docker build -t opencodex .
docker run -p 8080:8080 -p 9999:9999 --env-file .env opencodex
Dockerfile installs Codex CLI from https://chatgpt.com/codex/install.sh — no binary bundling needed.
Ports
| Port |
Service |
Auth |
:8080 |
Dashboard + management API |
DASHBOARD_PASSWORD from .env |
:9999 |
OpenAI-compatible proxy |
Bearer oc-xxxxx |
Features
- Dashboard password —
.env → DASHBOARD_PASSWORD
- Dual rate limits — Primary (5h window) + Secondary (7d window)
- Auto-refresh — Real rate limits every 30s via
account/rateLimits/read
- Active account — Shows which account is currently serving
- Auto-rotate — 10% limit → deactivate 5h → next account
- API key management — Generate, enable/disable, delete
Flags
| Flag |
Default |
Description |
-dashboard |
:8080 |
Dashboard port |
-proxy |
:9999 |
API proxy port |
-db |
opencodex.db |
SQLite database |
-min-pool |
3 |
Min WS connections |
-max-pool |
10 |
Max WS connections |
Environment
| Variable |
Description |
DASHBOARD_PASSWORD |
Dashboard login password |
CODEX_ACCESS_TOKEN |
Token for app-server daemon |
Structure
opencodex/
├── opencodex # Binary (15MB)
├── main.go # Server + handlers + pool
├── db.go # SQLite database layer
├── static/
│ └── index.html # Dashboard UI
├── .env # Configuration
├── .env.example
├── Dockerfile # Multi-stage + codex install
├── docker-compose.yml
├── go.mod / go.sum
└── README.md