Skip to main content

# Prompt library

The prompt library lets you store reusable prompt texts as named entities. Prompts can be referenced by ID from multiple plugins, guardrails, and other features, providing a single source of truth for your prompt texts.

## Entity structure​

    {
      "id": "prompt_xxx",
      "name": "English translator",
      "description": "A system prompt for translating content to English",
      "prompt": "You are a professional translator. Translate the following content to English. Return only the translation, no explanation."
    }

Field | Type | Description
--- | --- | ---
`id` | string | Auto-generated with `prompt_` prefix
`name` | string | A descriptive name for the prompt
`description` | string | What this prompt is used for
`prompt` | string | The actual prompt text

## Where prompts can be referenced​

Prompts can be referenced via their ID (`prompt_ref`) from:

- Request body modifier — system prompt for transforming request bodies
- Response body modifier — system prompt for transforming response bodies
- Response generator — prompt for generating responses
- LLM Response endpoint — prompt with Expression Language
- Context validator — system prompt for validating requests
- WebSocket validator — system prompt for validating WebSocket messages
- LLM guardrails — validation prompt for custom LLM-based guardrails

## Testing prompts​

The admin UI includes a built-in prompt tester. Select a provider and test your prompt directly from the Otoroshi back-office without creating a route.

## Admin API​

    ai-gateway.extensions.cloud-apim.com/v1/prompts

Standard CRUD operations are supported.