Skip to main content
POST
Portkey Prompts API completely for both requests and responses, making it a drop-in replacement existing for your existing Chat or Completions calls.

Features

Create your Propmt Template on Portkey UI, define variables, and pass them with this API:
You can override any model hyperparameter saved in the prompt template by sending its new value at the time of making a request:
Passing the {promptId} always calls the Published version of your prompt.But, you can also call a specific template version by appending its version number, like {promptId@12}:Version Tags:
  • @latest: Calls the
  • @{NUMBER} (like @12): Calls the specified version number
  • No Suffix: Here, Portkey defaults to the Published version
Prompts API also supports streaming responses, and completely follows the OpenAI schema.
  • Set stream:True explicitly in your request to enable streaming

Authorizations

x-portkey-api-key
string
header
required

Path Parameters

promptId
string
required

The unique identifier of the prompt template to use

Body

application/json

Note: Although hyperparameters are shown grouped here (like messages, max_completion_tokens, temperature, etc.), they should only be passed at the root level, alongside 'variables' and 'stream'. The max_tokens parameter is deprecated — use max_completion_tokens instead.

variables
object
required

Variables to substitute in the prompt template

stream
boolean
default:false

Default: False. Set to True if you want to stream the response

hyperparameters
Chat Completions · object

Note: All hyperparameters are optional. Pass them at the root level, and not nested under hyperparameters. Their grouping here is for educational purposes only.

Response

200 - application/json

Successful completion response

status
string

Response status

headers
object

Response headers

body
Chat Completions · object

Represents a chat completion response returned by model, based on the provided input.

Last modified on April 8, 2026