LiteLLM Integration with Proxy
Connect Helicone with LiteLLM through proxies for OpenAI, Azure, and Gemini to add logging, monitoring and advanced functionality.
What is Proxy Integration?
Using Helicone as a proxy allows your LiteLLM requests to flow through Helicone’s infrastructure before reaching the LLM provider. This enables powerful features like:
- Request Caching - Save money by reusing identical requests
- Rate Limiting - Control your API usage
- Retries - Automatically retry failed requests
- Advanced Logging - Capture detailed metrics and request/response payloads
Unlike callback-based integration, proxy integration works at the network level and can provide more functionality for supported providers.
OpenAI and Azure Integration
Helicone offers native proxy support for OpenAI and Azure through LiteLLM. This is the simplest integration method.
Implementation Steps
-
Install dependencies
-
Configure LiteLLM to use the Helicone proxy
-
Make API calls as usual
Gemini Integration
Gemini integration requires a special approach because of how the Vertex AI APIs are structured. We need to use a monkey patch with LiteLLM’s Router to correctly route requests through Helicone.
Why a Monkey Patch?
Gemini’s API structure differs from OpenAI’s, and LiteLLM’s default proxy handling doesn’t properly route Gemini requests through Helicone. The patch modifies LiteLLM’s internal URL handling to correctly work with Helicone’s Gemini proxy endpoints.
Implementation Steps
-
Install dependencies
-
Set up environment variables
-
Configure the LiteLLM Router
-
Apply the monkey patch
-
Make API calls
Using with Other Providers
For LLM providers beyond OpenAI, Azure, and Gemini, the integration approach varies by provider:
- Each provider has a specific Helicone proxy URL format (e.g., OpenAI uses
oai.helicone.ai/v1
) - Some providers require the
Helicone-Target-Url
header, while others don’t
Consult the Helicone documentation for provider-specific proxy endpoints and required headers. If your provider isn’t explicitly supported, reach out to the Helicone team for guidance.
For callback-based integration with LiteLLM, see our LiteLLM Callbacks Integration guide.
Was this page helpful?