github Lexus2016/claude-flow v2.0.0
v2.0.0 — Sanitizing Proxy

latest releases: v2.1.1, v2.1.0, v2.0.1...
one month ago

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 blocks
  • server_tool_use, web_search_tool_result — server-side tool types
  • tool_reference — converted to text block
  • cache_control — stripped from all objects
  • $schema — removed from tool input schemas (recursive)
  • thinking parameter — removed from request body

Features

  • Zero dependencies — Node.js built-in http + global fetch only
  • 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
  • run command now auto-starts proxy (use --no-proxy to 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

Don't miss a new claude-flow release

NewReleases is sending notifications on new releases.