POST /v1/responses
Generate text responses from text prompts. This endpoint supports both streaming and non-streaming responses for supported text models.
Servers
- https://api.digitalocean.com
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
stream |
Boolean | No |
Set to true to stream partial responses as Server-Sent Events. Default value: false |
stop |
No |
Up to 4 sequences where the API will stop generating further tokens. |
|
input |
Yes |
The prompt or input content you want the model to respond to. Can be a simple text string or an array of message objects for conversation context. |
|
temperature |
Number | No |
A value between 0.0 and 2.0 to control randomness and creativity. Lower values like 0.2 make the output more focused and deterministic, while higher values like 0.8 make it more random. |
tools[] |
Array | No |
A list of tools the model may call. |
tools[].name |
String | No |
The name of the function to be called. |
tools[].description |
String | No |
A description of what the function does. |
tools[].parameters |
Object | No |
The parameters the function accepts, described as a JSON Schema object. |
tools[].type |
String | Yes |
The type of the tool. Valid values:
|
metadata |
Object | No |
Set of key-value pairs that can be attached to the request. |
tool_choice |
No |
Controls which (if any) tool is called by the model. |
|
model |
String | Yes |
The model ID of the model you want to use. Get the model ID using |
top_p |
Number | No |
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. |
max_output_tokens |
Integer | No |
The maximum number of tokens to generate in the response. |
user |
String | No |
A unique identifier representing your end-user. |
stream_options |
Object | No |
Options for streaming response. Only set this when you set stream to true. |
stream_options.include_usage |
Boolean | No |
If set, an additional chunk will be streamed before the data: [DONE] message with token usage statistics for the entire request. |
instructions |
String | No |
System-level instructions for the model. This sets the behavior and context for the response generation. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.