Skip to main content

claude-code-relay

OpenAI-compatible API server that wraps your local Claude CLI.

Demo

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

  • usage tokens always 0
  • temperature, max_tokens, top_p ignored
  • 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)

Source distribution for claude-code-relay 0.0.9
File Size Uploaded
claude_code_relay-0.0.9.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-code-relay 0.0.9
File Interpreter ABI Platform
claude_code_relay-0.0.9-py3-none-any.whl Python 3 none any Details

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 log

Release 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 log

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page