For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
BlogLog InRequest Demo
HomeProductDevelopersSelf-HostingChangelog
HomeProductDevelopersSelf-HostingChangelog
  • Getting Started
    • Overview
  • Workflows SDK
    • Introduction
    • Installation
    • Core Concepts
    • Defining Control Flow
    • Configuration
    • Custom Docker Images
  • Client SDK
    • Introduction
    • Authentication
    • API Versioning
      • POSTExecute Prompt
      • STREAMExecute Prompt as Stream
      • POSTSubmit Prompt Execution Actuals
      • POSTRetrieve Provider Payload
LogoLogo
BlogLog InRequest Demo
Client SDKPrompts

Execute Prompt

GA
POST
https://predict.vellum.ai/v1/execute-prompt
POST
/v1/execute-prompt
1import requests
2
3url = "https://predict.vellum.ai/v1/execute-prompt"
4
5payload = { "inputs": [
6 {
7 "name": "string",
8 "type": "STRING",
9 "value": "string"
10 }
11 ] }
12headers = {
13 "X-API-KEY": "<apiKey>",
14 "Content-Type": "application/json"
15}
16
17response = requests.post(url, json=payload, headers=headers)
18
19print(response.json())
1{
2 "meta": {
3 "model_name": "string",
4 "latency": 1,
5 "deployment_release_tag": "string",
6 "prompt_version_id": "string",
7 "finish_reason": "LENGTH",
8 "usage": {
9 "output_token_count": 1,
10 "input_token_count": 1,
11 "input_char_count": 1,
12 "output_char_count": 1,
13 "compute_nanos": 1,
14 "cache_creation_input_tokens": 1,
15 "cache_read_input_tokens": 1
16 },
17 "cost": {
18 "value": 1.1,
19 "unit": "USD"
20 }
21 },
22 "raw": {},
23 "execution_id": "string",
24 "state": "FULFILLED",
25 "outputs": [
26 {
27 "type": "STRING",
28 "value": "string"
29 }
30 ],
31 "chat_message_metadata": {}
32}
Executes a deployed Prompt and returns the result.
Was this page helpful?
Previous

Execute Prompt as Stream

Next
Built with

Authentication

X-API-KEYstring
API Key authentication via header

Headers

X-API-VersionstringOptional

Request

This endpoint expects an object.
inputslist of objectsRequired
A list consisting of the Prompt Deployment's input variables and their values.
prompt_deployment_idstring or nullOptionalformat: "uuid"

The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.

prompt_deployment_namestring or nullOptional>=1 character

The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.

release_tagstring or nullOptional>=1 character
Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
external_idstring or nullOptional>=1 character
Optionally include a unique identifier for tracking purposes. Must be unique within a given Workspace.
expand_metaobject or nullOptional

An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the meta key of the API response.

raw_overridesobject or nullOptional

Overrides for the raw API request sent to the model host. Combined with expand_raw, it can be used to access new features from models.

expand_rawlist of strings or nullOptional

A list of keys whose values you’d like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the raw key of the API response.

metadatamap from strings to any or nullOptional
Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.

Response

FULFILLEDobject
OR
REJECTEDobject

Errors

400
Bad Request Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error