Local proxy that exposes Claude CLI as an OpenAI-compatible API server
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_code_relay-0.0.9.tar.gz.
File metadata
- Download URL: claude_code_relay-0.0.9.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44d664dc8205e4df1022a284a023cf597c0504a0f3584665a3a747c70ef355a8
|
|
| MD5 |
54b91fb09ffa6c8f72daa067c777473e
|
|
| BLAKE2b-256 |
bd8fb8702521df4f7fad6fbdc8b0a0cf5035a73eec3e164446ebf1788232745f
|
Provenance
The following attestation bundles were made for claude_code_relay-0.0.9.tar.gz:
Publisher:
python-publish.yml on DreamTeamMobile/claude-code-relay
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_relay-0.0.9.tar.gz -
Subject digest:
44d664dc8205e4df1022a284a023cf597c0504a0f3584665a3a747c70ef355a8 - Sigstore transparency entry: 805228844
- Sigstore integration time:
-
Permalink:
DreamTeamMobile/claude-code-relay@2df4827b57499f5d9535216846c074f44e6d1ee0 -
Branch / Tag:
refs/tags/v0.0.9 - Owner: https://github.com/DreamTeamMobile
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2df4827b57499f5d9535216846c074f44e6d1ee0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file claude_code_relay-0.0.9-py3-none-any.whl.
File metadata
- Download URL: claude_code_relay-0.0.9-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b2e7a77910b3610ff36bea58996f968a73f5120c3b1153e2623118b7d7d6ee5
|
|
| MD5 |
e9ebe849e8b5578874bbb928f9aa9560
|
|
| BLAKE2b-256 |
3ded3d5fbb0b23107e34e91f09c43624eec93b835235b0a23d27ddd78a0c0cf3
|
Provenance
The following attestation bundles were made for claude_code_relay-0.0.9-py3-none-any.whl:
Publisher:
python-publish.yml on DreamTeamMobile/claude-code-relay
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_relay-0.0.9-py3-none-any.whl -
Subject digest:
5b2e7a77910b3610ff36bea58996f968a73f5120c3b1153e2623118b7d7d6ee5 - Sigstore transparency entry: 805228924
- Sigstore integration time:
-
Permalink:
DreamTeamMobile/claude-code-relay@2df4827b57499f5d9535216846c074f44e6d1ee0 -
Branch / Tag:
refs/tags/v0.0.9 - Owner: https://github.com/DreamTeamMobile
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2df4827b57499f5d9535216846c074f44e6d1ee0 -
Trigger Event:
push
-
Statement type: