What's New
Sanitizing HTTP Proxy — a complete proxy server that sits between Claude Code CLI and non-Anthropic providers (OpenRouter, DeepSeek, OpenAI, Gemini, etc.), removing Anthropic-internal content types that cause upstream errors.
New Commands
# Standalone proxy server
claude-flow proxy openrouter
# Run with auto-proxy (recommended)
claude-flow run -- claude -p "Hello"Sanitization
Removes/transforms these Anthropic-internal types before forwarding:
thinking,redacted_thinking— extended thinking blocksserver_tool_use,web_search_tool_result— server-side tool typestool_reference— converted to text blockcache_control— stripped from all objects$schema— removed from tool input schemas (recursive)thinkingparameter — removed from request body
Features
- Zero dependencies — Node.js built-in
http+ globalfetchonly - Node 18+ compatible — uses
getReader()for stream forwarding - Streaming SSE — transparent forwarding with graceful disconnect handling
- Auto-retry — 429, 502, 503, 529 with exponential backoff + Retry-After parsing
- Safe by default — sanitization errors fall back to original request
- 10-minute timeout — AbortController on all upstream requests
- 10MB request limit — prevents OOM on oversized payloads
- Anthropic error format — all proxy errors return proper
{ type: "error", error: { ... } }
Testing
114 tests (95 unit + 19 integration), all passing.
Breaking Changes
- Version bumped to 2.0.0
runcommand now auto-starts proxy (use--no-proxyto disable)
Programmatic API
const { createProxy, sanitizeRequestBody } = require('claude-flow');
// Start proxy
const proxy = await createProxy({
targetUrl: 'https://openrouter.ai/api',
authHeader: 'Authorization',
authValue: 'Bearer sk-or-...',
port: 0, // random available port
});
console.log(`Proxy on ${proxy.url}`);
// Or just sanitize
const clean = sanitizeRequestBody(requestBody);Full Changelog: v1.0.0...v2.0.0