Metadata-Version: 2.3
Name: padwan-proxy
Version: 0.1.0
Summary: Serve the Anthropic Messages API over any OpenAI-compatible backend, so Anthropic clients (e.g. Claude Code) can use it
Author-email: julien.brayere@polarsen.io
License: MIT License
         
         Copyright (c) 2026 polarsen-io
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Requires-Dist: padwan-ai>=0.14.1
Requires-Dist: piou>=0.37.0
Requires-Dist: gravier>=0.1.0
Requires-Dist: orjson>=3.12
Requires-Dist: msgspec>=0.19
Requires-Dist: jinja2>=3.1.6
Requires-Dist: python-dotenv>=1.2.3
Requires-Dist: laya>=0.3.3 ; extra == 'laya'
Requires-Dist: padwan-ai[langfuse]>=0.14.1 ; extra == 'trace'
Requires-Dist: opentelemetry-sdk>=1.44 ; extra == 'trace'
Requires-Dist: opentelemetry-exporter-otlp>=1.44 ; extra == 'trace'
Requires-Python: >=3.13
Provides-Extra: laya
Provides-Extra: trace
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/polarsen-io/padwan-proxy/master/docs/static/logo-hood.png" alt="Padwan Proxy" width="120">
</p>

# Padwan Proxy

[![CI](https://github.com/polarsen-io/padwan-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/polarsen-io/padwan-proxy/actions/workflows/ci.yml)
[![Docker](https://github.com/polarsen-io/padwan-proxy/actions/workflows/docker.yml/badge.svg)](https://github.com/polarsen-io/padwan-proxy/actions/workflows/docker.yml)
[![Release](https://img.shields.io/github/v/release/polarsen-io/padwan-proxy)](https://github.com/polarsen-io/padwan-proxy/releases)
[![Docs](https://img.shields.io/badge/docs-polarsen--io.github.io-1A8B9E)](https://polarsen-io.github.io/padwan-proxy)

Serve the Anthropic Messages API (`/v1/messages` + `count_tokens`) on top of any OpenAI-compatible backend, so Anthropic clients such as Claude Code can use it. Built on [`padwan-ai`](https://github.com/polarsen-io/padwan-ai)'s Anthropic↔OpenAI translation layer, served by [granian](https://github.com/emmett-framework/granian) via [gravier](https://github.com/Andarius/gravier).

![Claude Code running GLM 5.2 on Scaleway through padwan-proxy](https://raw.githubusercontent.com/polarsen-io/padwan-proxy/master/docs/static/demo.gif)

```bash
export PADWAN_API_KEY=<YOUR_BACKEND_KEY>
uvx padwan-proxy --backend-url https://api.example.com/v1/ \
  -m my-model --small-model my-small-model \
  --claude-config ~/.claude-mybackend

CLAUDE_CONFIG_DIR=~/.claude-mybackend claude
```

Or without writing a config: `ANTHROPIC_BASE_URL=http://127.0.0.1:4000 ANTHROPIC_AUTH_TOKEN=dummy claude`.

Or save the flags as a profile in `~/.config/padwan-proxy/profiles.toml` (flags passed on the command line win):

```toml
[mybackend]
backend_url = "https://api.example.com/v1/"
model = "my-model"
small_model = "my-small-model"
claude_config = "~/.claude-mybackend"
```

```bash
uvx padwan-proxy --profile mybackend
```

Or with Docker, mounting the config dir at the same path so `--claude-config` writes it on the host:

```bash
mkdir -p ~/.claude-mybackend
docker run -d --rm --name padwan-proxy -p 127.0.0.1:4000:4000 \
  --user "$(id -u):$(id -g)" -e PADWAN_API_KEY \
  -v ~/.claude-mybackend:$HOME/.claude-mybackend \
  ghcr.io/polarsen-io/padwan-proxy:latest \
  --backend-url https://api.example.com/v1/ -m my-model --small-model my-small-model \
  --claude-config $HOME/.claude-mybackend

CLAUDE_CONFIG_DIR=~/.claude-mybackend claude
```

With a profile:

```bash
docker run -d --rm --name padwan-proxy -p 127.0.0.1:4000:4000 \
  --user "$(id -u):$(id -g)" -e PADWAN_API_KEY -e HOME \
  -v ~/.config/padwan-proxy:$HOME/.config/padwan-proxy:ro \
  -v ~/.claude-mybackend:$HOME/.claude-mybackend \
  ghcr.io/polarsen-io/padwan-proxy:latest --profile mybackend
```

A [`compose.yaml`](compose.yaml) does the same from a `.env`; see the Docker docs.

**Documentation: <https://polarsen-io.github.io/padwan-proxy>** — routing, Docker
(`ghcr.io/polarsen-io/padwan-proxy`), tracing, tool approvals, and the full option reference.

## Development

```bash
uv sync --group dev
just ci    # lint + type check + tests
just docs  # serve the docs locally
```
