Proxy CodeBuddy with OpenAI-compatible and Anthropic-compatible APIs for Codex, Claude Code, and standard SDK clients.
CodeBuddy2API is a self-hosted gateway with a web-based admin console for managing credentials, access keys, usage, account status, debug traces, and runtime settings.
This project is a substantial refactor of Sliverkiss/CodeBuddy2api, with a redesigned admin console, multi-protocol API support, and flexible storage backends.
The following command starts a single-instance deployment with SQLite:
docker run -d \
--name codebuddy2api \
--restart unless-stopped \
-p 8001:8001 \
-v codebuddy2api-data:/app/.codebuddy_data \
-e CODEBUDDY_STORAGE_BACKEND=sqlite \
-e CODEBUDDY_STORAGE_ENCRYPTION_KEY='replace-with-a-long-random-secret' \
-e CODEBUDDY_STORAGE_IMPORT_LEGACY_FILES=false \
ghcr.io/orangeboychen/codebuddy2api:latestOpen http://127.0.0.1:8001/dashboard, complete CodeBuddy authentication or add a credential manually, then create an access key for your clients.
The gateway exposes these endpoints under /v1:
POST /v1/chat/completions— OpenAI Chat CompletionsPOST /v1/responses— OpenAI ResponsesPOST /v1/messages— Anthropic MessagesGET /v1/models— models available to the requesting access key
Authenticate inference requests with either header:
Authorization: Bearer <access-key>x-api-key: <access-key>Example OpenAI-compatible request:
curl http://127.0.0.1:8001/v1/chat/completions \
-H 'Authorization: Bearer <access-key>' \
-H 'Content-Type: application/json' \
-d '{
"model": "<model>",
"messages": [{"role": "user", "content": "Hello"}]
}'file— zero-configuration storage for a single instancesqlite— encrypted SQLite storage for a single instancepg— PostgreSQL storage for multiple instances
Database backends require CODEBUDDY_STORAGE_ENCRYPTION_KEY. Set DATABASE_URL for PostgreSQL or CODEBUDDY_STORAGE_SQLITE_PATH for SQLite.
See LICENSE.
