
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
API server that provides an Anthropic and OpenAI compatible interface over Claude Code, allowing to use your Claude OAuth account or over the API.
ccproxy
is a local reverse proxy server for Anthropic Claude LLM at api.anthropic.com/v1/messages
. It allows you to use your existing Claude Max subscription to interact with the Anthropic API, bypassing the need for separate API key billing.
The server provides two primary modes of operation:
/sdk
): Routes requests through the local claude-code-sdk
. This enables access to tools configured in your Claude environment and includes an integrated MCP (Model Context Protocol) server for permission management./api
): Acts as a direct reverse proxy, injecting the necessary authentication headers. This provides full access to the underlying API features and model settings.It includes a translation layer to support both Anthropic and OpenAI-compatible API formats for requests and responses, including streaming.
# The official claude-code CLI is required for SDK mode
npm install -g @anthropic-ai/claude-code
# run it with uv
uvx ccproxy-api
# run it with pipx
pipx run ccproxy-api
# install with uv
uv tool install ccproxy-api
# Install ccproxy with pip
pipx install ccproxy-api
# Optional: Enable shell completion
eval "$(ccproxy --show-completion zsh)" # For zsh
eval "$(ccproxy --show-completion bash)" # For bash
For dev version replace ccproxy-api
with git+https://github.com/caddyglow/ccproxy-api.git@dev
The proxy uses two different authentication mechanisms depending on the mode.
Claude CLI (sdk
mode):
This mode relies on the authentication handled by the claude-code-sdk
.
claude /login
It's also possible now to get a long live token to avoid renewing issues using
```bash
claude setup-token`
ccproxy (api
mode):
This mode uses its own OAuth2 flow to obtain credentials for direct API access.
ccproxy auth login
If you are already connected with Claude CLI the credentials should be found automatically
You can check the status of these credentials with ccproxy auth validate
and ccproxy auth info
.
Warning is show on start up if no credentials are setup.
# Start the proxy server
ccproxy
The server will start on http://127.0.0.1:8000
by default.
Point your existing tools and applications to the local proxy instance by setting the appropriate environment variables. A dummy API key is required by most client libraries but is not used by the proxy itself.
For OpenAI-compatible clients:
# For SDK mode
export OPENAI_BASE_URL="http://localhost:8000/sdk/v1"
# For API mode
export OPENAI_BASE_URL="http://localhost:8000/api/v1"
export OPENAI_API_KEY="dummy-key"
For Anthropic-compatible clients:
# For SDK mode
export ANTHROPIC_BASE_URL="http://localhost:8000/sdk"
# For API mode
export ANTHROPIC_BASE_URL="http://localhost:8000/api"
export ANTHROPIC_API_KEY="dummy-key"
In SDK mode, CCProxy automatically configures an MCP (Model Context Protocol) server that provides permission checking tools for Claude Code. This enables interactive permission management for tool execution.
Starting the Permission Handler:
# In a separate terminal, start the permission handler
ccproxy permission-handler
# Or with custom settings
ccproxy permission-handler --host 127.0.0.1 --port 8000
The permission handler provides:
Working Directory Control:
Control which project the Claude SDK API can access using the --cwd
flag:
# Set working directory for Claude SDK
ccproxy --claude-code-options-cwd /path/to/your/project
# Example with permission bypass and formatted output
ccproxy --claude-code-options-cwd /tmp/tmp.AZyCo5a42N \
--claude-code-options-permission-mode bypassPermissions \
--claude-sdk-message-mode formatted
# Alternative: Change to project directory and start ccproxy
cd /path/to/your/project
ccproxy
CCProxy supports flexible message formatting through the sdk_message_mode
configuration:
forward
(default): Preserves original Claude SDK content blocks with full metadataformatted
: Converts content to XML tags with pretty-printed JSON dataignore
: Filters out Claude SDK-specific content entirelyConfigure via environment variables:
# Use formatted XML output
CLAUDE__SDK_MESSAGE_MODE=formatted ccproxy
# Use compact formatting without pretty-printing
CLAUDE__PRETTY_FORMAT=false ccproxy
CCProxy supports connection pooling for Claude Code SDK clients to improve request performance by maintaining a pool of pre-initialized Claude instances.
Pool mode is disabled by default and can be enabled using the CLI flag:
# Enable pool mode with default settings
ccproxy --sdk-enable-pool
# Configure pool size (default: 3)
ccproxy --sdk-enable-pool --sdk-pool-size 5
Pool mode is most effective for high-frequency requests with consistent configuration requirements.
CCProxy works seamlessly with Aider and other AI coding assistants:
export ANTHROPIC_API_KEY=dummy
export ANTHROPIC_BASE_URL=http://127.0.0.1:8000/api
aider --model claude-sonnet-4-20250514
If your tool only supports OpenAI settings, ccproxy automatically maps OpenAI models to Claude:
export OPENAI_API_KEY=dummy
export OPENAI_BASE_URL=http://127.0.0.1:8000/api/v1
aider --model o3-mini
For minimal interference and direct API access:
export OPENAI_API_KEY=dummy
export OPENAI_BASE_URL=http://127.0.0.1:8000/api/v1
aider --model o3-mini
curl
Example# SDK mode
curl -X POST http://localhost:8000/sdk/v1/messages \
-H "Content-Type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"messages": [{"role": "user", "content": "Hello!"}],
"max_tokens": 100
}'
# API mode
curl -X POST http://localhost:8000/api/v1/messages \
-H "Content-Type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"messages": [{"role": "user", "content": "Hello!"}],
"max_tokens": 100
}'
More examples are available in the examples/
directory.
The proxy exposes endpoints under two prefixes, corresponding to its operating modes.
Mode | URL Prefix | Description | Use Case |
---|---|---|---|
SDK | /sdk/ | Uses claude-code-sdk with its configured tools. | Accessing Claude with local tools. |
API | /api/ | Direct proxy with header injection. | Full API control, direct access. |
POST /sdk/v1/messages
POST /api/v1/messages
POST /sdk/v1/chat/completions
POST /api/v1/chat/completions
GET /health
GET /sdk/models
, GET /api/models
GET /sdk/status
, GET /api/status
GET /oauth/callback
POST /mcp/permission/check
- MCP permission checking endpointGET /permissions/stream
- SSE stream for permission requestsGET /permissions/{id}
- Get permission request detailsPOST /permissions/{id}/respond
- Respond to permission requestGET /metrics
GET /logs/status
, GET /logs/query
GET /dashboard
CCProxy supports recent Claude models including Opus, Sonnet, and Haiku variants. The specific models available to you will depend on your Claude account and the features enabled for your subscription.
claude-opus-4-20250514
claude-sonnet-4-20250514
claude-3-7-sonnet-20250219
claude-3-5-sonnet-20241022
claude-3-5-sonnet-20240620
Settings can be configured through (in order of precedence):
.env
file.ccproxy.toml
, ccproxy.toml
, or ~/.config/ccproxy/config.toml
)For complex configurations, you can use a nested syntax for environment variables with __
as a delimiter:
# Server settings
SERVER__HOST=0.0.0.0
SERVER__PORT=8080
# etc.
You can enable token authentication for the proxy. This supports multiple header formats (x-api-key
for Anthropic, Authorization: Bearer
for OpenAI) for compatibility with standard client libraries.
1. Generate a Token:
ccproxy generate-token
# Output: SECURITY__AUTH_TOKEN=abc123xyz789...
2. Configure the Token:
# Set environment variable
export SECURITY__AUTH_TOKEN=abc123xyz789...
# Or add to .env file
echo "SECURITY__AUTH_TOKEN=abc123xyz789..." >> .env
3. Use in Requests: When authentication is enabled, include the token in your API requests.
# Anthropic Format (x-api-key)
curl -H "x-api-key: your-token" ...
# OpenAI/Bearer Format
curl -H "Authorization: Bearer your-token" ...
ccproxy
includes an optional but powerful observability suite for monitoring and analytics. When enabled, it provides:
/metrics
endpoint for real-time operational monitoring./dashboard
to visualize metrics and request streams.These features are disabled by default and can be enabled via configuration. For a complete guide on setting up and using these features, see the Observability Documentation.
/sdk
or /api
) for your authentication method.ccproxy auth login
to refresh credentials for API mode. Run claude /login
for SDK mode.ccproxy --port 8001
.Please see CONTRIBUTING.md for details.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
API server that provides an Anthropic and OpenAI compatible interface over Claude Code, allowing to use your Claude OAuth account or over the API.
We found that ccproxy-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.