Skip to main content

Module openai

Module openai 

Source
Expand description

OpenAI route handler — POST /v1/chat/completions

Intercepts OpenAI API requests, runs the SHIFT optimization pipeline on the payload, records stats with full per-image token savings, and forwards to the real OpenAI API.

The CPU-intensive optimization runs on a blocking thread to avoid starving the tokio event loop.

Functions§

openai_handler
POST /v1/chat/completions — optimize and forward to OpenAI.