@yadimon/claude-code-to-llm-server
v0.3.4
Published
Use Claude Code as a simple OpenAI-compatible Responses server
Downloads
636
Maintainers
Readme
@yadimon/claude-code-to-llm-server
OpenAI-compatible Responses server on top of @yadimon/claude-code-to-llm.
Install
npm install -g @yadimon/claude-code-to-llm-serverOr run it without installing globally:
npx @yadimon/claude-code-to-llm-serverRequirements:
- Node.js
>=20 - installed
claudeCLI inPATHorCLAUDE_CODE_TO_LLM_CLI_PATH - valid Claude Code login on the machine
Default auth bundle:
~/.claude.json~/.claude/.credentials.json
Endpoints
POST /v1/responsesGET /v1/modelsGET /healthz
Start
npx @yadimon/claude-code-to-llm-serverThen call:
curl http://127.0.0.1:3000/healthz
curl http://127.0.0.1:3000/v1/modelsExample response request:
curl http://127.0.0.1:3000/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"input": "Say hello in one short sentence."
}'Streaming example:
curl http://127.0.0.1:3000/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"stream": true,
"input": "Count from 1 to 3."
}'Local development commands:
npm run start --workspace @yadimon/claude-code-to-llm-server
npm run start:mock --workspace @yadimon/claude-code-to-llm-serverAuthentication
If you set CLAUDE_CODE_TO_LLM_SERVER_API_KEY, only POST /v1/responses requires a bearer token. GET /healthz and GET /v1/models stay public.
Example:
curl http://127.0.0.1:3000/v1/responses \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"input": "Hello"
}'Runtime Configuration
| Variable | Default | Description |
|---|---|---|
| CLAUDE_CODE_TO_LLM_SERVER_HOST | 127.0.0.1 | HTTP bind host. |
| CLAUDE_CODE_TO_LLM_SERVER_PORT | 3000 | HTTP bind port. |
| CLAUDE_CODE_TO_LLM_SERVER_DEFAULT_MODEL | claude-sonnet-4-6 | Fallback model when the request omits model. |
| CLAUDE_CODE_TO_LLM_SERVER_MODELS | default model | Comma-separated allowlist of accepted models. |
| CLAUDE_CODE_TO_LLM_SERVER_API_KEY | - | Bearer token accepted for POST /v1/responses. |
| CLAUDE_CODE_TO_LLM_SERVER_MOCK_MODE | - | Enables the mock runner for local testing. |
| CLAUDE_CODE_TO_LLM_SERVER_MOCK_RESPONSE | mock response | Mock response text returned by the mock runner. |
| CLAUDE_CODE_TO_LLM_AUTH_PATH | ~/.claude.json | Path to the Claude Code session file. |
| CLAUDE_CODE_TO_LLM_CREDENTIALS_PATH | ~/.claude/.credentials.json | Path to the Claude Code credentials file. |
| CLAUDE_CODE_TO_LLM_SETTINGS_PATH | ~/.claude/settings.json when present | Optional settings file copied into the temporary Claude home. |
| CLAUDE_CODE_TO_LLM_CLI_PATH | claude | Path to the Claude Code CLI binary. |
| CLAUDE_CODE_TO_LLM_CONFIG_HOME | temp dir | Temporary Claude Code home directory for a run. |
| CLAUDE_CODE_TO_LLM_WORKSPACE | temp dir | Workspace directory used for execution. |
| CLAUDE_CODE_TO_LLM_REASONING_EFFORT | low | Default reasoning effort passed to the core runner. |
Behavior Notes
GET /healthzandGET /v1/modelsstay public even when bearer auth is configured.POST /v1/responsesvalidates requested models againstCLAUDE_CODE_TO_LLM_SERVER_MODELS.max_output_tokensandreasoning.effortare forwarded to the core runner.- Unsupported request fields such as
tools,tool_choice, orinput_imagereturn400. - The server owns prompt adaptation for
instructionsand multi-message dialog input before calling the raw core runner. --search/webSearch: trueis a server-wide policy: when enabled it allows the underlyingclaudeCLI to useWebSearchfor every request. There is no per-request opt-in (toolsis rejected). Web-search usage is captured by the core runner but not surfaced in the OpenAIusageblock.
Docker
Build from the repository root:
docker build -f packages/claude-code-to-llm-server/Dockerfile .
docker run -p 3000:3000 \
-v ~/.claude.json:/root/.claude.json:ro \
-v ~/.claude/.credentials.json:/root/.claude/.credentials.json:ro \
claude-code-to-llm-serverDevelopment
npm run build --workspace @yadimon/claude-code-to-llm-server
npm run lint --workspace @yadimon/claude-code-to-llm-server
npm run typecheck --workspace @yadimon/claude-code-to-llm-server