OpenAI-compatible API proxy for Anthropic Claude — use Claude with any OpenAI SDK, tool, or application. Zero config, zero dependencies, drop-in replacement.
clauderouter translates OpenAI chat completion requests into Anthropic Claude API calls. Point your existing OpenAI-based code at clauderouter and start using Claude without changing a single line.
- OpenAI API compatibility — works with the OpenAI Python SDK, Node.js SDK, and any OpenAI-compatible client
- Streaming support — full SSE streaming, translated in real time
- Automatic model mapping — send
gpt-4oand it routes toclaude-sonnet-4-6 - Dual authentication — supports both Anthropic API keys and OAuth tokens
- Zero dependencies — built with Go standard library only
- CORS enabled — use directly from browsers and frontends
# Build
go build -o clauderouter ./cmd/clauderouter
# Run
export ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
./clauderouterThe server starts on :8080 by default. Your OpenAI-compatible endpoint is http://localhost:8080/v1/chat/completions.
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8080/v1",
api_key="unused", # not validated by clauderouter
)
response = client.chat.completions.create(
model="gpt-4o", # routes to claude-sonnet-4-6
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://localhost:8080/v1",
apiKey: "unused",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
stream: true,
});
for await (const chunk of response) {
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}Send OpenAI model names or Claude model names — clauderouter resolves them automatically.
| OpenAI Model | Claude Model |
|---|---|
gpt-4 |
claude-sonnet-4-6 |
gpt-4o |
claude-sonnet-4-6 |
gpt-4o-mini |
claude-haiku-4-5-20251001 |
gpt-3.5-turbo |
claude-haiku-4-5-20251001 |
Claude aliases also work:
| Alias | Resolves To |
|---|---|
claude-sonnet |
claude-sonnet-4-6 |
claude-opus |
claude-opus-4-6 |
claude-haiku |
claude-haiku-4-5-20251001 |
claude-3.5-sonnet |
claude-3-5-sonnet-20241022 |
Any model starting with claude- that isn't in the map is passed through directly. Unknown models default to claude-sonnet-4-6.
| Method | Path | Description |
|---|---|---|
POST |
/v1/chat/completions |
Chat completions (OpenAI-compatible) |
POST |
/chat/completions |
Chat completions (alternate path) |
GET |
/v1/models |
List available models |
GET |
/models |
List models (alternate path) |
GET |
/health |
Health check |
| Flag | Env Var | Default | Description |
|---|---|---|---|
-api-key |
ANTHROPIC_API_KEY |
— | Anthropic API key or OAuth token |
-addr |
— | :8080 |
Listen address |
-api-url |
— | Anthropic default | Override Anthropic API URL |
clauderouter supports both Anthropic authentication methods:
- API Keys (
sk-ant-api03-...) — sent asx-api-keyheader - OAuth Tokens (
sk-ant-oat01-...) — sent asBearertoken inAuthorizationheader
MIT