Skip to main content

Local OpenAI and Anthropic-compatible chat proxy backed by the Codex CLI

Project description

Codex CLI Proxy

Overview

Codex CLI Proxy exposes a signed-in local Codex CLI as a localhost-only REST service. It accepts OpenAI Chat Completions and Anthropic Messages request formats and returns compatible response shapes.

Each request runs in its own empty temporary workspace, which is removed when the Codex turn finishes. The proxy therefore does not provide its own project directory as chat context. It supports text and base64-encoded image inputs.

Installation

Prerequisites:

  • Python 3.12 or later
  • uv
  • A signed-in local codex CLI

Install the project dependencies:

uv sync

Run

uv run codex-cli-proxy

The server listens on http://127.0.0.1:9000 by default.

Endpoints

Method Path Description
GET /healthz, /readyz Proxy and Codex executable health status.
GET /v1/models Models available through the signed-in Codex CLI.
POST /v1/chat/completions OpenAI Chat Completions-compatible chat endpoint.
POST /v1/messages Anthropic Messages-compatible chat endpoint.

Both chat endpoints support stream: true; output is returned as compatibility streaming after the Codex turn completes.

Inputs

  • Text content is supported.
  • Images are supported as base64 payloads:
    • OpenAI: image_url or input_image with a data:image/...;base64,... URL.
    • Anthropic: image with a base64 source block.
    • JPEG, PNG, GIF, and WebP are accepted; up to 10 images and 20 MB per image.
  • Audio and caller-supplied tools/functions are not supported by the local Codex CLI execution path and return a 400 error.

Use the standard model field to select a Codex model. If omitted, Codex uses its configured default. mode is accepted as a compatibility alias.

Configuration

Variable Default Purpose
CODEX_BIN codex Path or command for the local Codex CLI.
CODEX_SANDBOX read-only Codex sandbox mode for each request.
CODEX_TIMEOUT_SECONDS 900 Maximum duration of one Codex turn.
CODEX_MAX_CONCURRENCY 1 Maximum concurrent Codex turns.
HOST / PORT 127.0.0.1 / 9000 Server bind address and port.

Keep the service behind a trusted network boundary.

Examples

curl http://127.0.0.1:9000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"messages":[{"role":"user","content":"What is the capital of France?"}]}'

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codex_cli_proxy-0.0.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codex_cli_proxy-0.0.1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file codex_cli_proxy-0.0.1.tar.gz.

File metadata

  • Download URL: codex_cli_proxy-0.0.1.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for codex_cli_proxy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ba5e58ba0e0d7cbb5d01e86452d377df8e9113207f8b6daeb34aceebe8b1e07f
MD5 286b997301f6f1cbe7df3207404968ce
BLAKE2b-256 9ab88666d2d597412ad68836ba27866d1dbe3e843193df0cad98291984761fa0

See more details on using hashes here.

File details

Details for the file codex_cli_proxy-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for codex_cli_proxy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 daeae252d6ea5ebce0c5db046d1b7918ece433e003183bc7c592df38847157c0
MD5 bd1672a6522429f68aa1ca1b44ac6262
BLAKE2b-256 a78cda63423af0847b93f6cd3e18f6160d9d29b3174d4ee0d657d9b3aadc3065

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page