Skip to main content

backend_api_handler

Function backend_api_handler 

Source
pub async fn backend_api_handler(
    __arg0: State<ProxyState>,
    req: Request<Body>,
) -> Result<Response, StatusCode>
Expand description

ChatGPT backend calls outside the model rail are not model JSON and must not be compressed or cost-metered. They are credential-preserving passthroughs — of headers. Their bodies are context leaving this machine like any other: each one is admitted by the gateway, bound to the configured ChatGPT upstream in its receipt, and refused with the typed reason when it may not leave. An admitted body is forwarded byte for byte.

A WebSocket upgrade (Codex Desktop remote-control pairing, #597) is tunnelled to chatgpt.com by super::chatgpt_ws, frame by admitted frame; plain HTTP/SSE falls through to the forward below.