ccp

OpenAI-compatible API proxy that translates requests into Claude Code CLI invocations. Connect any OpenAI-compatible client and let Claude Code do the heavy lifting, or step in and guide it when you need precise control.

npmv1.0.1 licenseMIT node>=20
npm install -g @erdinccurebal/ccp

Features

Everything you need to bridge OpenAI clients with Claude Code

OpenAI-Compatible API

Drop-in replacement for OpenAI endpoints. Works with Cursor, Continue, Open WebUI, Cline, Windsurf, and any OpenAI-compatible client.

Streaming Support

Real-time streaming responses via Server-Sent Events. Get instant feedback as Claude Code processes your requests.

CLI Tool

Full-featured command-line interface for configuration, server management, and service control. One command to get started.

Service Management

Install as a system service with autostart. Supports macOS (launchd) and Linux (systemd) out of the box.

Session Persistence

Multi-turn session management with optional file persistence. Conversations resume seamlessly across requests and restarts.

Error Handling

Claude CLI errors are captured and returned as readable messages. No more empty responses or cryptic failures.

Quick Start

Up and running in under a minute

1 Install

bash
# Install globally
npm install -g @erdinccurebal/ccp
bash
# Configure your API key
ccp config set API_KEY my-secret-key
bash
# Start the server
ccp start

2 Use

bash
# Send a streaming request
curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5-20250929",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'
bash
# Or run as a background service
ccp service install
ccp service start

CLI Commands

Complete command reference

CommandDescription
ccp startStart the proxy server
ccp config set <KEY> <VALUE>Set a config value
ccp config get <KEY>Get a config value
ccp config listList all config values
ccp config reset <KEY>Reset a config value to default
ccp config pathShow config file path
ccp config helpShow available config keys and values
ccp service installInstall as system service (autostart)
ccp service uninstallRemove system service
ccp service startStart the background service
ccp service stopStop the background service
ccp service restartRestart the background service
ccp service statusCheck service status
ccp versionShow version
ccp helpShow help

Configuration

All settings via ccp config set or environment variables

KeyDefaultDescription
API_KEYCCP_API_KEYAPI key for authenticating requests
PORT8888Server port
HOST127.0.0.1Server bind address
CORS_ORIGIN*Allowed CORS origin
CLAUDE_PATHclaudePath to Claude CLI binary
CLAUDE_WORKING_DIR(cwd)Default working directory for Claude
CLAUDE_PERMISSION_MODEdefaultPermission mode (default, plan, bypassPermissions)
CLAUDE_MAX_TURNS25Max agentic turns per request
CLAUDE_TIMEOUT_MS300000Timeout per invocation (5 min)
SESSION_TTL_MS3600000Session time-to-live (1 hour)
SESSION_FILE(empty)Path to session persistence file
DEFAULT_MODELclaude-sonnet-4-5-20250929Default model
LOG_LEVELinfoLog level (error, warn, info, debug)
LOG_FILE(empty)Log file path (also logs to console)
LOG_MAX_SIZE10mbMax log file size before rotation
LOG_MAX_FILES5Number of rotated log backups

API Endpoints

OpenAI-compatible REST API

GET /health

Health check endpoint. Returns {"status": "ok"}.

GET /v1/models

List available models. Requires Authorization: Bearer <API_KEY>.

Model aliases: sonnet, opus, haiku

POST /v1/chat/completions

OpenAI-compatible chat completions. Supports both streaming and non-streaming responses.

Includes token usage, request tracing via X-Request-Id, and multi-turn session management.