Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Add Helicone as a provider and update observability documentation (#17663)

_juliettechee0812a2975c
diff --git a/docs/my-website/docs/observability/helicone_integration.md b/docs/my-website/docs/observability/helicone_integration.md
index 22ea051f7cd..92d0f5c3ebf 100644
--- a/docs/my-website/docs/observability/helicone_integration.md
+++ b/docs/my-website/docs/observability/helicone_integration.md
@@ -10,7 +10,7 @@ https://github.com/BerriAI/litellm
:::
-[Helicone](https://helicone.ai/) is an open source observability platform that proxies your LLM requests and provides key insights into your usage, spend, latency and more.
+[Helicone](https://helicone.ai/) is an open sourced observability platform providing key insights into your usage, spend, latency and more.
## Quick Start
@@ -25,14 +25,10 @@ from litellm import completion
## Set env variables
os.environ["HELICONE_API_KEY"] = "your-helicone-key"
-os.environ["OPENAI_API_KEY"] = "your-openai-key"
-
-# Set callbacks
-litellm.success_callback = ["helicone"]
# OpenAI call
response = completion(
- model="gpt-4o",
+ model="helicone/gpt-4o-mini",
messages=[{"role": "user", "content": "Hi 👋 - I'm OpenAI"}],
)
@@ -54,7 +50,7 @@ model_list:
# Add Helicone callback
litellm_settings:
success_callback: ["helicone"]
-
+
# Set Helicone API key
environment_variables:
HELICONE_API_KEY: "your-helicone-key"
@@ -72,12 +68,12 @@ litellm --config config.yaml
There are two main approaches to integrate Helicone with LiteLLM:
-1. **Callbacks**: Log to Helicone while using any provider
-2. **Proxy Mode**: Use Helicone as a proxy for advanced features
+1. **As a Provider**: Use Helicone to log requests for [all models supported ](../providers/helicone)
+2. **Callbacks**: Log to Helicone while using any provider
### Supported LLM Providers
-Helicone can log requests across [various LLM providers](https://docs.helicone.ai/getting-started/quick-start), including:
+Helicone can log requests across [all major LLM providers](https://helicone.ai/models), including:
- OpenAI
- Azure
@@ -88,156 +84,149 @@ Helicone can log requests across [various LLM providers](https://docs.helicone.a
- Replicate
- And more
-## Method 1: Using Callbacks
+## Method 1: Using Helicone as a Provider
-Log requests to Helicone while using any LLM provider directly.
+Helicone's AI Gateway provides [advanced functionality](https://docs.helicone.ai) like caching, rate limiting, LLM security, and more.
<Tabs>
-<TabItem value="sdk" label="Python SDK">
-
-```python
-import os
-import litellm
-from litellm import completion
-
-## Set env variables
-os.environ["HELICONE_API_KEY"] = "your-helicone-key"
-os.environ["OPENAI_API_KEY"] = "your-openai-key"
-# os.environ["HELICONE_API_BASE"] = "" # [OPTIONAL] defaults to `https://api.helicone.ai`
-
-# Set callbacks
-litellm.success_callback = ["helicone"]
-
-# OpenAI call
-response = completion(
- model="gpt-4o",
- messages=[{"role": "user", "content": "Hi 👋 - I'm OpenAI"}],
-)
-
-print(response)
-```
-
-</TabItem>
-<TabItem value="proxy" label="LiteLLM Proxy">
-
-```yaml title="config.yaml"
-model_list:
- - model_name: gpt-4
- litellm_params:
- model: gpt-4
- api_key: os.environ/OPENAI_API_KEY
- - model_name: claude-3
- litellm_params:
- model: anthropic/claude-3-sonnet-20240229
- api_key: os.environ/ANTHROPIC_API_KEY
-
-# Add Helicone logging
-litellm_settings:
- success_callback: ["helicone"]
-
-# Environment variables
-environment_variables:
- HELICONE_API_KEY: "your-helicone-key"
- OPENAI_API_KEY: "your-openai-key"
- ANTHROPIC_API_KEY: "your-anthropic-key"
-```
-
-Start the proxy:
-```bash
-litellm --config config.yaml
-```
-
-Make requests to your proxy:
-```python
-import openai
-
-client = openai.OpenAI(
- api_key="anything", # proxy doesn't require real API key
- base_url="http://localhost:4000"
-)
-
-response = client.chat.completions.create(
- model="gpt-4", # This gets logged to Helicone
- messages=[{"role": "user", "content": "Hello!"}]
-)
-```
-
-</TabItem>
+ <TabItem value="sdk" label="Python SDK">
+
+ Set Helicone as your base URL and pass authentication headers:
+
+ ```python
+ import os
+ import litellm
+ from litellm import completion
+
+ os.environ["HELICONE_API_KEY"] = "" # your Helicone API key
+
+ messages = [{"content": "What is the capital of France?", "role": "user"}]
+
+ # Helicone call - routes through Helicone gateway to any model
+ response = completion(
+ model="helicone/gpt-4o-mini", # or any 100+ models
+ messages=messages
+ )
+
+ print(response)
+ ```
+
+ ### Advanced Usage
+
+ You can add custom metadata and properties to your requests using Helicone headers. Here are some examples:
+
+ ```python
+ litellm.metadata = {
+ "Helicone-User-Id": "user-abc", # Specify the user making the request
+ "Helicone-Property-App": "web", # Custom property to add additional information
+ "Helicone-Property-Custom": "any-value", # Add any custom property
+ "Helicone-Prompt-Id": "prompt-supreme-court", # Assign an ID to associate this prompt with future versions
+ "Helicone-Cache-Enabled": "true", # Enable caching of responses
+ "Cache-Control": "max-age=3600", # Set cache limit to 1 hour
+ "Helicone-RateLimit-Policy": "10;w=60;s=user", # Set rate limit policy
+ "Helicone-Retry-Enabled": "true", # Enable retry mechanism
+ "helicone-retry-num": "3", # Set number of retries
+ "helicone-retry-factor": "2", # Set exponential backoff factor
+ "Helicone-Model-Override": "gpt-3.5-turbo-0613", # Override the model used for cost calculation
+ "Helicone-Session-Id": "session-abc-123", # Set session ID for tracking
+ "Helicone-Session-Path": "parent-trace/child-trace", # Set session path for hierarchical tracking
+ "Helicone-Omit-Response": "false", # Include response in logging (default behavior)
+ "Helicone-Omit-Request": "false", # Include request in logging (default behavior)
+ "Helicone-LLM-Security-Enabled": "true", # Enable LLM security features
+ "Helicone-Moderations-Enabled": "true", # Enable content moderation
+ }
+ ```
+
+ ### Caching and Rate Limiting
+
+ Enable caching and set up rate limiting policies:
+
+ ```python
+ litellm.metadata = {
+ "Helicone-Cache-Enabled": "true", # Enable caching of responses
+ "Cache-Control": "max-age=3600", # Set cache limit to 1 hour
+ "Helicone-RateLimit-Policy": "100;w=3600;s=user", # Set rate limit policy
+ }
+ ```
+
+ </TabItem>
</Tabs>
-## Method 2: Using Helicone as a Proxy
+## Method 2: Using Callbacks
-Helicone's proxy provides [advanced functionality](https://docs.helicone.ai/getting-started/proxy-vs-async) like caching, rate limiting, LLM security through [PromptArmor](https://promptarmor.com/) and more.
+Log requests to Helicone while using any LLM provider directly.
<Tabs>
-<TabItem value="sdk" label="Python SDK">
-
-Set Helicone as your base URL and pass authentication headers:
-
-```python
-import os
-import litellm
-from litellm import completion
-
-# Configure LiteLLM to use Helicone proxy
-litellm.api_base = "https://oai.hconeai.com/v1"
-litellm.headers = {
- "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}",
-}
-
-# Set your OpenAI API key
-os.environ["OPENAI_API_KEY"] = "your-openai-key"
-
-response = completion(
- model="gpt-3.5-turbo",
- messages=[{"role": "user", "content": "How does a court case get to the Supreme Court?"}]
-)
-
-print(response)
-```
-
-### Advanced Usage
-
-You can add custom metadata and properties to your requests using Helicone headers. Here are some examples:
-
-```python
-litellm.metadata = {
- "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", # Authenticate to send requests to Helicone API
- "Helicone-User-Id": "user-abc", # Specify the user making the request
- "Helicone-Property-App": "web", # Custom property to add additional information
- "Helicone-Property-Custom": "any-value", # Add any custom property
- "Helicone-Prompt-Id": "prompt-supreme-court", # Assign an ID to associate this prompt with future versions
- "Helicone-Cache-Enabled": "true", # Enable caching of responses
- "Cache-Control": "max-age=3600", # Set cache limit to 1 hour
- "Helicone-RateLimit-Policy": "10;w=60;s=user", # Set rate limit policy
- "Helicone-Retry-Enabled": "true", # Enable retry mechanism
- "helicone-retry-num": "3", # Set number of retries
- "helicone-retry-factor": "2", # Set exponential backoff factor
- "Helicone-Model-Override": "gpt-3.5-turbo-0613", # Override the model used for cost calculation
- "Helicone-Session-Id": "session-abc-123", # Set session ID for tracking
- "Helicone-Session-Path": "parent-trace/child-trace", # Set session path for hierarchical tracking
- "Helicone-Omit-Response": "false", # Include response in logging (default behavior)
- "Helicone-Omit-Request": "false", # Include request in logging (default behavior)
- "Helicone-LLM-Security-Enabled": "true", # Enable LLM security features
- "Helicone-Moderations-Enabled": "true", # Enable content moderation
- "Helicone-Fallbacks": '["gpt-3.5-turbo", "gpt-4"]', # Set fallback models
-}
-```
-
-### Caching and Rate Limiting
-
-Enable caching and set up rate limiting policies:
-
-```python
-litellm.metadata = {
- "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}", # Authenticate to send requests to Helicone API
- "Helicone-Cache-Enabled": "true", # Enable caching of responses
- "Cache-Control": "max-age=3600", # Set cache limit to 1 hour
- "Helicone-RateLimit-Policy": "100;w=3600;s=user", # Set rate limit policy
-}
-```
-
-</TabItem>
+ <TabItem value="sdk" label="Python SDK">
+
+ ```python
+ import os
+ import litellm
+ from litellm import completion
+
+ ## Set env variables
+ os.environ["HELICONE_API_KEY"] = "your-helicone-key"
+ os.environ["OPENAI_API_KEY"] = "your-openai-key"
+ # os.environ["HELICONE_API_BASE"] = "" # [OPTIONAL] defaults to `https://api.helicone.ai`
+
+ # Set callbacks
+ litellm.success_callback = ["helicone"]
+
+ # OpenAI call
+ response = completion(
+ model="gpt-4o",
+ messages=[{"role": "user", "content": "Hi 👋 - I'm OpenAI"}],
+ )
+
+ print(response)
+ ```
+
+ </TabItem>
+ <TabItem value="proxy" label="LiteLLM Proxy">
+
+ ```yaml title="config.yaml"
+ model_list:
+ - model_name: gpt-4
+ litellm_params:
+ model: gpt-4
+ api_key: os.environ/OPENAI_API_KEY
+ - model_name: claude-3
+ litellm_params:
+ model: anthropic/claude-3-sonnet-20240229
+ api_key: os.environ/ANTHROPIC_API_KEY
+
+ # Add Helicone logging
+ litellm_settings:
+ success_callback: ["helicone"]
+
+ # Environment variables
+ environment_variables:
+ HELICONE_API_KEY: "your-helicone-key"
+ OPENAI_API_KEY: "your-openai-key"
+ ANTHROPIC_API_KEY: "your-anthropic-key"
+ ```
+
+ Start the proxy:
+ ```bash
+ litellm --config config.yaml
+ ```
+
+ Make requests to your proxy:
+ ```python
+ import openai
+
+ client = openai.OpenAI(
+ api_key="anything", # proxy doesn't require real API key
+ base_url="http://localhost:4000"
+ )
+
+ response = client.chat.completions.create(
+ model="gpt-4", # This gets logged to Helicone
+ messages=[{"role": "user", "content": "Hello!"}]
+ )
+ ```
+
+ </TabItem>
</Tabs>
## Session Tracking and Tracing
@@ -245,57 +234,62 @@ litellm.metadata = {
Track multi-step and agentic LLM interactions using session IDs and paths:
<Tabs>
-<TabItem value="sdk" label="Python SDK">
-
-```python
-import litellm
-
-litellm.api_base = "https://oai.hconeai.com/v1"
-litellm.metadata = {
- "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}",
- "Helicone-Session-Id": "session-abc-123",
- "Helicone-Session-Path": "parent-trace/child-trace",
-}
-
-response = litellm.completion(
- model="gpt-3.5-turbo",
- messages=[{"role": "user", "content": "Start a conversation"}]
-)
-```
-
-</TabItem>
-<TabItem value="proxy" label="LiteLLM Proxy">
-
-```python
-import openai
-
-client = openai.OpenAI(
- api_key="anything",
- base_url="http://localhost:4000"
-)
-
-# First request in session
-response1 = client.chat.completions.create(
- model="gpt-4",
- messages=[{"role": "user", "content": "Hello"}],
- extra_headers={
- "Helicone-Session-Id": "session-abc-123",
- "Helicone-Session-Path": "conversation/greeting"
- }
-)
-
-# Follow-up request in same session
-response2 = client.chat.completions.create(
- model="gpt-4",
- messages=[{"role": "user", "content": "Tell me more"}],
- extra_headers={
- "Helicone-Session-Id": "session-abc-123",
- "Helicone-Session-Path": "conversation/follow-up"
- }
-)
-```
-
-</TabItem>
+ <TabItem value="sdk" label="Python SDK">
+
+ ```python
+ import os
+ import litellm
+ from litellm import completion
+
+ os.environ["HELICONE_API_KEY"] = "" # your Helicone API key
+
+ messages = [{"content": "What is the capital of France?", "role": "user"}]
+
+ response = completion(
+ model="helicone/gpt-4",
+ messages=messages,
+ metadata={
+ "Helicone-Session-Id": "session-abc-123",
+ "Helicone-Session-Path": "parent-trace/child-trace",
+ }
+ )
+
+ print(response)
+ ```
+
+ </TabItem>
+ <TabItem value="proxy" label="LiteLLM Proxy">
+
+ ```python
+ import openai
+
+ client = openai.OpenAI(
+ api_key="anything",
+ base_url="http://localhost:4000"
+ )
+
+ # First request in session
+ response1 = client.chat.completions.create(
+ model="gpt-4",
+ messages=[{"role": "user", "content": "Hello"}],
+ extra_headers={
+ "Helicone-Session-Id": "session-abc-123",
+ "Helicone-Session-Path": "conversation/greeting"
+ }
+ )
+
+ # Follow-up request in same session
+ response2 = client.chat.completions.create(
+ model="gpt-4",
+ messages=[{"role": "user", "content": "Tell me more"}],
+ extra_headers={
+ "Helicone-Session-Id": "session-abc-123",
+ "Helicone-Session-Path": "conversation/follow-up"
+ }
+ )
+ ```
+
+ </TabItem>
</Tabs>
- `Helicone-Session-Id`: Unique identifier for the session to group related requests
@@ -304,52 +298,50 @@ response2 = client.chat.completions.create(
## Retry and Fallback Mechanisms
<Tabs>
-<TabItem value="sdk" label="Python SDK">
-
-```python
-import litellm
-
-litellm.api_base = "https://oai.hconeai.com/v1"
-litellm.metadata = {
- "Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}",
- "Helicone-Retry-Enabled": "true",
- "helicone-retry-num": "3",
- "helicone-retry-factor": "2", # Exponential backoff
- "Helicone-Fallbacks": '["gpt-3.5-turbo", "gpt-4"]',
-}
-
-response = litellm.completion(
- model="gpt-4",
- messages=[{"role": "user", "content": "Hello"}]
-)
-```
-
-</TabItem>
-<TabItem value="proxy" label="LiteLLM Proxy">
-
-```yaml title="config.yaml"
-model_list:
- - model_name: gpt-4
- litellm_params:
- model: gpt-4
- api_key: os.environ/OPENAI_API_KEY
- api_base: "https://oai.hconeai.com/v1"
-
-default_litellm_params:
- headers:
- Helicone-Auth: "Bearer ${HELICONE_API_KEY}"
- Helicone-Retry-Enabled: "true"
- helicone-retry-num: "3"
- helicone-retry-factor: "2"
- Helicone-Fallbacks: '["gpt-3.5-turbo", "gpt-4"]'
-
-environment_variables:
- HELICONE_API_KEY: "your-helicone-key"
- OPENAI_API_KEY: "your-openai-key"
-```
-
-</TabItem>
+ <TabItem value="sdk" label="Python SDK">
+
+ ```python
+ import litellm
+
+ litellm.api_base = "https://ai-gateway.helicone.ai/"
+ litellm.metadata = {
+ "Helicone-Retry-Enabled": "true",
+ "helicone-retry-num": "3",
+ "helicone-retry-factor": "2",
+ }
+
+ response = litellm.completion(
+ model="helicone/gpt-4o-mini/openai,claude-3-5-sonnet-20241022/anthropic", # Try OpenAI first, then fallback to Anthropic, then continue with other models
+ messages=[{"role": "user", "content": "Hello"}]
+ )
+ ```
+
+ </TabItem>
+ <TabItem value="proxy" label="LiteLLM Proxy">
+
+ ```yaml title="config.yaml"
+ model_list:
+ - model_name: gpt-4
+ litellm_params:
+ model: gpt-4
+ api_key: os.environ/OPENAI_API_KEY
+ api_base: "https://oai.hconeai.com/v1"
+
+ default_litellm_params:
+ headers:
+ Helicone-Auth: "Bearer ${HELICONE_API_KEY}"
+ Helicone-Retry-Enabled: "true"
+ helicone-retry-num: "3"
+ helicone-retry-factor: "2"
+ Helicone-Fallbacks: '["gpt-3.5-turbo", "gpt-4"]'
+
+ environment_variables:
+ HELICONE_API_KEY: "your-helicone-key"
+ OPENAI_API_KEY: "your-openai-key"
+ ```
+
+ </TabItem>
</Tabs>
-> **Supported Headers** - For a full list of supported Helicone headers and their descriptions, please refer to the [Helicone documentation](https://docs.helicone.ai/getting-started/quick-start).
+> **Supported Headers** - For a full list of supported Helicone headers and their descriptions, please refer to the [Helicone documentation](https://docs.helicone.ai/features/advanced-usage/custom-properties).
> By utilizing these headers and metadata options, you can gain deeper insights into your LLM usage, optimize performance, and better manage your AI workflows with Helicone and LiteLLM.
diff --git a/docs/my-website/docs/providers/helicone.md b/docs/my-website/docs/providers/helicone.md
new file mode 100644
index 00000000000..3f0cfcbcb28
--- /dev/null
+++ b/docs/my-website/docs/providers/helicone.md
@@ -0,0 +1,268 @@
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+# Helicone
+
+## Overview
+
+| Property | Details |
+|-------|-------|
+| Description | Helicone is an AI gateway and observability platform that provides OpenAI-compatible endpoints with advanced monitoring, caching, and analytics capabilities. |
+| Provider Route on LiteLLM | `helicone/` |
+| Link to Provider Doc | [Helicone Documentation ↗](https://docs.helicone.ai) |
+| Base URL | `https://ai-gateway.helicone.ai/` |
+| Supported Operations | [`/chat/completions`](#sample-usage), [`/completions`](#text-completion), [`/embeddings`](#embeddings) |
+
+<br />
+
+**We support [ALL models available](https://helicone.ai/models) through Helicone's AI Gateway. Use `helicone/` as a prefix when sending requests.**
+
+## What is Helicone?
+
+Helicone is an open-source observability platform for LLM applications that provides:
+- **Request Monitoring**: Track all LLM requests with detailed metrics
+- **Caching**: Reduce costs and latency with intelligent caching
+- **Rate Limiting**: Control request rates per user/key
+- **Cost Tracking**: Monitor spend across models and users
+- **Custom Properties**: Tag requests with metadata for filtering and analysis
+- **Prompt Management**: Version control for prompts
+
+## Required Variables
+
+```python showLineNumbers title="Environment Variables"
+os.environ["HELICONE_API_KEY"] = "" # your Helicone API key
+```
+
+Get your Helicone API key from your [Helicone dashboard](https://helicone.ai).
+
+## Usage - LiteLLM Python SDK
+
+### Non-streaming
+
+```python showLineNumbers title="Helicone Non-streaming Completion"
+import os
+import litellm
+from litellm import completion
+
+os.environ["HELICONE_API_KEY"] = "" # your Helicone API key
+
+messages = [{"content": "What is the capital of France?", "role": "user"}]
+
+# Helicone call - routes through Helicone gateway to OpenAI
+response = completion(
+ model="helicone/gpt-4",
+ messages=messages
+)
+
+print(response)
+```
+
+### Streaming
+
+```python showLineNumbers title="Helicone Streaming Completion"
+import os
+import litellm
+from litellm import completion
+
+os.environ["HELICONE_API_KEY"] = "" # your Helicone API key
+
+messages = [{"content": "Write a short poem about AI", "role": "user"}]
+
+# Helicone call with streaming
+response = completion(
+ model="helicone/gpt-4",
+ messages=messages,
+ stream=True
+)
+
+for chunk in response:
+ print(chunk)
+```
+
+### With Metadata (Helicone Custom Properties)
+
+```python showLineNumbers title="Helicone with Custom Properties"
+import os
+import litellm
+from litellm import completion
+
+os.environ["HELICONE_API_KEY"] = "" # your Helicone API key
+
+response = completion(
+ model="helicone/gpt-4o-mini",
+ messages=[{"role": "user", "content": "What's the weather like?"}],
+ metadata={
+ "Helicone-Property-Environment": "production",
+ "Helicone-Property-User-Id": "user_123",
+ "Helicone-Property-Session-Id": "session_abc"
+ }
+)
+
+print(response)
+```
+
+### Text Completion
+
+```python showLineNumbers title="Helicone Text Completion"
+import os
+import litellm
+
+os.environ["HELICONE_API_KEY"] = "" # your Helicone API key
+
+response = litellm.completion(
+ model="helicone/gpt-4o-mini", # text completion model
+ prompt="Once upon a time"
+)
+
+print(response)
+```
+
+
+## Retry and Fallback Mechanisms
+
+```python
+import litellm
+
+litellm.api_base = "https://ai-gateway.helicone.ai/"
+litellm.metadata = {
+ "Helicone-Retry-Enabled": "true",
+ "helicone-retry-num": "3",
+ "helicone-retry-factor": "2",
+}
+
+response = litellm.completion(
+ model="helicone/gpt-4o-mini/openai,claude-3-5-sonnet-20241022/anthropic", # Try OpenAI first, then fallback to Anthropic, then continue with other models,
+ messages=[{"role": "user", "content": "Hello"}]
+)
+```
+
+## Supported OpenAI Parameters
+
+Helicone supports all standard OpenAI-compatible parameters:
+
+| Parameter | Type | Description |
+|-----------|------|-------------|
+| `messages` | array | **Required**. Array of message objects with 'role' and 'content' |
+| `model` | string | **Required**. Model ID (e.g., gpt-4, claude-3-opus, etc.) |
+| `stream` | boolean | Optional. Enable streaming responses |
+| `temperature` | float | Optional. Sampling temperature |
+| `top_p` | float | Optional. Nucleus sampling parameter |
+| `max_tokens` | integer | Optional. Maximum tokens to generate |
+| `frequency_penalty` | float | Optional. Penalize frequent tokens |
+| `presence_penalty` | float | Optional. Penalize tokens based on presence |
+| `stop` | string/array | Optional. Stop sequences |
+| `n` | integer | Optional. Number of completions to generate |
+| `tools` | array | Optional. List of available tools/functions |
+| `tool_choice` | string/object | Optional. Control tool/function calling |
+| `response_format` | object | Optional. Response format specification |
+| `user` | string | Optional. User identifier |
+
+## Helicone-Specific Headers
+
+Pass these as metadata to leverage Helicone features:
+
+| Header | Description |
+|--------|-------------|
+| `Helicone-Property-*` | Custom properties for filtering (e.g., `Helicone-Property-User-Id`) |
+| `Helicone-Cache-Enabled` | Enable caching for this request |
+| `Helicone-User-Id` | User identifier for tracking |
+| `Helicone-Session-Id` | Session identifier for grouping requests |
+| `Helicone-Prompt-Id` | Prompt identifier for versioning |
+| `Helicone-Rate-Limit-Policy` | Rate limiting policy name |
+
+Example with headers:
+
+```python showLineNumbers title="Helicone with Custom Headers"
+import litellm
+
+response = litellm.completion(
+ model="helicone/gpt-4",
+ messages=[{"role": "user", "content": "Hello"}],
+ metadata={
+ "Helicone-Cache-Enabled": "true",
+ "Helicone-Property-Environment": "production",
+ "Helicone-Property-User-Id": "user_123",
+ "Helicone-Session-Id": "session_abc",
+ "Helicone-Prompt-Id": "prompt_v1"
+ }
+)
+```
+
+## Advanced Usage
+
+### Using with Different Providers
+
+Helicone acts as a gateway and supports multiple providers:
+
+```python showLineNumbers title="Helicone with Anthropic"
+import litellm
+
+# Set both Helicone and Anthropic keys
+os.environ["HELICONE_API_KEY"] = "your-helicone-key"
+
+response = litellm.completion(
+ model="helicone/claude-3.5-haiku/anthropic",
+ messages=[{"role": "user", "content": "Hello"}]
+)
+```
+
+### Caching
+
+Enable caching to reduce costs and latency:
+
+```python showLineNumbers title="Helicone Caching"
+import litellm
+
+response = litellm.completion(
+ model="helicone/gpt-4",
+ messages=[{"role": "user", "content": "What is 2+2?"}],
+ metadata={
+ "Helicone-Cache-Enabled": "true"
+ }
+)
+
+# Subsequent identical requests will be served from cache
+response2 = litellm.completion(
+ model="helicone/gpt-4",
+ messages=[{"role": "user", "content": "What is 2+2?"}],
+ metadata={
+ "Helicone-Cache-Enabled": "true"
+ }
+)
+```
+
+## Features
+
+### Request Monitoring
+- Track all requests with detailed metrics
+- View request/response pairs
+- Monitor latency and errors
+- Filter by custom properties
+
+### Cost Tracking
+- Per-model cost tracking
+- Per-user cost tracking
+- Cost alerts and budgets
+- Historical cost analysis
+
+### Rate Limiting
+- Per-user rate limits
+- Per-API key rate limits
+- Custom rate limit policies
+- Automatic enforcement
+
+### Analytics
+- Request volume trends
+- Cost trends
+- Latency percentiles
+- Error rates
+
+Visit [Helicone Pricing](https://helicone.ai/pricing) for details.
+
+## Additional Resources
+
+- [Helicone Official Documentation](https://docs.helicone.ai)
+- [Helicone Dashboard](https://helicone.ai)
+- [Helicone GitHub](https://github.com/Helicone/helicone)
+- [API Reference](https://docs.helicone.ai/rest/ai-gateway/post-v1-chat-completions)
+
diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js
index 20b94963cf0..93d8a43578d 100644
--- a/docs/my-website/sidebars.js
+++ b/docs/my-website/sidebars.js
@@ -614,6 +614,7 @@ const sidebars = {
"providers/github_copilot",
"providers/gradient_ai",
"providers/groq",
+ "providers/helicone",
"providers/heroku",
{
type: "category",
@@ -850,7 +851,7 @@ const sidebars = {
"Learn how to deploy + call models from different providers on LiteLLM",
slug: "/project",
},
- items: [
+ items: [
"projects/smolagents",
"projects/mini-swe-agent",
"projects/openai-agents",
diff --git a/litellm/constants.py b/litellm/constants.py
index 1c0f800eccd..ed5fee78462 100644
--- a/litellm/constants.py
+++ b/litellm/constants.py
@@ -345,6 +345,7 @@ LITELLM_CHAT_PROVIDERS = [
"huggingface",
"together_ai",
"datarobot",
+ "helicone",
"openrouter",
"cometapi",
"vertex_ai",
@@ -553,6 +554,7 @@ openai_compatible_endpoints: List = [
"https://api.morphllm.com/v1",
"https://api.lambda.ai/v1",
"https://api.hyperbolic.xyz/v1",
+ "https://ai-gateway.helicone.ai/",
"https://ai-gateway.vercel.sh/v1",
"https://api.inference.wandb.ai/v1",
"https://api.clarifai.com/v2/ext/openai/v1",
@@ -598,6 +600,7 @@ openai_compatible_providers: List = [
"moonshot",
"publicai",
"v0",
+ "helicone",
"morph",
"lambda_ai",
"hyperbolic",
diff --git a/litellm/llms/openai_like/providers.json b/litellm/llms/openai_like/providers.json
index 3fb20b2dfc1..a6c19222619 100644
--- a/litellm/llms/openai_like/providers.json
+++ b/litellm/llms/openai_like/providers.json
@@ -10,5 +10,9 @@
"special_handling": {
"convert_content_list_to_string": true
}
+ },
+ "helicone": {
+ "base_url": "https://ai-gateway.helicone.ai/",
+ "api_key_env": "HELICONE_API_KEY"
}
}
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 3dc31a0771c..9824b6db6d6 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -2990,6 +2990,7 @@ class LlmProviders(str, Enum):
LLAMA = "meta_llama"
NSCALE = "nscale"
PG_VECTOR = "pg_vector"
+ HELICONE = "helicone"
HYPERBOLIC = "hyperbolic"
RECRAFT = "recraft"
FAL_AI = "fal_ai"
diff --git a/tests/llm_translation/test_helicone.py b/tests/llm_translation/test_helicone.py
new file mode 100644
index 00000000000..8ca2f62d2bc
--- /dev/null
+++ b/tests/llm_translation/test_helicone.py
@@ -0,0 +1,72 @@
+import os
+import sys
+import pytest
+
+sys.path.insert(
+ 0, os.path.abspath("../..")
+) # Adds the parent directory to the system path
+import litellm
+
+
+def test_completion_helicone():
+ """Test basic completion through Helicone gateway"""
+ litellm._turn_on_debug()
+ resp = litellm.completion(
+ model="helicone/gpt-4o-mini",
+ messages=[{"role": "user", "content": "Say 'Hello from Helicone' and nothing else"}],
+ max_tokens=10,
+ )
+ print(resp)
+ assert resp.choices[0].message.content is not None
+ assert len(resp.choices[0].message.content) > 0
+
+def test_completion_helicone_specific_provider():
+ """Test basic completion through Helicone gateway"""
+ litellm._turn_on_debug()
+ resp = litellm.completion(
+ model="helicone/claude-4.5-haiku/anthropic",
+ messages=[{"role": "user", "content": "Say 'Hello from Helicone' and nothing else"}],
+ max_tokens=10,
+ )
+ print(resp)
+ assert resp.choices[0].message.content is not None
+ assert len(resp.choices[0].message.content) > 0
+
+
+def test_completion_helicone_streaming():
+ """Test streaming completion through Helicone gateway"""
+ litellm._turn_on_debug()
+ resp = litellm.completion(
+ model="helicone/gpt-4o-mini",
+ messages=[{"role": "user", "content": "Count to 3"}],
+ max_tokens=20,
+ stream=True,
+ )
+
+ chunks = []
+ for chunk in resp:
+ print(chunk)
+ if hasattr(chunk.choices[0], "delta") and hasattr(chunk.choices[0].delta, "content"):
+ if chunk.choices[0].delta.content:
+ chunks.append(chunk.choices[0].delta.content)
+
+ full_response = "".join(chunks)
+ assert len(full_response) > 0
+ print(f"Full response: {full_response}")
+
+
+def test_completion_helicone_with_metadata():
+ """Test Helicone with custom properties"""
+ litellm._turn_on_debug()
+ resp = litellm.completion(
+ model="helicone/gpt-4o-mini",
+ messages=[{"role": "user", "content": "Hello"}],
+ max_tokens=10,
+ metadata={
+ "Helicone-Property-Environment": "test",
+ "Helicone-Property-Session": "test-session-123"
+ }
+ )
+ print(resp)
+ assert resp.choices[0].message.content is not None
+