🌉 Bridge OpenAI tools to Claude Code SDK, Codex CLI, or OpenRouter — use your subscriptions anywhere 🔌
agentbridge is a local API bridge for developers who want to connect OpenAI-compatible apps to Claude Code, Codex, or OpenRouter. Run one server, choose a backend with a namespaced model ID, and point existing Chat Completions clients at http://localhost:8082/api/v1.
It supports streaming and non-streaming responses, image and PDF inputs where the backend accepts them, OpenAI-style tool calls, a live dashboard, and local JSON session logs.
Legal notice: agentbridge can use Claude Code SDK and Codex CLI access through your local subscriptions, and can forward requests to OpenRouter when configured. You are responsible for determining whether your use complies with each service's terms. Use it conservatively and at your own risk.
Install
uv tool install agentbridge-py
agentbridge
Open the dashboard, try the built-in chat, or use http://localhost:8082/api/v1 as an OpenAI-compatible base URL.
Authenticate at least one backend before sending requests:
claude login # for claudecode/* models
codex login # for codex/* models
For OpenRouter, start agentbridge once and add OPENROUTER_API_KEY to ~/.config/agentbridge/.env.
To work on the repository itself:
git clone https://github.com/tsilva/agentbridge.git
cd agentbridge
uv sync --extra test
uv run agentbridge
Usage
curl http://localhost:8082/api/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"claudecode/sonnet","messages":[{"role":"user","content":"Hello!"}]}'
Every request requires one of these model namespaces:
claudecode/<model>—opus,sonnet,haiku, or a namespaced Claude slug containing one of those names.codex/<model>— passed directly to Codex CLI.gpt-5.6-solandgpt-5.5default to high reasoning effort unless the request overrides it.openrouter/<provider>/<model>— passed to the official OpenRouter Python SDK.
OpenAI SDKs may use any placeholder API key:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8082/api/v1", api_key="not-needed")
response = client.chat.completions.create(
model="codex/gpt-5.6-sol",
reasoning_effort="high",
messages=[{"role": "user", "content": "Hello from Codex!"}],
)
print(response.choices[0].message.content)
Commands
agentbridge # start on 127.0.0.1:8082
agentbridge --port 8083 # choose another port
agentbridge --workers 3 # set Claude pool and Codex concurrency to 3
agentbridge --version # print package and git version
uv run --frozen --extra test pytest -q # run tests
uv run --frozen --extra test ruff check agentbridge tests # lint Python
uv lock --check # verify the lockfile
uv build # build wheel and source distribution
Notes
- Python 3.12+ and at least one authenticated backend are required.
- Public routes are
POST /api/v1/chat/completions,GET /api/v1/models,GET /health,/dashboard, and/dashboard/chat. PORT,POOL_SIZE,CLAUDE_TIMEOUT,CODEX_TIMEOUT, andOPENROUTER_TIMEOUTcontrol the server port, pool size, and provider timeouts.--workersoverridesPOOL_SIZE.AGENTBRIDGE_CONFIG_DIRmoves the user configuration directory.LOG_DIRmoves session logs, andMAX_LOG_FILESlimits retained JSON logs.OPENROUTER_API_KEY,OPENROUTER_SITE_URL, andOPENROUTER_APP_NAMEconfigure OpenRouter requests. Process environment variables take precedence over the user.envfile.- Claude clients are created lazily, reused by model, and capped by the worker count. Claude sessions do not load filesystem settings and run with built-in tools disabled.
- Codex runs one ephemeral
codex execprocess per request in a temporary directory with read-only sandboxing, no approvals, and project rules ignored. - Claude and Codex function calls are represented through prompted JSON; OpenRouter tool calls pass through its SDK. Session logs and extracted image or PDF attachments are saved under
~/.config/agentbridge/logs/sessionsby default.
Publishing
Releases use the Release GitHub Actions workflow and PyPI Trusted Publishing for the agentbridge-py project. The publisher is scoped to owner tsilva, repository agentbridge, workflow release.yml, and environment pypi; no PyPI API token is required.
Architecture
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentbridge_py-0.1.9.tar.gz.
File metadata
- Download URL: agentbridge_py-0.1.9.tar.gz
- Upload date:
- Size: 10.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b70b02d18669a738e9f85617886512ae2c5c28baf752a701015c5f92f370849
|
|
| MD5 |
e144d6b44fbc85b0e26a28de0ffe6fcd
|
|
| BLAKE2b-256 |
a5ad01974e8d1726e4ab34277cca875b77a67f76abb81b8b21e5688697490e45
|
Provenance
The following attestation bundles were made for agentbridge_py-0.1.9.tar.gz:
Publisher:
release.yml on tsilva/agentbridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentbridge_py-0.1.9.tar.gz -
Subject digest:
6b70b02d18669a738e9f85617886512ae2c5c28baf752a701015c5f92f370849 - Sigstore transparency entry: 2393216004
- Sigstore integration time:
-
Permalink:
tsilva/agentbridge@4ce263c9476d226312ba6d40d15302d8a4c2c99e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tsilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4ce263c9476d226312ba6d40d15302d8a4c2c99e -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentbridge_py-0.1.9-py3-none-any.whl.
File metadata
- Download URL: agentbridge_py-0.1.9-py3-none-any.whl
- Upload date:
- Size: 55.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12d7e23b38e468d44581a8d8e2bf9b1746ee5089bf08d8c1b1c4dfaa8f61cab4
|
|
| MD5 |
1ec7b84c39792eb25d5e9aabec2032fa
|
|
| BLAKE2b-256 |
540450e84a628ecd24efcda9ca26c9ed3549a9e38f0f425545324ed9888963ef
|
Provenance
The following attestation bundles were made for agentbridge_py-0.1.9-py3-none-any.whl:
Publisher:
release.yml on tsilva/agentbridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentbridge_py-0.1.9-py3-none-any.whl -
Subject digest:
12d7e23b38e468d44581a8d8e2bf9b1746ee5089bf08d8c1b1c4dfaa8f61cab4 - Sigstore transparency entry: 2393216194
- Sigstore integration time:
-
Permalink:
tsilva/agentbridge@4ce263c9476d226312ba6d40d15302d8a4c2c99e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tsilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4ce263c9476d226312ba6d40d15302d8a4c2c99e -
Trigger Event:
push
-
Statement type: