Skip to main content

Module upstream

Module upstream 

Source
Expand description

Forwarding to the upstream Anthropic-compatible provider.

Observe mode is a transparent proxy: the request body and BYOK auth headers go upstream byte-for-byte, and the response comes back byte-for-byte. Firstpass never inspects, injects, or logs the API key.

Functions§

forward_anthropic
Forward one POST /v1/messages request and return its response buffered (full body). Used for non-streaming requests, where the assembled body also feeds the audit trace.
forward_anthropic_streaming
Forward one POST /v1/messages request and return the raw response for streaming relay (stream: true) — the caller pipes response.bytes_stream() to the client without buffering, preserving SSE chunk-by-chunk and keeping time-to-first-byte low.