ccal

Claude Code Adapter for LLMs

Use your Claude subscription as an OpenAI-compatible endpoint.

ccal is a small, local HTTP server that bridges the claude CLI to the OpenAI API. Point any OpenAI client at your Claude Code login — no extra API key, no billing.

Requires Node 20+ and the claude CLI installed and logged in.

What it does

Under the hood, ccal shells out to claude -p --output-format stream-json and translates the CLI's streaming output into OpenAI Server-Sent Events. It exposes /v1/chat/completions and /v1/models, so existing OpenAI code just works.

Your subscription, anywhere

ccal drives the Claude Code CLI you already have logged in — it never calls the Anthropic API directly, so no separate key or billing is involved.

Drop-in OpenAI compatibility

Set the base URL to http://127.0.0.1:8787/v1 and pick sonnet, opus, or haiku. Models, chat completions, and streaming all work.

Local and simple

Binds to localhost by default. No daemon, no config files, no state. One command starts it and Ctrl-C stops it.

Streaming built in

Full SSE support with data: [DONE] framing, plus a plain non-streaming mode that returns a single assembled message.

Point any OpenAI client at it

The API key is ignored — auth comes from your local claude login — so any placeholder works.

# Same request you'd send to OpenAI, different base URL curl -N http://127.0.0.1:8787/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "model": "sonnet", "stream": true, "messages": [{ "role": "user", "content": "Say hello in one word." }] }'

Endpoints

POST/v1/chat/completions OpenAI-compatible chat, streaming or not
GET/v1/models Lists sonnet, opus, and haiku
GET/health Liveness probe → { "ok": true }