openapi: 3.2.0 info: title: Client SDK Execute Prompt Stream API version: 1.0.0 servers: - url: https://predict.vellum.ai - url: https://api.vellum.ai - url: https://documents.vellum.ai tags: - name: Execute Prompt Stream paths: /v1/execute-prompt-stream: post: operationId: execute-prompt-stream summary: Execute Prompt Stream description: Executes a deployed Prompt and streams back the results. tags: - Execute Prompt Stream parameters: - name: X-API-KEY in: header required: true schema: type: string - name: X-API-Version in: header required: false schema: type: string responses: '200': description: '' content: text/event-stream: schema: $ref: '#/components/schemas/ExecutePromptEvent' '400': description: '' content: application/json: schema: $ref: '#/components/schemas/ExecutePromptApiErrorResponse' '403': description: '' content: application/json: schema: $ref: '#/components/schemas/ExecutePromptApiErrorResponse' '404': description: '' content: application/json: schema: $ref: '#/components/schemas/ExecutePromptApiErrorResponse' '500': description: '' content: application/json: schema: $ref: '#/components/schemas/ExecutePromptApiErrorResponse' requestBody: content: application/json: schema: $ref: '#/components/schemas/ExecutePromptStreamRequest' components: schemas: DocumentChatMessageContentRequest: type: object properties: type: $ref: '#/components/schemas/DocumentEnum' value: $ref: '#/components/schemas/VellumDocumentRequest' required: - type - value description: A document value that is used in a chat message. title: DocumentChatMessageContentRequest JSONInputRequest: type: object properties: name: type: string description: The variable's name type: $ref: '#/components/schemas/JsonEnum' value: oneOf: - description: Any type - type: 'null' required: - name - type - value description: A user input representing a JSON object title: JSONInputRequest MLModelUsage: type: object properties: output_token_count: type: - integer - 'null' input_token_count: type: - integer - 'null' input_char_count: type: - integer - 'null' output_char_count: type: - integer - 'null' compute_nanos: type: - integer - 'null' cache_creation_input_tokens: type: - integer - 'null' cache_read_input_tokens: type: - integer - 'null' title: MLModelUsage UnitEnum: type: string enum: - USD description: '* `USD` - USD' title: UnitEnum ExecutePromptStreamRequest: type: object properties: inputs: type: array items: $ref: '#/components/schemas/PromptDeploymentInputRequest' description: A list consisting of the Prompt Deployment's input variables and their values. prompt_deployment_id: type: - string - 'null' format: uuid description: The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name. prompt_deployment_name: type: - string - 'null' description: The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id. release_tag: type: - string - 'null' description: Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment external_id: type: - string - 'null' description: Optionally include a unique identifier for tracking purposes. Must be unique within a given Workspace. expand_meta: oneOf: - $ref: '#/components/schemas/PromptDeploymentExpandMetaRequest' - type: 'null' description: 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_overrides: oneOf: - $ref: '#/components/schemas/RawPromptExecutionOverridesRequest' - type: 'null' description: 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_raw: type: - array - 'null' items: type: string description: 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. metadata: type: - object - 'null' additionalProperties: description: Any type description: 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. required: - inputs title: ExecutePromptStreamRequest ArrayChatMessageContentRequest: type: object properties: type: $ref: '#/components/schemas/ArrayEnum' value: type: array items: $ref: '#/components/schemas/ArrayChatMessageContentItemRequest' required: - type - value description: A list of chat message content items. title: ArrayChatMessageContentRequest StringChatMessageContentRequest: type: object properties: type: $ref: '#/components/schemas/StringEnum' value: type: string required: - type - value description: A string value that is used in a chat message. title: StringChatMessageContentRequest RejectedEnum: type: string enum: - REJECTED title: RejectedEnum VellumAudioRequest: type: object properties: src: type: string description: "The reference to the source data. This can be one of the following formats:\n1. A base64-encoded data URL (e.g., 'data:application/pdf;base64,JVBERi0xLjQKJcfs...').\n2. A url pointing to a file accessible over HTTP or HTTPS.\n3. A reference to a file that's been previously uploaded to Vellum, in the form of 'vellum:uploaded-file:{uploaded_file_id}'.\n You can use the Uploaded Files API to retrieve the url of the uploaded file given its ID. See https://docs.vellum.ai/developers/client-sdk/uploaded-files/retrieve for details." metadata: type: - object - 'null' additionalProperties: description: Any type required: - src title: VellumAudioRequest StringVellumValue: type: object properties: type: $ref: '#/components/schemas/StringEnum' value: type: - string - 'null' required: - type - value description: A value representing a string. title: StringVellumValue ChatMessageRole: type: string enum: - SYSTEM - ASSISTANT - USER - FUNCTION description: '* `SYSTEM` - System * `ASSISTANT` - Assistant * `USER` - User * `FUNCTION` - Function' title: ChatMessageRole FulfilledExecutePromptEvent: type: object properties: state: $ref: '#/components/schemas/FulfilledEnum' outputs: type: array items: $ref: '#/components/schemas/PromptOutput' execution_id: type: string meta: $ref: '#/components/schemas/FulfilledPromptExecutionMeta' chat_message_metadata: type: - object - 'null' additionalProperties: description: Any type required: - state - outputs - execution_id description: The final data event returned indicating that the stream has ended and all final resolved values from the model can be found. title: FulfilledExecutePromptEvent AudioChatMessageContentRequest: type: object properties: type: $ref: '#/components/schemas/AudioEnum' value: $ref: '#/components/schemas/VellumAudioRequest' required: - type - value description: An audio value that is used in a chat message. title: AudioChatMessageContentRequest ChatHistoryEnum: type: string enum: - CHAT_HISTORY title: ChatHistoryEnum FunctionCallVellumValue: type: object properties: type: $ref: '#/components/schemas/FunctionCallEnum' value: oneOf: - $ref: '#/components/schemas/FunctionCall' - type: 'null' required: - type - value description: A value representing a Function Call. title: FunctionCallVellumValue StreamingExecutePromptEvent: type: object properties: state: $ref: '#/components/schemas/StreamingEnum' output: $ref: '#/components/schemas/PromptOutput' output_index: type: integer execution_id: type: string meta: $ref: '#/components/schemas/StreamingPromptExecutionMeta' raw: type: object additionalProperties: description: Any type description: The subset of the raw response from the model that the request opted into with `expand_raw`. required: - state - output - output_index - execution_id description: The data returned for each delta during the prompt execution stream. title: StreamingExecutePromptEvent AudioInputRequest: type: object properties: name: type: string description: The variable's name type: $ref: '#/components/schemas/AudioEnum' value: $ref: '#/components/schemas/VellumAudioRequest' required: - name - type - value description: A user input representing a Vellum Audio value title: AudioInputRequest PromptOutput: oneOf: - $ref: '#/components/schemas/StringVellumValue' - $ref: '#/components/schemas/JsonVellumValue' - $ref: '#/components/schemas/ErrorVellumValue' - $ref: '#/components/schemas/FunctionCallVellumValue' - $ref: '#/components/schemas/ThinkingVellumValue' title: PromptOutput ArrayEnum: type: string enum: - ARRAY title: ArrayEnum ArrayChatMessageContentItemRequest: oneOf: - $ref: '#/components/schemas/StringChatMessageContentRequest' - $ref: '#/components/schemas/FunctionCallChatMessageContentRequest' - $ref: '#/components/schemas/AudioChatMessageContentRequest' - $ref: '#/components/schemas/VideoChatMessageContentRequest' - $ref: '#/components/schemas/ImageChatMessageContentRequest' - $ref: '#/components/schemas/DocumentChatMessageContentRequest' title: ArrayChatMessageContentItemRequest StringInputRequest: type: object properties: name: type: string description: The variable's name type: $ref: '#/components/schemas/StringEnum' value: type: string required: - name - type - value description: A user input representing a string value title: StringInputRequest RejectedExecutePromptEvent: type: object properties: state: $ref: '#/components/schemas/RejectedEnum' error: $ref: '#/components/schemas/VellumError' execution_id: type: string meta: $ref: '#/components/schemas/RejectedPromptExecutionMeta' required: - state - error - execution_id description: The final data returned indicating an error occurred during the stream. title: RejectedExecutePromptEvent InitiatedPromptExecutionMeta: type: object properties: model_name: type: - string - 'null' latency: type: - integer - 'null' deployment_release_tag: type: - string - 'null' prompt_version_id: type: - string - 'null' description: The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`. title: InitiatedPromptExecutionMeta FunctionCallEnum: type: string enum: - FUNCTION_CALL title: FunctionCallEnum JsonVellumValue: type: object properties: type: $ref: '#/components/schemas/JsonEnum' value: oneOf: - description: Any type - type: 'null' required: - type - value description: A value representing a JSON object. title: JsonVellumValue VellumVideoRequest: type: object properties: src: type: string description: "The reference to the source data. This can be one of the following formats:\n1. A base64-encoded data URL (e.g., 'data:application/pdf;base64,JVBERi0xLjQKJcfs...').\n2. A url pointing to a file accessible over HTTP or HTTPS.\n3. A reference to a file that's been previously uploaded to Vellum, in the form of 'vellum:uploaded-file:{uploaded_file_id}'.\n You can use the Uploaded Files API to retrieve the url of the uploaded file given its ID. See https://docs.vellum.ai/developers/client-sdk/uploaded-files/retrieve for details." metadata: type: - object - 'null' additionalProperties: description: Any type required: - src title: VellumVideoRequest RejectedPromptExecutionMeta: type: object properties: latency: type: - integer - 'null' finish_reason: oneOf: - $ref: '#/components/schemas/FinishReasonEnum' - type: 'null' description: The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`. title: RejectedPromptExecutionMeta ErrorVellumValue: type: object properties: type: $ref: '#/components/schemas/ErrorEnum' value: oneOf: - $ref: '#/components/schemas/VellumError' - type: 'null' required: - type - value description: A value representing an Error. title: ErrorVellumValue VideoEnum: type: string enum: - VIDEO title: VideoEnum ImageInputRequest: type: object properties: name: type: string description: The variable's name type: $ref: '#/components/schemas/ImageEnum' value: $ref: '#/components/schemas/VellumImageRequest' required: - name - type - value description: A user input representing a Vellum Image value title: ImageInputRequest ThinkingEnum: type: string enum: - THINKING title: ThinkingEnum PromptDeploymentExpandMetaRequest: type: object properties: model_name: type: - boolean - 'null' description: If enabled, the response will include the model identifier representing the ML Model invoked by the Prompt. usage: type: - boolean - 'null' description: If enabled, the response will include model host usage tracking. This may increase latency for some model hosts. cost: type: - boolean - 'null' description: If enabled, the response will include model host cost tracking. This may increase latency for some model hosts. finish_reason: type: - boolean - 'null' description: If enabled, the response will include the reason provided by the model for why the execution finished. latency: type: - boolean - 'null' description: If enabled, the response will include the time in nanoseconds it took to execute the Prompt Deployment. deployment_release_tag: type: - boolean - 'null' description: If enabled, the response will include the release tag of the Prompt Deployment. prompt_version_id: type: - boolean - 'null' description: If enabled, the response will include the ID of the Prompt Version backing the deployment. title: PromptDeploymentExpandMetaRequest FulfilledEnum: type: string enum: - FULFILLED title: FulfilledEnum VellumDocumentRequest: type: object properties: src: type: string description: "The reference to the source data. This can be one of the following formats:\n1. A base64-encoded data URL (e.g., 'data:application/pdf;base64,JVBERi0xLjQKJcfs...').\n2. A url pointing to a file accessible over HTTP or HTTPS.\n3. A reference to a file that's been previously uploaded to Vellum, in the form of 'vellum:uploaded-file:{uploaded_file_id}'.\n You can use the Uploaded Files API to retrieve the url of the uploaded file given its ID. See https://docs.vellum.ai/developers/client-sdk/uploaded-files/retrieve for details." metadata: type: - object - 'null' additionalProperties: description: Any type required: - src title: VellumDocumentRequest FunctionCallChatMessageContentValueRequest: type: object properties: name: type: string arguments: type: object additionalProperties: description: Any type id: type: - string - 'null' required: - name - arguments description: The final resolved function call value. title: FunctionCallChatMessageContentValueRequest ImageEnum: type: string enum: - IMAGE title: ImageEnum VellumImageRequest: type: object properties: src: type: string description: "The reference to the source data. This can be one of the following formats:\n1. A base64-encoded data URL (e.g., 'data:application/pdf;base64,JVBERi0xLjQKJcfs...').\n2. A url pointing to a file accessible over HTTP or HTTPS.\n3. A reference to a file that's been previously uploaded to Vellum, in the form of 'vellum:uploaded-file:{uploaded_file_id}'.\n You can use the Uploaded Files API to retrieve the url of the uploaded file given its ID. See https://docs.vellum.ai/developers/client-sdk/uploaded-files/retrieve for details." metadata: type: - object - 'null' additionalProperties: description: Any type required: - src title: VellumImageRequest Price: type: object properties: value: type: number format: double unit: $ref: '#/components/schemas/UnitEnum' required: - value - unit title: Price StreamingPromptExecutionMeta: type: object properties: latency: type: - integer - 'null' description: The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`. title: StreamingPromptExecutionMeta JsonEnum: type: string enum: - JSON title: JsonEnum ChatMessageContentRequest: oneOf: - $ref: '#/components/schemas/StringChatMessageContentRequest' - $ref: '#/components/schemas/FunctionCallChatMessageContentRequest' - $ref: '#/components/schemas/ArrayChatMessageContentRequest' - $ref: '#/components/schemas/AudioChatMessageContentRequest' - $ref: '#/components/schemas/VideoChatMessageContentRequest' - $ref: '#/components/schemas/ImageChatMessageContentRequest' - $ref: '#/components/schemas/DocumentChatMessageContentRequest' title: ChatMessageContentRequest VideoInputRequest: type: object properties: name: type: string description: The variable's name type: $ref: '#/components/schemas/VideoEnum' value: $ref: '#/components/schemas/VellumVideoRequest' required: - name - type - value description: A user input representing a Vellum Video value title: VideoInputRequest ChatMessageRequest: type: object properties: text: type: - string - 'null' role: $ref: '#/components/schemas/ChatMessageRole' content: oneOf: - $ref: '#/components/schemas/ChatMessageContentRequest' - type: 'null' source: type: - string - 'null' description: An optional identifier representing who or what generated this message. metadata: type: - object - 'null' additionalProperties: description: Any type required: - role title: ChatMessageRequest FinishReasonEnum: type: string enum: - LENGTH - STOP - UNKNOWN description: '* `LENGTH` - LENGTH * `STOP` - STOP * `UNKNOWN` - UNKNOWN' title: FinishReasonEnum ChatHistoryInputRequest: type: object properties: name: type: string description: The variable's name, as defined in the deployment. type: $ref: '#/components/schemas/ChatHistoryEnum' value: type: array items: $ref: '#/components/schemas/ChatMessageRequest' required: - name - type - value description: A user input representing a list of chat messages title: ChatHistoryInputRequest AudioEnum: type: string enum: - AUDIO title: AudioEnum ImageChatMessageContentRequest: type: object properties: type: $ref: '#/components/schemas/ImageEnum' value: $ref: '#/components/schemas/VellumImageRequest' required: - type - value description: An image value that is used in a chat message. title: ImageChatMessageContentRequest ExecutePromptEvent: oneOf: - $ref: '#/components/schemas/InitiatedExecutePromptEvent' - $ref: '#/components/schemas/StreamingExecutePromptEvent' - $ref: '#/components/schemas/FulfilledExecutePromptEvent' - $ref: '#/components/schemas/RejectedExecutePromptEvent' title: ExecutePromptEvent VellumError: type: object properties: code: $ref: '#/components/schemas/VellumErrorCodeEnum' message: type: string raw_data: type: - object - 'null' additionalProperties: description: Any type required: - code - message title: VellumError StreamingEnum: type: string enum: - STREAMING title: StreamingEnum StringEnum: type: string enum: - STRING title: StringEnum ErrorEnum: type: string enum: - ERROR title: ErrorEnum FunctionCall: type: object properties: arguments: type: object additionalProperties: description: Any type id: type: - string - 'null' name: type: string required: - arguments - name description: The final resolved function call value. title: FunctionCall FulfilledPromptExecutionMeta: type: object properties: latency: type: - integer - 'null' finish_reason: oneOf: - $ref: '#/components/schemas/FinishReasonEnum' - type: 'null' usage: oneOf: - $ref: '#/components/schemas/MLModelUsage' - type: 'null' cost: oneOf: - $ref: '#/components/schemas/Price' - type: 'null' description: The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`. title: FulfilledPromptExecutionMeta PromptDeploymentInputRequest: oneOf: - $ref: '#/components/schemas/StringInputRequest' - $ref: '#/components/schemas/JSONInputRequest' - $ref: '#/components/schemas/ChatHistoryInputRequest' - $ref: '#/components/schemas/AudioInputRequest' - $ref: '#/components/schemas/VideoInputRequest' - $ref: '#/components/schemas/ImageInputRequest' - $ref: '#/components/schemas/DocumentInputRequest' title: PromptDeploymentInputRequest InitiatedExecutePromptEvent: type: object properties: state: $ref: '#/components/schemas/InitiatedEnum' meta: $ref: '#/components/schemas/InitiatedPromptExecutionMeta' execution_id: type: string required: - state - execution_id description: The initial data returned indicating that the response from the model has returned and begun streaming. title: InitiatedExecutePromptEvent RawPromptExecutionOverridesRequest: type: object properties: body: type: - object - 'null' additionalProperties: description: Any type headers: type: - object - 'null' additionalProperties: type: string description: The raw headers to send to the model host. url: type: - string - 'null' description: The raw URL to send to the model host. title: RawPromptExecutionOverridesRequest DocumentEnum: type: string enum: - DOCUMENT title: DocumentEnum VellumErrorCodeEnum: type: string enum: - INVALID_REQUEST - INVALID_INPUTS - PROVIDER_ERROR - PROVIDER_CREDENTIALS_UNAVAILABLE - INTEGRATION_CREDENTIALS_UNAVAILABLE - REQUEST_TIMEOUT - INTERNAL_SERVER_ERROR - USER_DEFINED_ERROR - WORKFLOW_CANCELLED - NODE_CANCELLED - PROVIDER_QUOTA_EXCEEDED - CHAT_QUOTA_EXCEEDED description: '* `INVALID_REQUEST` - INVALID_REQUEST * `INVALID_INPUTS` - INVALID_INPUTS * `PROVIDER_ERROR` - PROVIDER_ERROR * `PROVIDER_CREDENTIALS_UNAVAILABLE` - PROVIDER_CREDENTIALS_UNAVAILABLE * `INTEGRATION_CREDENTIALS_UNAVAILABLE` - INTEGRATION_CREDENTIALS_UNAVAILABLE * `REQUEST_TIMEOUT` - REQUEST_TIMEOUT * `INTERNAL_SERVER_ERROR` - INTERNAL_SERVER_ERROR * `USER_DEFINED_ERROR` - USER_DEFINED_ERROR * `WORKFLOW_CANCELLED` - WORKFLOW_CANCELLED * `NODE_CANCELLED` - NODE_CANCELLED * `PROVIDER_QUOTA_EXCEEDED` - PROVIDER_QUOTA_EXCEEDED * `CHAT_QUOTA_EXCEEDED` - CHAT_QUOTA_EXCEEDED' title: VellumErrorCodeEnum FunctionCallChatMessageContentRequest: type: object properties: type: $ref: '#/components/schemas/FunctionCallEnum' value: $ref: '#/components/schemas/FunctionCallChatMessageContentValueRequest' required: - type - value description: A function call value that is used in a chat message. title: FunctionCallChatMessageContentRequest ExecutePromptApiErrorResponse: type: object properties: detail: type: string description: Details about why the request failed. raw_data: type: - object - 'null' additionalProperties: description: Any type description: The raw error data structure, if available. required: - detail title: ExecutePromptApiErrorResponse InitiatedEnum: type: string enum: - INITIATED title: InitiatedEnum DocumentInputRequest: type: object properties: name: type: string description: The variable's name type: $ref: '#/components/schemas/DocumentEnum' value: $ref: '#/components/schemas/VellumDocumentRequest' required: - name - type - value description: A user input representing a Vellum Document value title: DocumentInputRequest ThinkingVellumValue: type: object properties: type: $ref: '#/components/schemas/ThinkingEnum' value: oneOf: - $ref: '#/components/schemas/StringVellumValue' - type: 'null' required: - type - value description: A value representing Thinking mode output. title: ThinkingVellumValue VideoChatMessageContentRequest: type: object properties: type: $ref: '#/components/schemas/VideoEnum' value: $ref: '#/components/schemas/VellumVideoRequest' required: - type - value description: A video value that is used in a chat message. title: VideoChatMessageContentRequest securitySchemes: default: type: apiKey in: header name: X-API-KEY