Skip to main content

Agent Wire Proxy

A lightweight compatibility proxy that lets OpenAI Responses, OpenAI Chat Completions, and Anthropic Messages clients share Qwen/vLLM backends.

[!IMPORTANT] Agent Wire Proxy is an alpha-stage compatibility layer. Review the compatibility contract before relying on it in a production path, and put authentication and TLS in front of non-localhost deployments.

It is useful when:

  • Codex expects /v1/responses, but a backend only exposes Chat Completions.
  • Claude Code needs an Anthropic Messages-compatible gateway.
  • several model IDs must route through one local proxy port.
  • streaming text, tool calls, usage, and timing must survive protocol conversion.

Requirements

  • Python 3.11+
  • one or more OpenAI-compatible model backends
  • Codex or Claude Code only when using the optional TUI launcher

Install

Install the published package from PyPI:

python3 -m pip install agent-wire-proxy

Or install from a repository checkout for development:

python3 -m venv .venv
.venv/bin/python -m pip install -e .

For development:

.venv/bin/python -m pip install -e ".[dev]"
.venv/bin/python -m pytest
.venv/bin/python -m ruff check .

Configure models

Routes live in config/models.toml:

[proxy]
default_model = "Qwen3.5-397B-FP8"

[[models]]
id = "Qwen3.5-397B-FP8"
target = "http://127.0.0.1:8000"
upstream_api = "responses"
aliases = ["claude-qwen3-5-397b"]

[[models]]
id = "qwen3.5-122b-a10b"
target = "http://127.0.0.1:8001"
upstream_api = "chat_completions"
aliases = ["claude-qwen3-5-122b"]

For machine-specific routes, copy it to the Git-ignored config/models.local.toml; the helper scripts prefer that file when it exists.

Use api_key_env = "UPSTREAM_API_KEY" for an authenticated upstream. Put the value in an ignored .env file:

cp .env.example .env

Run the proxy

The lifecycle helper runs the proxy in the background on http://127.0.0.1:18009:

scripts/agent_wire_proxy.command start
scripts/agent_wire_proxy.command status
scripts/agent_wire_proxy.command restart
scripts/agent_wire_proxy.command stop

It reads config/models.toml and .env, and writes runtime files under logs/. Override LISTEN, CONFIG, ENV_FILE, LOG_PATH, PID_PATH, or STDOUT_PATH when needed.

You can also run the installed CLI in the foreground:

agent-wire-proxy \
  --listen 127.0.0.1:18009 \
  --config config/models.toml \
  --env-file .env

The installed package also exposes a reentrant API. Each returned server owns its routing state, so multiple differently configured proxies can run in the same process:

from agent_wire_proxy import serve

proxy = serve(
    config="config/models.toml",
    listen=("127.0.0.1", 0),
    block=False,
)
print(proxy.server_port)

# Later:
proxy.shutdown()
proxy.server_close()

Check health and model discovery:

curl -fsS http://127.0.0.1:18009/health
curl -fsS http://127.0.0.1:18009/v1/models

Launch Codex or Claude Code

Choose an agent and configured model interactively:

agent-wire-tui

Or select them directly:

# Codex + Qwen 397B
agent-wire-tui --agent codex --model Qwen3.5-397B-FP8

# Claude Code + Qwen 397B
agent-wire-tui --agent claude --model claude-qwen3-5-397b

The launcher injects temporary client settings. It does not modify the user's Codex configuration. It is also available as launch(agent="codex", model="Qwen3.5-397B-FP8") from Python. Run agent-wire-tui --help for all options. The legacy scripts/agent_wire_tui.command wrapper uses the installed CLI when available and otherwise runs from the source checkout.

Unless --config is supplied, the launcher checks AGENT_WIRE_PROXY_CONFIG, then config/models.local.toml and config/models.toml under the current directory, then $XDG_CONFIG_HOME/agent-wire-proxy/models.toml (or the equivalent under ~/.config), and finally the packaged default configuration.

Supported endpoints

Method Path Purpose
GET /health Health check
GET /v1/models OpenAI, Codex, and Claude model discovery
POST /v1/responses OpenAI Responses
POST /v1/chat/completions OpenAI Chat Completions
POST /v1/messages Anthropic Messages
POST /v1/messages/count_tokens Approximate token count

The proxy supports streaming text, reasoning, and tool-call conversion between these protocols. It can also write content-free benchmark route receipts; see docs/cli.md for configuration and operational details.

The APIs are not a symmetric provider gateway: upstreams must expose OpenAI Responses or Chat Completions. See docs/compatibility.md for the supported matrix, behavior classes, and repair contract.

For opt-in endpoint checks and LiteLLM comparisons, see docs/compatibility-testing.md.

Security

  • Client authentication is optional. Set AGENT_WIRE_PROXY_CLIENT_API_KEY and still prefer a localhost binding or authenticated TLS reverse proxy.
  • Keep upstream credentials in environment variables or an ignored .env.
  • Request and response content is omitted from logs by default. Treat logs produced with --log-content as sensitive.
  • Configure NO_PROXY/no_proxy yourself when an upstream must bypass an HTTP proxy.

License

MIT

Download files

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

Source Distribution

agent_wire_proxy-0.1.0.tar.gz (53.3 kB view details)

Uploaded Source

Built Distribution

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

agent_wire_proxy-0.1.0-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file agent_wire_proxy-0.1.0.tar.gz.

File metadata

  • Download URL: agent_wire_proxy-0.1.0.tar.gz
  • Upload date:
  • Size: 53.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.10

File hashes

Hashes for agent_wire_proxy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 193639e2cce8a8c173007a2bd9bd913cba999338e198bdfb0504bdd13ab86ffb
MD5 7d5db70ddd8bf19ab9cd049e09022e23
BLAKE2b-256 999a7108094179b541359cfd551266f79eff5cc45704cf4a7c05f750dd6c2630

See more details on using hashes here.

File details

Details for the file agent_wire_proxy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_wire_proxy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9bba94504f54fc0e8ae2cecd83e9cc255d72b4ea01c68b4c7a278c0d124c885
MD5 d739f144419f458dabcf87ff04776aa5
BLAKE2b-256 0095b0cd65ba6c42eb0280d29260f172fa93337bd3fb74c87ada9b1da1f125d4

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 Sentry Error logging StatusPage Status page