# codex-lb

> Open-source load balancer and proxy for multiple ChatGPT accounts with usage tracking, API key management, and an OpenAI-compatible dashboard.

codex-lb is an open-source Python project that lets you pool multiple ChatGPT accounts behind a single OpenAI-compatible proxy endpoint, distributing requests across accounts while tracking per-account token usage, costs, and 28-day trends. Built with FastAPI and SQLAlchemy, it ships with a web dashboard, API key management, and support for Docker and Kubernetes deployments. The project is maintained by Soju06 on GitHub under the MIT License and has attracted a large community of contributors.

## What It Is

codex-lb sits between your AI coding tools and ChatGPT, acting as a load balancer and reverse proxy. Instead of hitting a single ChatGPT account and running into rate limits, you register multiple accounts and codex-lb routes requests across them automatically. It exposes an OpenAI-compatible API surface, so any client that speaks the OpenAI wire protocol — Codex CLI, OpenCode, OpenClaw, Hermes Agent, or the OpenAI Python SDK — can point at it without modification.

## Core Features

- **Account pooling** — load balance across multiple ChatGPT accounts with configurable routing strategies
- **Usage tracking** — per-account token counts, cost estimates, and 28-day trend charts in the dashboard
- **API key management** — create per-key rate limits scoped by token count, cost, time window, or model
- **Dashboard authentication** — password login with optional TOTP two-factor authentication
- **Auto model sync** — available models are fetched automatically from upstream ChatGPT
- **Live Voice support** — dedicated docs section covering real-time voice routing
- **Conversation management** — dashboard view and conversation APIs for browsing history

## Deployment Model

codex-lb is designed to run as a self-hosted service. The recommended path is Docker:

```
docker volume create codex-lb-data
docker run -d --name codex-lb -p 2455:2455 -p 1455:1455 \
  -v codex-lb-data:/var/lib/codex-lb ghcr.io/soju06/codex-lb:latest
```

It can also be installed via `uvx codex-lb` for local use. Kubernetes deployment is documented separately. The dashboard runs on port 2455; a one-time bootstrap token is required for first-time remote access. Data is stored in SQLite by default, with optional PostgreSQL support via the `CODEX_LB_DATABASE_URL` environment variable. Configuration is handled through environment variables prefixed with `CODEX_LB_` or a `.env.local` file.

## Client Compatibility

codex-lb exposes two main endpoint paths:
- `/backend-api/codex` — for Codex CLI and IDE extensions, using the `responses` wire API with WebSocket support
- `/v1` — standard OpenAI-compatible endpoint for OpenCode, OpenClaw, Hermes Agent, and the Python SDK

The project's documentation includes per-client setup guides with exact configuration snippets, including the `model_providers` TOML block needed for Codex CLI since the May 2026 lowercase provider name change.

## Update: v1.22.0

The latest release is v1.22.0, published on July 24, 2026. The repository shows active development with the last push on August 8, 2026, and over 100 open issues reflecting ongoing community engagement. The project is spec-driven: normative behavior is defined in OpenSpec capability files in the repository, with documentation pages linking back to the governing specs. The contributor list spans more than 80 individuals, reflecting broad community involvement since the repository was created in January 2026.

## Features
- Multi-account ChatGPT load balancing
- Per-account usage tracking (tokens, cost, 28-day trends)
- API key management with per-key rate limits
- OpenAI-compatible proxy endpoints
- Web dashboard with dark mode
- Dashboard authentication with password and optional TOTP
- Auto model sync from upstream ChatGPT
- Live Voice routing support
- Conversation history dashboard and APIs
- SQLite and PostgreSQL database backends
- Docker and Kubernetes deployment support
- Configurable routing strategies
- Remote access with bootstrap token
- Environment variable and .env.local configuration

## Integrations
Codex CLI, OpenCode, OpenClaw, Hermes Agent, OpenAI Python SDK, Docker, Kubernetes, PostgreSQL, SQLite, FastAPI, SQLAlchemy

## Platforms
WEB, API, CLI

## Pricing
Open Source

## Version
v1.22.0

## Links
- Website: https://soju06.github.io/codex-lb/
- Documentation: https://soju06.github.io/codex-lb/
- Repository: https://github.com/Soju06/codex-lb
- EveryDev.ai: https://www.everydev.ai/tools/codex-lb
