Skip to Content

Advanced configurations

How a prompt call merges with your request, which version runs, streaming, and templates.

This page covers what happens when your code calls a saved prompt. To create, commit, and deploy a prompt, start with the Quickstart.

Prompt schema

schema_version in the prompt object decides how the saved prompt merges with the rest of your request. Use v2 for new code.

v2 (recommended)v1 (default)
Turn it on"schema_version": 2Omit schema_version, or set 1
Model, parameters, toolsThe prompt winsYour request wins, unless override: true
MessagesThe prompt’s messages come first, then yoursYours replace the prompt’s, unless override: true
Change settings per callpatchoverride_params and override_config

With v2, the model you send only fills the SDK’s required field, and messages can be empty. Put per-call changes in patch:

Python
response = client.chat.completions.create( model="gpt-5.5", # the prompt's saved model is used messages=[], extra_body={ "prompt": { "prompt_id": "YOUR_PROMPT_ID", "schema_version": 2, "variables": {"ticket_body": "I was charged twice this month."}, "patch": {"temperature": 0.9, "max_tokens": 500}, } }, )

patch can’t contain messages or input. The request fails with HTTP 400 if it does.

With the Responses API, pass the prompt in respan_params.prompt with schema_version: 2. The prompt’s messages become instructions, and your input stays the user turn.

v1 override options
FieldEffect
overridetrue: the prompt wins every conflict. false (default): your request wins.
override_paramsSettings that replace the prompt’s, for example {"temperature": 0.8}. Can include messages.
override_config{"messages_override_mode": "append"} adds override_params.messages after the prompt’s messages. "override" (default) replaces them.
Python
extra_body={ "prompt": { "prompt_id": "YOUR_PROMPT_ID", "override": True, "override_config": {"messages_override_mode": "append"}, "override_params": {"messages": [{"role": "user", "content": "Keep it under 50 words."}]}, } }

Deployment & versioning

To choose the version a call runs, or to roll back in the editor, see Choose which version a call uses and Ship a new version.

To manage versions from code, use the Prompts API:

Streaming

Which setting controls streaming depends on the prompt schema:

  • v2: your request’s stream decides. The prompt’s Stream setting is ignored.
  • v1 with override: true: the prompt’s Stream setting (in Model settings) applies. If it’s True, set stream=True in your call so your SDK reads the stream.
Python
stream = client.chat.completions.create( model="gpt-5.5", # the prompt's saved model is used messages=[], stream=True, extra_body={"prompt": {"prompt_id": "YOUR_PROMPT_ID", "schema_version": 2}}, ) for chunk in stream: print(chunk.choices[0].delta.content or "", end="")

Variables & Jinja templates

Add a variable to a message with {{variable_name}}. Names can’t contain spaces. Respan renders messages as Jinja2  templates, so you can also use conditions, loops, filters, and dot access on objects:

Jinja
{% if customer.plan == "Enterprise" %}Mention their dedicated support line.{% endif %} Recent orders: {% for order in customer.orders %}- {{ order.id }}: {{ order.status }} {% endfor %}

In the editor’s Variables tab, each variable has a type. From code, send each type like this:

TypeValue in variables
TextA string.
Image{"_type": "image_url", "value": "https://example.com/receipt.png"}
ObjectAny JSON object, for use with dot access and loops.
PromptA prompt object. See Prompt composition.

Prompt logging

If you call the model yourself and send logs with Create span, add a prompt object so the span links to the prompt:

JSON
{ "model": "gpt-5.5", "prompt_messages": [{ "role": "user", "content": "I was charged twice this month." }], "completion_message": { "role": "assistant", "content": "Sorry about the double charge. I've refunded it." }, "prompt": { "prompt_id": "YOUR_PROMPT_ID", "variables": { "ticket_body": "I was charged twice this month." } } }

For a prompt you manage outside Respan, use your own ID and add "is_custom_prompt": true to the prompt object.

Prompt object reference

The prompt object you send with a chat completion:

FieldTypeDescription
prompt_idstringRequired. The prompt’s ID, shown in the editor’s side panel.
variablesobjectValues for the prompt’s variables. See Variables & Jinja templates.
versioninteger or "latest"The version to run. Omit it for the deployed version. See Choose which version a call uses.
schema_versioninteger2 for the recommended merge rules. Default 1. See Prompt schema.
patchobjectv2 only. Settings that replace the prompt’s for this call. No messages or input.
overridebooleanv1 only. true lets the prompt win conflicts. Default false.
override_paramsobjectv1 only. Settings that replace the prompt’s for this call.
override_configobjectv1 only. messages_override_mode: "append" or "override" (default).