Skip to main content
Helicone’s AI Gateway integrates directly with our prompt management system without the need for custom packages or code changes. This guide shows you how to integrate the AI Gateway with prompt management, not the actual prompt management itself. For creating and managing prompts, see Prompt Management.

Why Use Prompt Integration?

Instead of hardcoding prompts in your application, reference them by ID:

Gateway vs SDK Integration

Without the AI Gateway, using managed prompts requires multiple steps:
Why the gateway is better:
  • No extra packages - Works with your existing OpenAI SDK
  • Single API call - Gateway fetches and compiles automatically
  • Lower latency - Everything happens server-side in one request
  • Automatic error handling - Invalid inputs return clear error messages
  • Cleaner code - No prompt management logic in your application

Integration Steps

1

Create prompts in Helicone

Build and test prompts with variables in the dashboard
2

Use prompt_id in your code

Replace messages with prompt_id and inputs in your gateway calls

API Parameters

Use these parameters in your chat completions request to integrate with saved prompts:
string
required
The ID of your saved prompt from the Helicone dashboard
string
default:"production"
Which environment version to use: development, staging, or production
object
required
Variables to fill in your prompt template (e.g., {"customer_name": "John", "issue_type": "billing"})
string
required
Any supported model - works with the unified gateway format

Example Usage

Real-World Examples

Customer Support Bot

Manage support prompts without redeploying:
Benefits:
  • Update prompt wording without code changes
  • A/B test different support approaches
  • Customize responses by customer tier
  • Track prompt version performance

Content Generation Pipeline

Manage prompts across multiple generation steps:
Benefits:
  • Iterate on each prompt independently
  • Use different models for different steps
  • Track which prompt versions produce best content

Multi-language Support

Manage translations through prompts:
Benefits:
  • Fine-tune translations without code changes
  • Manage context-specific translation styles
  • Track translation quality by prompt version

Combining with Provider Routing

Prompts work seamlessly with all gateway features:
Result: Reliable multi-provider routing + centralized prompt management.

Environment Management

Use environments to test prompt changes safely:

Development Environment

Staging Environment

Production Environment

Error Handling

Missing Prompt

Invalid Inputs

Missing Model

If you don’t specify a model, the gateway uses the model from the prompt:

Best Practices

1. Use Descriptive Prompt IDs

2. Version Your Prompts

Use the environment system for versioning:
  • development - Experimental prompts
  • staging - Validated but not production-ready
  • production - Stable, tested prompts

3. Validate Inputs Client-Side

4. Monitor Prompt Performance

Track prompt effectiveness in the Helicone dashboard:
  • Compare costs across prompt versions
  • Analyze response quality
  • Identify problematic inputs
  • A/B test different approaches

5. Use Type Safety

Next Steps

Create Your First Prompt

Learn to build prompts with variables in the dashboard

Provider Routing

Combine prompts with automatic routing and fallbacks for reliability

Automatic Fallbacks

Add resilience to your prompt-powered features

Prompt Registry

Manage all your prompts in one place