This integration method is maintained but no longer actively developed. For the best experience and latest features, use our new AI Gateway with unified API access to 100+ models.
LiteLLM is a model I/O library to standardize API calls to Azure, Anthropic, OpenAI, etc. Here's how you can log your LLM API calls to Helicone from LiteLLM using callbacks.
Note: Custom
Properties
are available in metadata starting with LiteLLM version 1.41.23.
System Instructions Limitation: When using LiteLLM callbacks, system instructions for Gemini and Claude may not appear as "role": "system" messages in Helicone logs. This is because LiteLLM processes the request before sending it to Helicone.
For full system instruction support, consider using proxy-based integration instead.
1 line integration#
Add HELICONE_API_KEY to your environment variables.
Tell LiteLLM you want to log your data to Helicone
Complete code#
Feel free to check it out and tell us what you think 👋
For proxy-based integration with LiteLLM, see our LiteLLM Proxy Integration guide.
