claude-code-relay
OpenAI-compatible API server that wraps your local Claude CLI.
Why?
Creating API keys is friction when you just want to experiment. You already pay for Claude Code subscription - use it.
Quick Start
Node
bunx claude-code-relay serve # easiest
npx claude-code-relay serve # npm alternative
npm i -g claude-code-relay && claude-code-relay serve # global install
Python
uvx claude-code-relay serve # easiest
pipx run claude-code-relay serve # pipx alternative
pip install claude-code-relay && claude-code-relay serve # global install
Server runs at http://localhost:52014/v1
Usage
from openai import OpenAI
client = OpenAI(base_url="http://localhost:52014/v1", api_key="x")
client.chat.completions.create(model="sonnet", messages=[{"role": "user", "content": "Hi"}])
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "http://localhost:52014/v1", apiKey: "x" });
await client.chat.completions.create({ model: "sonnet", messages: [{ role: "user", content: "Hi" }] });
Models
| Model | Aliases |
|---|---|
sonnet |
claude-3-sonnet, claude-sonnet-4 |
opus |
claude-3-opus, claude-opus-4 |
haiku |
claude-3-haiku |
Default: unrecognized models (e.g., gpt-4) map to sonnet
Options
claude-code-relay serve [options]
-p, --port <port> Port (default: 52014)
--host <host> Host (default: 127.0.0.1)
--claude-path <path> Claude CLI path
--timeout <seconds> Timeout (default: 300)
-v, --verbose Verbose logging
Environment: CLAUDE_CLI_PATH, CLAUDE_CODE_RELAY_PORT, CLAUDE_CODE_RELAY_HOST, CLAUDE_CODE_RELAY_TIMEOUT, CLAUDE_CODE_RELAY_VERBOSE
Limitations
usagetokens always0temperature,max_tokens,top_pignored- No tools/functions support
Examples
See examples/ for Node and Python demos.
License
MIT. Unofficial - comply with Anthropic ToS.
Metadata
Release files for claude-code-relay 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_code_relay-0.0.9.tar.gz | 9.1 kB | With provenance | Details for claude_code_relay-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_code_relay-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for claude_code_relay-0.0.9-py3-none-any.whl |
Total release size: 19.0 kB
Release files / claude_code_relay-0.0.9.tar.gz
| Download URL | claude_code_relay-0.0.9.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44d664dc8205e4df1022a284a023cf597c0504a0f3584665a3a747c70ef355a8
|
|
BLAKE2b-256 checksum How to use checksums |
bd8fb8702521df4f7fad6fbdc8b0a0cf5035a73eec3e164446ebf1788232745f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.
Transparency logRelease files / claude_code_relay-0.0.9-py3-none-any.whl
| Download URL | claude_code_relay-0.0.9-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b2e7a77910b3610ff36bea58996f968a73f5120c3b1153e2623118b7d7d6ee5
|
|
BLAKE2b-256 checksum How to use checksums |
3ded3d5fbb0b23107e34e91f09c43624eec93b835235b0a23d27ddd78a0c0cf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.
Transparency logSecurity for claude-code-relay 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for claude_code_relay-0.0.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.