a2o
Lightweight Anthropic-to-OpenAI API proxy. Run Claude Code with any OpenAI-compatible backend.
Features
- Translates Anthropic
/v1/messagesrequests to OpenAI/v1/chat/completionsformat - Streaming (SSE) and non-streaming support
- Tool calling (function calling) with full round-trip conversion
- Extended thinking / reasoning content
- Image content (base64 and URL)
- Multi-worker deployment with connection pooling
- Minimal dependencies: FastAPI + httpx
Installation
pip install ant2oai
Or with uv:
uv pip install ant2oai
Quick Start
Start the proxy pointing to any OpenAI-compatible endpoint:
a2o --upstream http://your-openai-endpoint/v1/chat/completions --model your-model
Then configure Claude Code to use the proxy:
export ANTHROPIC_BASE_URL=http://127.0.0.1:3578
export ANTHROPIC_API_KEY=any-string # passed through to upstream
claude
Usage
usage: a2o [-h] [--upstream UPSTREAM] [--model MODEL] [--host HOST]
[--port PORT] [--timeout TIMEOUT] [--debug]
[--workers WORKERS] [--max-connections MAX_CONNECTIONS]
[--max-connections-per-host MAX_CONNECTIONS_PER_HOST]
options:
--upstream UPSTREAM OpenAI-compatible base URL
--model MODEL Default model name override
--host HOST Bind host (default: 127.0.0.1)
--port PORT Bind port (default: 3578)
--timeout TIMEOUT Request timeout in seconds (default: 300)
--debug Enable debug logging
--workers WORKERS Number of worker processes (default: 1)
--max-connections N Max upstream connections (default: 1000)
--max-connections-per-host N
Max per-host connections (default: 500)
Production Deployment
For high-throughput scenarios:
a2o \
--upstream http://your-endpoint/v1/chat/completions \
--model your-model \
--host 0.0.0.0 \
--port 3578 \
--workers 4 \
--max-connections 2000
How It Works
Claude Code ──► a2o proxy ──► OpenAI-compatible backend
(Anthropic API) (converts) (OpenAI API)
- Claude Code sends requests in Anthropic format to the proxy
- The proxy converts requests to OpenAI chat completion format
- The upstream response is converted back to Anthropic format
- Claude Code receives a native-looking Anthropic response
Conversion Details
| Anthropic | OpenAI |
|---|---|
system (string/blocks) |
First system message |
messages[].content blocks |
messages[].content parts |
tool_use content blocks |
tool_calls on assistant messages |
tool_result content blocks |
tool role messages |
thinking blocks |
reasoning_content field |
max_tokens |
max_tokens |
stop_sequences |
stop |
| Streaming SSE events | Streaming SSE chunks |
Development
# Clone and install
git clone https://github.com/WqyJh/a2o.git
cd a2o
uv sync --all-extras
# Run tests
uv run pytest
# Lint
uv run ruff check .
uv run ruff format --check .
License
Metadata
Release files for ant2oai 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ant2oai-0.1.6.tar.gz | 26.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ant2oai-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.9 kB
Release files / ant2oai-0.1.6.tar.gz
| Download URL | ant2oai-0.1.6.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb54699c29a2e47ec165a676b280e065ca3c6a8a602d1ef8f2fc11d63f46513b
|
|
BLAKE2b-256 checksum How to use checksums |
3c5306908d358401058b8da382c1b4df77cb6010a9aec7659fa323a3d5b45211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logRelease files / ant2oai-0.1.6-py3-none-any.whl
| Download URL | ant2oai-0.1.6-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
996688a57cc06e7cd816a2010b45cbc97ec522905e505cb9e92f0d0093bd070a
|
|
BLAKE2b-256 checksum How to use checksums |
f020fdcb7a68f0214e7411a056c63cf1c1fc6f842ceed4019535ee257ab88e0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency log