@xeiroh/claude-oc-proxy
v1.2.0
Published
Transparent proxy that adds/strips tool name prefixes for Claude API requests
Maintainers
Readme
claude-oc-proxy
Transparent proxy that adds/strips oc_ tool name prefixes for Claude API requests. Works with CLI Proxy API.
Quick Start
Basically all you need to do:
npx @xeiroh/claude-oc-proxy --setupThis will:
- Install CLI Proxy API (if missing)
- Run Claude OAuth login
- Start the proxy stack
- Print your endpoint (which you can plug into opencode.json)
Installation
No installation required. Run directly with npx or bunx:
# Using npx (Node.js)
npx @xeiroh/claude-oc-proxy --help
# Using bunx (Bun) - recommended
bunx @xeiroh/claude-oc-proxy --help
# Using pnpm
pnpm dlx @xeiroh/claude-oc-proxy --helpManual Setup
1. Install CLI Proxy API
macOS:
brew install cliproxyapiLinux:
curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bash2. Authenticate
cli-proxy-api -claude-login3. Start
# Terminal 1
cli-proxy-api
# Terminal 2
npx @xeiroh/claude-oc-proxy
# or
bunx @xeiroh/claude-oc-proxyEndpoint: http://localhost:8318/v1
Usage
npx @xeiroh/claude-oc-proxy [OPTIONS]| Option | Default | Description |
|--------|---------|-------------|
| -p, --port <port> | 8318 | Listen port |
| -u, --upstream <url> | http://localhost:8317 | Upstream API URL |
| -s, --setup | | Interactive setup wizard |
| -h, --help | | Show help |
Examples
# Start with defaults
npx @xeiroh/claude-oc-proxy
# Custom port
npx @xeiroh/claude-oc-proxy -p 9000
# Custom upstream
npx @xeiroh/claude-oc-proxy -u http://myapi:8000
# Both
npx @xeiroh/claude-oc-proxy -p 9000 -u http://myapi:8000
# Interactive setup
npx @xeiroh/claude-oc-proxy --setupOpenCode Setup
Add to ~/.config/opencode/opencode.json:
{
"provider": {
"local": {
"npm": "@ai-sdk/anthropic",
"name": "Local",
"options": {
"baseURL": "http://localhost:8318/v1",
"apiKey": "not-needed"
},
"models": {
"claude-opus-4-5-20251101": {
"name": "Claude Opus 4.5",
"limit": { "context": 200000, "output": 64000 },
"options": {
"thinking": { "type": "enabled", "budgetTokens": 32000 }
}
},
"claude-sonnet-4-5-20250929": {
"name": "Claude Sonnet 4.5",
"limit": { "context": 200000, "output": 16000 }
}
}
}
}
}Use: local/claude-opus-4-5-20251101
How It Works
Client → claude-oc-proxy (:8318) → CLI Proxy API (:8317) → Claude API
↓ ↓
adds oc_ prefix handles OAuth
strips on responseCredits
Tool prefixing workaround discovered in anomalyco/opencode-anthropic-auth#10.
License
MIT
