Skip to main content

Overview

Helicone AI Gateway integrates seamlessly with Helicone’s prompt management system, allowing you to:
  • Use versioned prompts stored in Helicone
  • Dynamically inject prompt variables
  • Track prompt usage across providers
  • Deploy prompts without code changes
Prompt integration works with all gateway features including routing, fallbacks, and BYOK/PTB.

How It Works

When you include prompt fields in your request, the gateway:
  1. Fetches the prompt template from Helicone
  2. Injects your input variables
  3. Expands the template into messages
  4. Routes to the appropriate provider

Using Prompts with the Gateway

Basic Prompt Usage

What happens:
  1. Gateway fetches the “pirate-bot” prompt template
  2. Injects person: "Alice" into the template
  3. Expands to full messages array
  4. Routes to GPT-4o-mini

Model from Prompt

You can omit the model field and use the model defined in the prompt:
If both model and prompt_id are provided, the model in the request takes precedence.

Prompt Versioning

Use specific prompt versions:

Environment-Specific Prompts

Use different prompt versions per environment:

Prompt Fields

string
required
The ID of the prompt to use from Helicone
object
required
Key-value pairs to inject into the prompt template
string
Specific version of the prompt to use (default: latest)
string
Environment to use for prompt resolution: production, staging, or development
string
Override the model defined in the prompt

Creating Prompts

Create and manage prompts in the Helicone dashboard:
1

Navigate to Prompts

Go to Prompts in the Helicone dashboard
2

Create New Prompt

Click “New Prompt” and define:
  • Prompt ID (e.g., “pirate-bot”)
  • Model to use
  • Message template with variables
  • Version tags
3

Add Variables

Use {{ variable_name }} syntax in your prompt:
4

Deploy

Save and deploy your prompt

Prompt Format with hpf

Use the Helicone Prompt Format (hpf) helper in your code:
The hpf helper automatically tracks prompt variables and associates them with the prompt ID.

Prompts with Fallbacks

Combine prompts with provider fallbacks:
Behavior:
  1. Fetches “pirate-bot” prompt
  2. Tries GPT-4o on OpenAI
  3. Falls back to Azure if needed
  4. Falls back to Claude if needed

Using with Helicone-Auth Header

When using the traditional proxy pattern with Helicone-Auth header:

Prompt Tracking

All requests using prompts are automatically tracked:
1

View Prompt Usage

Navigate to Prompts in the dashboard
2

Select Your Prompt

Click on a prompt to see:
  • Total requests
  • Success rate
  • Cost by provider
  • Latency metrics
3

Analyze Performance

Compare versions and environments:
  • Which version performs best?
  • Which provider is most cost-effective?
  • Where are errors occurring?

Advanced Patterns

Dynamic Model Selection

Use prompt fields with dynamic models:

Conditional Prompt Selection

Select prompts based on context:

A/B Testing Prompts

Test different prompt versions:

Error Handling

Prompt Not Found

Missing Required Inputs

Invalid Version

Best Practices

Use semantic versioning for prompts:
  • v1.0.0: Major changes (breaking)
  • v1.1.0: Minor improvements
  • v1.1.1: Bug fixes
Pin critical production code to specific versions:
Deploy different prompts per environment:
Monitor prompt metrics in the dashboard:
  • Success rate by version
  • Cost per prompt
  • Latency trends
  • Provider distribution
Test prompt changes thoroughly:
  1. Deploy to development environment
  2. Test with various inputs
  3. Promote to staging
  4. Deploy to production after validation
Use clear, descriptive prompt IDs:

Complete Example

Next Steps

Create Prompts

Start creating prompts in the dashboard

Routing

Learn about provider routing

Fallbacks

Configure automatic failover

Prompt Docs

Full prompt management documentation