Prompts: Change your prompts. Without redeploying your app.

Connect a managed template once. Save new versions, pin the one production uses, and switch back when you need to.

Watch a prompt change without a deploy.

How Prompts works. Connect once. Render into a system message.

Save new versions as you iterate

Every saved edit creates a new version in your history, so you can draft updates and switch back when needed.

  • Saving a new version sets it as the active template default
  • Switch or roll back versions in the dashboard without redeploying code
  • Pass nrouter_prompt_template_id on a call, or assign by key, team, or org
support-reply, version historyv5tone: formalv6adds order numberv7shorter greetingv8adds refund lineactiveSaving a version makes it the active default.

Pin the version production serves

Saving a version makes it active, while a production pin keeps live requests on your chosen version.

  • A pinned production version overrides the active version at request time
  • Activating another version leaves production on its pin until you move it
  • Owners and Organization Admins can pin or unpin production versions
active (latest save)v8production pinv7live requestThe pin overrides the active versionat request time.Production stays on v7 until you move the pin.Owners and Organization Admins pin and unpin.

Supply request variables at call time

Fill {{name}} placeholders with string, number, or boolean values. Missing variables return HTTP 400.

  • Template rendering runs before credit reservation and provider dispatch
  • Unresolved {{name}} placeholders or non-scalar values return HTTP 400
  • Rendered templates exceeding 256 KiB return HTTP 400 and spend $0.00
templateHi Asha, order 4471 is on its way.variables: { name: "Asha", order: 4471 }rendered, then sentStrings, numbers or booleans,filled at call time.

A/B testing for non-streaming requests

Split non-streaming traffic across prompt or model variants, assigned consistently per API key or user.

  • Requires at least two variants whose weights sum to 1.0 (±0.01)
  • Assigns requests consistently by virtual key or user ID
  • Streaming requests selected into a running experiment return HTTP 400
variant Aweight 0.5variant Bweight 0.5u_01u_02u_03u_04The same user or key always gets the same variant.non-streaming only; weights sum to 1.0

Take a closer look. How the SDK works.

  1. 01

    Install

    One package for your language. Python and TypeScript shown; every official SDK works the same way.

    pip install nrouter-sdknpm install @nrouter_ai/sdk
  2. 02

    Create a client

    nRouter() reads NROUTER_API_KEY from your environment and sends each call to api.nrouter.ai. Provider keys are ours to manage.

    client = nRouter()
  3. 03

    Call any model

    The OpenAI-compatible calls you already know. nRouter’s options ride on the same request; each topic below shows one.

    client.chat.completions.create(…)

Already on the OpenAI SDK? Point its base URL at https://api.nrouter.ai/v1 and keep your code.

The gateway renders the pinned version, strips the selector fields, and prepends the result as a system message ahead of your messages.

curl -X POST https://api.nrouter.ai/v1/chat/completions \
-H "Authorization: Bearer $NROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-luna",
"nrouter_prompt_template_id": "4b68e9a2-2bf1-4e78-98e3-057d2f9547d2",
"nrouter_prompt_variables": { "tier": "enterprise" },
"messages": [{ "role": "user", "content": "Summarize account status." }]
}'

Read the docs

FAQs

How do active versions and production pins work when I save or roll back?

Saving a new version also sets it as the active version. If a version is pinned to production, that pinned version overrides the active version at request time—so activating another version alone will not change production until you move or clear the pin. Owners and Organization Admins can pin, unpin, or activate versions in the dashboard; once your application is integrated, switching or rolling back requires no application redeploy.

How does a request select a template, and where does the rendered prompt land?

You can pass nrouter_prompt_template_id and nrouter_prompt_variables in extra_body on the request, or bind a template in the dashboard by virtual key, team, or organization. When no template ID is sent on the call, assignments resolve in order of specificity: key, then team, then organization. The gateway strips the extra_body selector fields before forwarding; on chat completions, it prepends the rendered prompt as a system message ahead of your existing messages array (and sets or prepends system or instructions on other text routes).

How do template variables, system context, and size limits work?

Templates substitute double-brace placeholders ({{name}} and {{ name }}) with string, number, or boolean values—without loops, conditionals, or template filters. Request variables override default assignment variables, and authenticated system variables (org_name, model, timestamp, and user_id) are applied last so caller input cannot overwrite them. Rendering runs before credit reservation and provider dispatch: if any placeholder is left unresolved, a variable is not a string, number, or boolean, or the rendered prompt exceeds the 256 KiB ceiling, the gateway returns HTTP 400 and charges $0.00.

How does A/B testing work, and what are the limits for streaming and shared keys?

An A/B test splits non-streaming traffic across two or more prompt or model variants whose weights sum to 1.0 (±0.01) and records latency, token usage, and cost for completed calls. Assignment is deterministic per virtual key (or user ID), so a single shared API key stays on one variant rather than splitting its individual calls 60/40. Streaming requests selected into a running experiment are refused with HTTP 400 before provider dispatch; requests that are not selected into the experiment can still stream normally.

Is prompt management enabled automatically for every organization?

Prompt management is controlled by an organization-level setting. If prompt management is disabled for your organization, regular inference calls proceed normally, while requests that pass nrouter_prompt_template_id or nrouter_prompt_variables are refused with HTTP 400. Once enabled and connected via extra_body or a scope assignment, your team can iterate on templates without redeploying application code.

How is prompt data stored and what is sent to model providers?

Templates, versions, and assignments are scoped to your organization, and gateway prompt execution records store metadata only (such as template ID, version number, model, and variant name) without saving prompt or completion text. When a request runs, the rendered prompt is sent to the selected upstream model provider to generate the response, and any optional request-content logging follows your organization data policy.

  1. Template rendering runs before credit reservation and provider dispatch. Missing or unresolved {{name}} placeholders, non-scalar variable values (anything other than string, number, or boolean), or rendered templates exceeding the 256 KiB technical limit return HTTP 400 and spend $0.00.
  2. Saving a new version activates it as the template default. When a version is pinned to production, the pinned version takes precedence over the active version at request time. Owners and Organization Admins can pin or unpin production versions.
  3. A/B tests require at least two variants whose weights sum to 1.0 (±0.01) and assign requests consistently by virtual key or user ID. Streaming requests selected into a running A/B experiment return HTTP 400. Prompt execution records store metadata only, while rendered prompts are sent to the selected model provider.