Metadata-Version: 2.5
Name: agent-wire-proxy
Version: 0.2.0
Summary: Protocol bridge for OpenAI Responses, Chat Completions, and Anthropic Messages clients.
Author: Agent Wire Proxy contributors
License-Expression: MIT
License-File: LICENSE
Keywords: agents,anthropic,api-proxy,llm,openai,vllm
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: Proxy Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: certifi>=2024.8.30
Requires-Dist: tokenizers<1,>=0.21
Provides-Extra: dev
Requires-Dist: pytest<10,>=8; extra == 'dev'
Requires-Dist: ruff<1,>=0.12; extra == 'dev'
Description-Content-Type: text/markdown

# Agent Wire Proxy

A lightweight compatibility proxy that lets OpenAI Responses, OpenAI Chat
Completions, and Anthropic Messages clients share OpenAI-compatible backends.

Use it when Codex expects `/v1/responses`, Claude Code expects Anthropic
Messages, or several model IDs need to route through one local proxy.

> [!IMPORTANT]
> This is an alpha-stage compatibility layer. Keep it on localhost unless it
> is protected by authentication and a TLS reverse proxy.

## Install

```bash
python3 -m pip install agent-wire-proxy
```

Python 3.11 or newer is required.

## Quick start

Create `models.toml`:

```toml
[proxy]
default_model = "example-model"

[[models]]
id = "example-model"
target = "http://127.0.0.1:8000"
upstream_api = "chat_completions"
api_key_env = "UPSTREAM_API_KEY"
aliases = ["claude-example-model"]
```

Provide upstream credentials outside version control:

```bash
export UPSTREAM_API_KEY="<your-upstream-api-key>"
```

Start the proxy:

```bash
agent-wire-proxy \
  --listen 127.0.0.1:18009 \
  --config models.toml
```

Check it:

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

The package also exposes a reentrant Python API:

```python
from agent_wire_proxy import serve

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

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

## Launch Codex or Claude Code

Choose an agent and model interactively:

```bash
agent-wire-tui
```

Or select them directly:

```bash
agent-wire-tui --agent codex --model example-model
agent-wire-tui --agent claude --model claude-example-model
```

Automation can request a secret-free launch contract without starting the
agent:

```bash
agent-wire-tui \
  --agent codex \
  --model example-model \
  --config /absolute/path/to/models.toml \
  --launch-json
```

Run `agent-wire-proxy --help` or `agent-wire-tui --help` for all options.

## Supported endpoints

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/health` | Health check |
| `GET` | `/v1/models` | 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 |

Upstreams must expose OpenAI Responses or Chat Completions. Anthropic is
supported as a client-facing API, not as an upstream API. Compatibility covers
text, multi-turn messages, function tools, parallel tool calls, tool results,
streaming events, and usage information. Provider-specific features are best
effort.

## Security

- Set `AGENT_WIRE_PROXY_CLIENT_API_KEY` to authenticate non-health requests.
- Keep upstream credentials in environment variables.
- Prompt and response content is omitted from logs unless `--log-content` is
  explicitly enabled.
- Prefer a localhost binding; use an authenticated TLS reverse proxy for
  network exposure.

## License

MIT License.
