Skip to main content

Prompt Store

Manage and version system prompts centrally, then reference one or more of them and add inline instructions at request time.

How It Works

Prompt Stored
ID: code-reviewer
"You are a {{tone}} reviewer"
API References It
system: quilrai-prompt-store-code-reviewer
vars: {tone: "formal"}
QuilrAI Resolves
"You are a formal reviewer"
Sent to LLM
QuilrAI
  1. Create - Store a prompt with a unique ID (e.g., code-reviewer)
  2. Reference - Use it as the system message content: quilrai-prompt-store-code-reviewer
  3. Gateway Resolves - The gateway resolves the prompt and sends the full text to the LLM

Combining Prompts and Instructions

A system message is not limited to a single reference. The gateway scans it for quilrai-prompt-store-<id> reference tokens and replaces each one in place with that prompt's resolved content, leaving any other text exactly where you wrote it. So one system message can:

  • Reference several prompts - list multiple quilrai-prompt-store-<id> tokens and the gateway stitches their resolved content together in the order written.
  • Mix in your own instructions - add freeform text around the references to extend the stored prompt for a single request, without editing the stored prompt itself.

System message your app sends:

quilrai-prompt-store-startup-advisor

Be concise, practical, and honest. Always answer in English.

Stored prompt startup-advisor:

You are an experienced startup advisor, venture capitalist, product strategist, and entrepreneur.

Your role is to challenge assumptions, identify risks, and provide actionable recommendations.

Resolved prompt sent to the LLM:

You are an experienced startup advisor, venture capitalist, product strategist, and entrepreneur.

Your role is to challenge assumptions, identify risks, and provide actionable recommendations.

Be concise, practical, and honest. Always answer in English.

Referencing multiple prompts works the same way - each token resolves independently and the surrounding layout is preserved:

quilrai-prompt-store-base-policy
quilrai-prompt-store-code-reviewer

Only review the security-sensitive files in this diff.
tip

References and inline text are stitched together top-to-bottom in the order they appear. Put foundational prompts first and request-specific instructions last so the model reads them in a natural order.

Template Variables

Prompts support {{variable}} placeholders. Pass values via the X-Prompt-Variables header, keyed by the reference each set of values belongs to.

Prompt template (code-reviewer):

You are a {{tone}} code reviewer for {{language}}.

X-Prompt-Variables header:

{"quilrai-prompt-store-code-reviewer": {"tone": "formal", "language": "Python"}}

Resolved prompt sent to LLM:

You are a formal code reviewer for Python.

When a system message references several prompts, give each one its own entry - the gateway applies each variable set only to its matching reference:

{
"quilrai-prompt-store-code-reviewer": {"tone": "formal", "language": "Python"},
"quilrai-prompt-store-base-policy": {"region": "EU"}
}

Enforce System Prompts

Require System From Store ensures every request's system message includes at least one managed Prompt Store reference, so no request runs without a reviewed, versioned base prompt.

ModeBehavior
EnabledEvery system message must contain at least one valid Prompt Store reference (quilrai-prompt-store-<id>). You can list multiple references and add your own inline instructions around them - the request is accepted as long as a valid reference is present. A system message with freeform text but no valid reference, or no system message at all, is rejected with a 400 (system_prompt_not_found).
Disabled (default)Both stored references and fully freeform system prompts are accepted.

This applies uniformly across Chat Completions, Anthropic Messages (both the top-level system field and any system-role messages), Vertex/Gemini, and the OpenAI Responses API. Useful when you want every system prompt to build on a reviewed, versioned base from the Prompt Store while still allowing per-request instructions.

Code Examples

OpenAI

from openai import OpenAI

client = OpenAI(
base_url='https://guardrails-usa-2.quilr.ai/openai_compatible/',
api_key='sk-quilr-xxx'
)

response = client.chat.completions.create(
model='gpt-4o-mini',
messages=[
{'role': 'system', 'content': 'quilrai-prompt-store-code-reviewer'},
{'role': 'user', 'content': 'Review this code'}
],
extra_headers={
'X-Prompt-Variables': '{"quilrai-prompt-store-code-reviewer": {"tone": "formal", "language": "Python"}}'
}
)

Anthropic

import anthropic

client = anthropic.Anthropic(
base_url='https://guardrails-usa-2.quilr.ai/anthropic_messages/',
api_key='sk-quilr-xxx'
)

message = client.messages.create(
model='claude-sonnet-4-20250514',
max_tokens=1024,
system='quilrai-prompt-store-code-reviewer',
messages=[
{'role': 'user', 'content': 'Review this code'}
],
extra_headers={
'X-Prompt-Variables': '{"quilrai-prompt-store-code-reviewer": {"tone": "formal", "language": "Python"}}'
}
)

Combining references and instructions

Reference one or more stored prompts and add per-request instructions in the same system message. The gateway resolves each quilrai-prompt-store-<id> token in place and keeps your inline text.

from openai import OpenAI

client = OpenAI(
base_url='https://guardrails-usa-2.quilr.ai/openai_compatible/',
api_key='sk-quilr-xxx'
)

system_prompt = """quilrai-prompt-store-startup-advisor

Be concise, practical, and honest. Always answer in English."""

response = client.chat.completions.create(
model='gpt-4o-mini',
messages=[
{'role': 'system', 'content': system_prompt},
{'role': 'user', 'content': 'Should I raise a seed round now?'}
]
)

The model receives the stored startup-advisor prompt followed by your inline instructions.