Skip to main content

Prompts page

The Prompts page manages prompt templates stored on the proxy. A prompt has an ID, one or more environments (development, staging and production), and a numbered version history in each environment. Callers use a prompt by sending its prompt_id (and optionally prompt_environment and prompt_version) to /chat/completions. Open the page at /ui/prompts. It sits under AI Gateway in the left nav as Prompts.

The nav item is shown to the session roles Admin (proxy admins) and Admin Viewer (proxy admin viewers). Org admins, internal users and internal viewers do not see it. The page has no extra guard of its own. The backend accepts creating, updating, patching and deleting prompts only from a proxy admin, and reading version history only from a proxy admin or an Admin Viewer. No license feature is checked on this page.

A real-world scenario​

A product team keeps changing the system prompt of their support bot and wants to roll changes out without redeploying the app. They store the prompt on the gateway, the app sends only prompt_id, and the team edits the prompt in the Admin UI and promotes a new version to production when it tests well.

Steps​

  1. Open Prompts under AI Gateway, or go to /ui/prompts, and click Add New Prompt. The Prompt Studio editor opens.

  2. Pick the model, write the Developer message and the Prompt messages, and click Save. In the Publish Prompt dialog type a Name, which becomes the prompt ID, and click Publish. To start from a file instead, click Upload .prompt File on the list, type a Prompt ID, pick the file with Select .prompt File and click Create Prompt. The API call that creates a prompt is in prompt management.

  3. Open the prompt, edit it, try it in the chat panel on the right of the editor and save a new version.

  4. Call it from the app with its id.

    curl http://localhost:4000/v1/chat/completions \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
    -d '{"model": "gpt-5.5", "prompt_id": "support-bot", "messages": [{"role": "user", "content": "Where is my order?"}]}'

Expected result​

The prompt is listed with its versions, and the request is answered with the stored prompt applied before the user's message.

Page tabs​

The Prompts page has four tabs. Prompts is the list described below. The other three are the prompt operations controls.

TabWhat it does
PromptsThe prompt list.
PartialsLists every partial with its include tag, such as {{> tone}}, its newest version and description. View and edit shows every version's text, Delete removes a partial that no prompt uses, and Save a partial (Name, Text, Description, then Save partial) adds a new version. Help text next to each field explains it.
Git syncLists the connected GitLab and Bitbucket repositories with their last pull and last error, with Pull, Push and Remove buttons. Connect a repository takes Name, Provider, Repository, Branch and folder, Save pulled prompts in, Self-managed GitLab address and Access token, then Connect repository. The token is never shown again.
Protection and alertsProtected environments (one checkbox per environment), Require a passed eval to promote, Email these people about prompt changes and Send that email when a prompt is, then Save settings. Each control carries plain-English help with its default. Admin viewers see the values with the controls turned off.

Prompt list​

ControlTypeWhat it does
Add New PromptButtonOpens the prompt editor with a blank prompt. Shown only to the session role Admin.
Upload .prompt FileButtonOpens the Add New Prompt dialog for uploading a file. Shown only to the session role Admin.
Environment filterSelectAll Environments (default), Development, Staging or Production. Changing it reloads the list for that environment.

The table sorts by Created At newest first, paginates in the browser with 25, 50 or 100 rows per page, and shows No prompts yet when the list is empty. A prompt that exists in several environments has one row per environment.

ColumnMeaning
Prompt IDThe prompt ID. Click it to open the prompt details for that environment. Sortable.
ModelThe model named in the prompt, with the provider logo when the model hub knows the model. A dash means no model is set.
Created AtWhen the prompt was created. Sortable.
Updated AtWhen it last changed. Sortable.
EnvironmentA badge with development, staging or production. A prompt without an environment counts as development.
Created ByThe user who created it, linked to the user's page.
TypeThe prompt type, for example db for a prompt saved in the database or config for one from the config file.
ActionsA menu with Copy prompt ID, and Delete for the session role Admin.

Delete in the row menu opens a Delete Prompt dialog that asks whether to delete that environment's copy of the prompt. It deletes every version of the prompt in that one environment and keeps the other environments. Click Delete to confirm or Cancel to keep it. It cannot be undone. The proxy refuses to delete a prompt that comes from the config file.

Add New Prompt dialog​

This dialog creates a prompt from a .prompt file in the dotprompt format.

FieldTypeWhat it does
Prompt IDText, requiredThe new prompt's ID. It may contain only letters, numbers, underscores and hyphens.
Prompt IntegrationSelectdotprompt is the only option and the default.
Prompt FileFile pickerSelect .prompt File picks the file. Only names ending in .prompt are accepted. The selected file name shows with a remove button.

Create Prompt first sends the file to the proxy to convert it to JSON, then creates the prompt under the Prompt ID you typed, whatever the file is called. Without a file you see Please upload a .prompt file. If the conversion fails you see Failed to convert prompt file to JSON. The new prompt is saved in the default environment. Cancel closes the dialog and clears it.

Prompt details view​

Opening a prompt shows Prompt Details with the prompt ID and a copy button. Back to Prompts returns to the list.

ControlWhat it does
Get CodeOpens the generated code dialog described below.
Prompt StudioOpens the prompt editor with the version you are viewing. Shown to everyone who can open the page.
CompareOpens Compare versions: pick a left and right environment and an optional version number for each, then Compare. Removed lines show in red, added lines in green, and changed settings such as the model or temperature in a table. Shown to everyone who can open the page.
PromoteShown to the session role Admin. Opens Promote with From environment, Version (empty for the newest), To environment, Eval run id and Note, each with help text, then Promote. A protected environment such as production only accepts the promotion when the eval run tested exactly that version and passed. See prompt operations.
Delete PromptShown to the session role Admin. Opens a Delete Prompt dialog that asks to delete the prompt from every environment. Click Delete to confirm. Every version in every environment is removed, and it cannot be undone.
Environment buttonsOne button per environment the prompt exists in, ordered development, staging, production. The selected one shows the latest version number. Clicking one loads that environment and its version history.

A version that was promoted shows a line such as Promoted from staging v3 after eval run run_8f2c1a passed by admin@example.com.

When you view a version older than the latest, a banner says which version you are viewing and which is the latest, with a Go to latest button.

The view has these tabs.

TabWhat it shows
OverviewCards for Version, Prompt Type, Created By and Created At (with the update time), then a Version History table for the selected environment.
Prompt TemplateShown when the prompt has template content. It shows the Template ID, the Content with a Copy Content button, and any Template Metadata.
Raw JSONThe full response from the proxy, with a Copy JSON button.

The Version History table lists each Version with a latest badge on the newest, Created By and Date. Clicking a row loads that version into the view. The Edit button in a row opens that version in the prompt editor. When the environment has no versions you see No versions found in followed by the environment name.

Prompt editor​

The editor opens from Add New Prompt, Prompt Studio or a version's Edit button. The left half edits the prompt and the right half is a test chat.

ControlTypeWhat it does
BackButtonLeaves the editor without saving.
Prompt nameTextThe prompt name. A new prompt starts as New prompt. On save the name becomes the prompt ID, lowercased with every character other than letters, numbers, underscores and hyphens turned into an underscore.
Version badgeBadgeThe version you loaded, such as v3.
EnvironmentSelectWhich copy of the prompt you edit: Development (default for a new prompt), Staging or Production. Saving adds a version to this environment only, so applications that ask for another environment keep their copy, and applications that send no environment get production first, then staging, then development. Hovering the selector shows the same explanation. When you edit an existing prompt, switching loads that environment's latest version. If the environment has no version yet, the current content stays.
Draft badge and Unsaved changes textLabelsShown once you change anything after loading or saving, and hidden again when you load a version.
Get CodeButtonOpens the generated code dialog for the prompt as it is named in the header.
HistoryButtonShown when editing an existing prompt. Opens the version history panel.
Save or UpdateButtonSaves the prompt.

Save on a new prompt that is still called New prompt, or has no name, opens a Publish Prompt dialog that asks for a Name and explains that published prompts are versioned and can be used in API calls. Press Enter or click Publish to save. Update on an existing prompt saves a new version in the selected environment, so earlier versions stay in the history. The proxy refuses to update a prompt that comes from the config file.

Model and parameters​

ControlTypeWhat it does
ModelModel selectorThe model the prompt runs on. A new prompt starts with gpt-4o.
ParametersButtonOpens Model Parameters with Temperature (0 to 2 in steps of 0.1, default 1) and Max Tokens (1 to 32768, default 1000). Temperature sets how varied the replies are: low values give steady, repeatable answers for support and extraction, high values give more creative wording. Max Tokens caps the length of a reply, which keeps cost and wait time down but can cut long answers short. Both are saved with the prompt and sent with every request that uses it, unless the request is told to ignore the prompt's own settings. Hovering each label shows the same help.
PRETTY and DOTPROMPTTogglePRETTY shows the editing cards. DOTPROMPT shows the generated .prompt file that will be saved.

Editing cards​

CardWhat it does
ToolsLists the tools attached to the prompt, or No tools added. Add opens the Add Tool dialog with a sample function definition. Paste a tool definition in JSON and click Add. Invalid JSON shows Invalid JSON format. Please check your syntax. Each tool row has Edit and a remove button.
Developer messageOptional system instructions for the model.
Prompt messagesThe messages of the prompt. Each has a role (User, Assistant or System), a text box, a remove button when there is more than one message, and a drag handle to reorder. Add message adds a user message.

Template variables are written as a variable name wrapped in double curly braces. Under each text box a Detected variables row lists the variables found. Click one to rename it in place with Save or Cancel.

Test chat​

The right half sends the unsaved prompt to the proxy's prompt test route and streams the reply. It is a real model call and costs money.

When the prompt has variables, a box asks you to fill in each one first, and the send button stays disabled until all are filled. A warning lists any variable that is still missing. Type a message and press Enter to send (Shift+Enter adds a line). While a reply streams, Cancel stops it. Assistant replies show the model and, when reported, time to first token, total latency and token usage. Clear Chat empties the conversation and asks for the variables again. Errors appear in the chat as an assistant message that starts with Error:.

Every message, including the first, is sent to the model after the prompt's own messages rendered with your variables. Each turn sends the prompt messages, the variables and the whole conversation so far.

Version history panel​

History opens a Version History side panel. It lists every version of the prompt with its number, a Latest badge on the newest and an Active badge on the one loaded, its creation time, and whether it is Saved to Database or a Config Prompt. Clicking a version loads it into the editor. Press Escape or the close button to close the panel. When there are no versions you see No version history available.

Generated code dialog​

Get Code opens Generated Code. Pick a Language (cURL, Python (OpenAI SDK) or JavaScript (OpenAI SDK)) and a tab (Basic, With Messages or With Version). The snippet calls /chat/completions with the prompt ID and environment, and includes example values for any template variables. Copy to Clipboard copies it.

The snippet uses the placeholder sk-... as the key, and the dialog says "Replace sk-... with a virtual key from Virtual Keys. Your login session token is never put in generated code." Put a virtual key in its place before you run the code.

Empty, error and disabled states​

WhereWhat you seeWhat to do
No promptsNo prompts yet in the table.Add a prompt or upload a .prompt file.
List fails to loadAn empty table. The error is only written to the browser console.Check that the proxy has a database connected.
Prompt fails to loadFailed to load prompt information, then Prompt not found.Go back and pick the prompt again.
A version fails to loadFailed to load version followed by the version number.Try another version.
Save failsFailed to save prompt or Failed to update prompt.Check the name and your role. Config prompts cannot be updated.
Delete failsFailed to delete prompt.Config prompts cannot be deleted, and only proxy admins can delete.
Test chat send disabledThe message is empty, a reply is streaming, or a variable is not filled.Fill every variable and type a message.
Tool JSON invalidInvalid JSON format. Please check your syntax.Fix the JSON.

Differences by role and license​

WhoWhat changes
Admin (proxy admin)Sees every control and every action works.
Admin ViewerReads the list, the details and the version history under the view-only banner. Add New Prompt, Upload .prompt File, Delete, Delete Prompt, Promote, the partial and Git sync write buttons and Save settings are hidden, and Compare still works. Prompt Studio still opens the editor, but the proxy refuses saves and the test chat.
Org admin, internal user, internal viewerThe nav item is hidden. Version history and every change are refused by the backend.

No license feature gates this page. Setting the prompts field in a key's or team's metadata on other pages needs a license that includes the scoped_integrations feature.

Errors​

What you seeWhat it meansFix
Please upload a .prompt fileNo file was picked.Pick a .prompt file.
Failed to convert prompt file to JSONThe file is not valid dotprompt.Fix the file's front matter and template.
A request fails with 403 naming the prompt idThe key's or team's prompts list leaves the prompt out.Add the prompt to the list, or use another key.
A toast with The production environment is protected. ... after Update or DeleteProduction only takes promoted versions.Save in staging and click Promote.
A toast with Eval run ... did not pass its quality gate after PromoteThe eval run failed, or has no gate.Fix the prompt and run the eval again.
A reply ignores the promptNo prompt with that id and environment exists, and the gateway sent the request without a template.Check the id and prompt_environment.

Logs​

The page writes no log lines of its own. A failed save shows the gateway's reason in a toast, and the gateway logs the reason as Error creating prompt, Error updating prompt or Error patching prompt, see prompt management logs.