No description
  • Go 78.5%
  • HTML 20.2%
  • Dockerfile 1.3%
Find a file
2026-07-04 08:59:39 +00:00
static fix 2026-07-03 13:51:29 +00:00
.env.example fix 2026-07-03 14:26:18 +00:00
.gitignore alamak 2026-07-03 14:09:16 +00:00
db.go fix 2026-07-04 07:32:19 +00:00
docker-compose.yml fix 2026-07-03 14:26:18 +00:00
Dockerfile fix 2026-07-03 14:41:28 +00:00
go.mod fix 2026-07-03 14:17:56 +00:00
go.sum fix 2026-07-03 14:17:56 +00:00
main.go fix 2026-07-04 08:59:39 +00:00
opencodex fix 2026-07-04 08:59:39 +00:00
opencodex.db fix 2026-07-04 08:59:39 +00:00
opencodex.db-shm fix 2026-07-04 08:59:39 +00:00
opencodex.db-wal fix 2026-07-04 08:59:39 +00:00
README.md fix 2026-07-03 14:17:56 +00:00

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.envDASHBOARD_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