Skip to main content

Overview

LiteLLM’s prompt management system allows you to store, version, and dynamically inject prompts from external prompt management tools. This enables:
  • Centralized prompt storage and versioning
  • A/B testing different prompt versions
  • Dynamic prompt updates without code changes
  • Team collaboration on prompt engineering
  • Integration with prompt management platforms

Supported Platforms

  • Langfuse: Full-featured prompt management with versioning
  • Custom: Build your own prompt management integration

Quick Start

1

Configure Prompt Management

Set up your prompt management integration:
2

Use Prompts in Completions

Reference prompts by ID:
3

Version Your Prompts

Specify prompt versions or labels:

Creating Custom Prompt Management

Implement the Base Class

Using Your Custom Integration

Advanced Features

Override Model from Prompt

Override Parameters from Prompt

Message Merging

Prompt templates are prepended to your messages:

Langfuse Integration

Using with LiteLLM Proxy

Configure prompt management in your proxy config:
config.yaml
Then use via OpenAI SDK:

Best Practices

Always use versioning for production prompts:
Check that all required variables are provided:
Test different prompt versions:
Reduce API calls by caching:

Reference

Source Code

  • Base class: litellm/integrations/prompt_management_base.py:22
  • Custom prompt management: litellm/proxy/custom_prompt_management.py:10
  • Langfuse integration: litellm/integrations/langfuse/langfuse_prompt_management.py

Response Format

Prompt management returns: