Advanced & Security

Hyper Local Proxy (:8000) & Token Meter

Embedded Hyper HTTP streaming proxy, prompt caching, latency monitor, and circuit breakers.

The Embedded Hyper Proxy Architecture

Whenever CACode starts, it initializes a lightweight embedded proxy powered by Hyper on http://127.0.0.1:8000.

Capabilities of the Local Proxy:

  • Transparent Stream Interception: Proxies Server-Sent Events (SSE) streaming responses directly to your terminal with sub-millisecond overhead.
  • Real-Time Token Meter: Accurately parses header telemetry (prompt_tokens, completion_tokens, cache_read_input_tokens) on every API request.
  • Prompt Cache Accelerator: Optimizes system prompt structures to leverage Anthropic and DeepSeek prompt caching, saving up to 90% on input costs.
  • Network Failure Recovery: Automatically retries dropped TCP connections, handles HTTP 429 rate limits with exponential backoff, and switches to fallback models seamlessly.

Inspecting Live Proxy Traffic:

# Stream live proxy logs in a separate terminal window
cacode proxy tail --port 8000