Skip to content

Creates a text-to-text response

post/responses

Generate text responses from text prompts. This endpoint supports both streaming and non-streaming responses for VLLM models only.

Body ParametersExpand Collapse
input: string or array of object { type, id, arguments, 7 more } or object { content, role, tool_call_id, 2 more }

The input text prompt or conversation history. Can be a string or an array of message objects for conversation context.

Accepts one of the following:
UnionMember0 = string

Simple text input prompt

UnionMember1 = array of object { type, id, arguments, 7 more } or object { content, role, tool_call_id, 2 more }

Array of message objects or Responses API items for conversation context

Accepts one of the following:
UnionMember0 = object { type, id, arguments, 7 more }
type: "function_call" or "function_call_output" or "reasoning"

The type of input item (must be function_call, function_call_output, or reasoning)

Accepts one of the following:
"function_call"
"function_call_output"
"reasoning"
id: optional string

The unique ID of the reasoning item (optional for reasoning)

arguments: optional string

JSON string of function arguments (required for function_call)

call_id: optional string

The call ID (required for function_call and function_call_output)

content: optional array of object { text, type }

Array of reasoning content parts (optional for reasoning, can be null)

text: optional string

The reasoning text content

type: optional "reasoning_text"

The type of content

Accepts one of the following:
"reasoning_text"
encrypted_content: optional string

Encrypted content (optional)

name: optional string

The function name (required for function_call)

output: optional string

JSON string of function output (required for function_call_output)

status: optional string

Status of the item (optional, can be null)

summary: optional array of unknown

Summary of the reasoning (optional for reasoning)

UnionMember1 = object { content, role, tool_call_id, 2 more }
content: string or array of object { text, type } or map[unknown]

The content of the message (string or content parts array)

Accepts one of the following:
UnionMember0 = string
UnionMember1 = array of object { text, type } or map[unknown]
Accepts one of the following:
UnionMember0 = object { text, type }
text: string

The text content

type: "input_text"

The type of content part

Accepts one of the following:
"input_text"
UnionMember1 = map[unknown]
role: optional "user" or "assistant" or "system" or 2 more

The role of the message author

Accepts one of the following:
"user"
"assistant"
"system"
"tool"
"developer"
tool_call_id: optional string

Tool call ID that this message is responding to (required for tool role)

tool_calls: optional array of object { id, function, type }

Tool calls made by the assistant (for assistant role messages)

id: string

The ID of the tool call.

function: object { arguments, name }

The function that the model called.

arguments: string

The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.

name: string

The name of the function to call.

type: "function"

The type of the tool. Currently, only function is supported.

Accepts one of the following:
"function"
type: optional "message"

Optional type identifier for message items (used by some clients like Codex)

Accepts one of the following:
"message"
model: string

Model ID used to generate the response. Must be a VLLM model.

instructions: optional string

System-level instructions for the model. This sets the behavior and context for the response generation.

max_output_tokens: optional number

Maximum number of tokens to generate in the response. If not specified, the model will use a default value.

minimum1
max_tokens: optional number

The maximum number of tokens that can be generated in the completion. Alias for max_output_tokens for compatibility.

minimum0
metadata: optional map[string]

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

modalities: optional array of "text"

Specifies the output types the model should generate. For text-to-text, this should be ["text"].

Accepts one of the following:
"text"
parallel_tool_calls: optional boolean

Whether to enable parallel tool calls. When true, the model can make multiple tool calls in parallel.

stop: optional string or array of string

Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.

Accepts one of the following:
UnionMember0 = string
UnionMember1 = array of string
stream: optional boolean

If set to true, the model response data will be streamed to the client as it is generated using server-sent events.

stream_options: optional object { include_usage }

Options for streaming response. Only set this when you set stream: true.

include_usage: optional boolean

If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array.

All other chunks will also include a usage field, but with a null value. NOTE: If the stream is interrupted, you may not receive the final usage chunk which contains the total token usage for the request.

temperature: optional number

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

minimum0
maximum2
tool_choice: optional "none" or "auto" or "required" or object { function, type }

Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

none is the default when no tools are present. auto is the default if tools are present.

Accepts one of the following:
UnionMember0 = "none" or "auto" or "required"

none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools.

Accepts one of the following:
"none"
"auto"
"required"
ChatCompletionNamedToolChoice = object { function, type }

Specifies a tool the model should use. Use to force the model to call a specific function.

function: object { name }
name: string

The name of the function to call.

type: "function"

The type of the tool. Currently, only function is supported.

Accepts one of the following:
"function"
tools: optional array of object { type, description, name, parameters }

A list of tools the model may call. Currently, only functions are supported as a tool. Uses Responses API format (with name, description, parameters at top level).

type: "function" or "web_search" or "web_search_2025_08_26"

The type of the tool. Supported values are function (custom tools), web_search, and web_search_2025_08_26 (built-in web search).

Accepts one of the following:
"function"
"web_search"
"web_search_2025_08_26"
description: optional string

A description of what the function does, used by the model to choose when and how to call the function.

name: optional string

The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

parameters: optional map[unknown]

The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.

Omitting parameters defines a function with an empty parameter list.

top_p: optional number

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

minimum0
maximum1
user: optional string

A unique identifier representing your end-user, which can help DigitalOcean to monitor and detect abuse.

ReturnsExpand Collapse
CreateResponseResponse = object { id, created, model, 23 more }

Represents a text-to-text response returned by the model, based on the provided input. VLLM models only.

id: string

A unique identifier for the response.

created: number

The Unix timestamp (in seconds) of when the response was created.

model: string

The model used to generate the response.

object: "response"

The object type, which is always response.

Accepts one of the following:
"response"
usage: object { input_tokens, input_tokens_details, output_tokens, 2 more }

Detailed token usage statistics for the request, including input/output token counts and detailed breakdowns.

input_tokens: number

The number of input tokens.

input_tokens_details: object { cached_tokens }

A detailed breakdown of the input tokens.

cached_tokens: number

The number of tokens that were retrieved from the cache. More on prompt caching.

output_tokens: number

The number of output tokens.

output_tokens_details: object { reasoning_tokens, tool_output_tokens }

A detailed breakdown of the output tokens.

reasoning_tokens: number

The number of reasoning tokens.

tool_output_tokens: number

The number of tool output tokens.

total_tokens: number

The total number of tokens used.

background: optional boolean

Whether the request was processed in the background

choices: optional array of object { finish_reason, index, message, logprobs }

A list of response choices. Can be more than one if n is greater than 1. Optional - Responses API primarily uses the output array.

finish_reason: "stop" or "length" or "tool_calls" or "content_filter"

The reason the model stopped generating tokens. This will be stop if the model hit a natural stop point or a provided stop sequence, length if the maximum number of tokens specified in the request was reached, or tool_calls if the model called a tool.

Accepts one of the following:
"stop"
"length"
"tool_calls"
"content_filter"
index: number

The index of the choice in the list of choices.

message: object { content, role, tool_calls }

The generated message response.

content: optional string

The generated text content.

role: optional "assistant"

The role of the message author, which is always assistant.

Accepts one of the following:
"assistant"
tool_calls: optional array of object { id, function, type }

The tool calls generated by the model, such as function calls.

id: string

The ID of the tool call.

function: object { arguments, name }

The function that the model called.

arguments: string

The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.

name: string

The name of the function to call.

type: "function"

The type of the tool. Currently, only function is supported.

Accepts one of the following:
"function"
logprobs: optional object { content }

Log probability information for the choice. Only present if logprobs was requested in the request.

content: array of ChatCompletionTokenLogprob { token, bytes, logprob, top_logprobs }

A list of message content tokens with log probability information.

token: string

The token.

bytes: array of number

A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token.

logprob: number

The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.

top_logprobs: array of object { token, bytes, logprob }

List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned.

token: string

The token.

bytes: array of number

A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token.

logprob: number

The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.

input_messages: optional array of unknown

Input messages (if applicable)

max_output_tokens: optional number

Maximum output tokens setting

max_tool_calls: optional number

Maximum tool calls setting

output: optional array of object { arguments, call_id, name, 4 more } or object { text, type } or object { id, content, summary, 3 more }

An array of content items generated by the model. This includes text content, function calls, reasoning items, and other output types. Use this field for Responses API compatibility.

Accepts one of the following:
UnionMember0 = object { arguments, call_id, name, 4 more }
arguments: string

JSON string of function arguments

call_id: string

The unique ID of the function tool call

name: string

The name of the function to call

type: "function_call"

The type of output item

Accepts one of the following:
"function_call"
id: optional string

The unique ID of the function tool call (same as call_id)

encrypted_content: optional string

Encrypted content (optional)

status: optional string

Status of the item (optional, can be null)

UnionMember1 = object { text, type }
text: string

The text content

type: "text"

The type of output item

Accepts one of the following:
"text"
UnionMember2 = object { id, content, summary, 3 more }
id: string

The unique ID of the reasoning item

content: array of object { text, type }

Array of reasoning content parts

text: string

The reasoning text content

type: "reasoning_text"

The type of content

Accepts one of the following:
"reasoning_text"
summary: array of unknown

Summary of the reasoning (usually empty)

type: "reasoning"

The type of output item

Accepts one of the following:
"reasoning"
encrypted_content: optional string

Encrypted content (optional)

status: optional string

Status of the item (optional, can be null)

output_messages: optional array of unknown

Output messages (if applicable)

parallel_tool_calls: optional boolean

Whether parallel tool calls are enabled

previous_response_id: optional string

Previous response ID (for multi-turn conversations)

prompt: optional string

Prompt used for the response

reasoning: optional string

Reasoning content

service_tier: optional string

Service tier used

status: optional string

Status of the response

temperature: optional number

Temperature setting used for the response

text: optional string

Text content

tool_choice: optional string

Tool choice setting used for the response

tools: optional array of object { type, description, name, parameters }

Tools available for the response

type: "function" or "web_search" or "web_search_2025_08_26"

The type of the tool. Supported values are function (custom tools), web_search, and web_search_2025_08_26 (built-in web search).

Accepts one of the following:
"function"
"web_search"
"web_search_2025_08_26"
description: optional string

A description of what the function does, used by the model to choose when and how to call the function.

name: optional string

The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

parameters: optional map[unknown]

The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.

Omitting parameters defines a function with an empty parameter list.

top_logprobs: optional number

Top logprobs setting

top_p: optional number

Top-p setting used for the response

truncation: optional string

Truncation setting

user: optional string

User identifier

Creates a text-to-text response
curl $GRADIENT_INFERENCE_ENDPOINT/v1/responses \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $DIGITALOCEAN_ACCESS_TOKEN" \
    -d '{
          "input": "Tell me a three-sentence bedtime story about a unicorn.",
          "model": "llama3-8b-instruct",
          "instructions": "You are a helpful assistant.",
          "max_output_tokens": 1024,
          "max_tokens": 1024,
          "modalities": [
            "text"
          ],
          "parallel_tool_calls": true,
          "temperature": 1,
          "top_p": 1,
          "user": "user-1234"
        }'
{
  "id": "response-abc123def456",
  "created": 1721596428,
  "model": "llama3-8b-instruct",
  "object": "response",
  "usage": {
    "input_tokens": 133,
    "input_tokens_details": {
      "cached_tokens": 128
    },
    "output_tokens": 41,
    "output_tokens_details": {
      "reasoning_tokens": 24,
      "tool_output_tokens": 0
    },
    "total_tokens": 174
  },
  "background": true,
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Once upon a time, a unicorn named Sparkle...",
        "role": "assistant",
        "tool_calls": [
          {
            "id": "id",
            "function": {
              "arguments": "arguments",
              "name": "name"
            },
            "type": "function"
          }
        ]
      },
      "logprobs": {
        "content": [
          {
            "token": "token",
            "bytes": [
              0
            ],
            "logprob": 0,
            "top_logprobs": [
              {
                "token": "token",
                "bytes": [
                  0
                ],
                "logprob": 0
              }
            ]
          }
        ]
      }
    }
  ],
  "input_messages": [
    {}
  ],
  "max_output_tokens": 0,
  "max_tool_calls": 0,
  "output": [
    {
      "arguments": "arguments",
      "call_id": "call_id",
      "name": "name",
      "type": "function_call",
      "id": "id",
      "encrypted_content": "encrypted_content",
      "status": "status"
    }
  ],
  "output_messages": [
    {}
  ],
  "parallel_tool_calls": true,
  "previous_response_id": "previous_response_id",
  "prompt": "prompt",
  "reasoning": "reasoning",
  "service_tier": "service_tier",
  "status": "status",
  "temperature": 0,
  "text": "text",
  "tool_choice": "tool_choice",
  "tools": [
    {
      "type": "function",
      "description": "description",
      "name": "name",
      "parameters": {
        "foo": "bar"
      }
    }
  ],
  "top_logprobs": 0,
  "top_p": 0,
  "truncation": "truncation",
  "user": "user"
}
Returns Examples
{
  "id": "response-abc123def456",
  "created": 1721596428,
  "model": "llama3-8b-instruct",
  "object": "response",
  "usage": {
    "input_tokens": 133,
    "input_tokens_details": {
      "cached_tokens": 128
    },
    "output_tokens": 41,
    "output_tokens_details": {
      "reasoning_tokens": 24,
      "tool_output_tokens": 0
    },
    "total_tokens": 174
  },
  "background": true,
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Once upon a time, a unicorn named Sparkle...",
        "role": "assistant",
        "tool_calls": [
          {
            "id": "id",
            "function": {
              "arguments": "arguments",
              "name": "name"
            },
            "type": "function"
          }
        ]
      },
      "logprobs": {
        "content": [
          {
            "token": "token",
            "bytes": [
              0
            ],
            "logprob": 0,
            "top_logprobs": [
              {
                "token": "token",
                "bytes": [
                  0
                ],
                "logprob": 0
              }
            ]
          }
        ]
      }
    }
  ],
  "input_messages": [
    {}
  ],
  "max_output_tokens": 0,
  "max_tool_calls": 0,
  "output": [
    {
      "arguments": "arguments",
      "call_id": "call_id",
      "name": "name",
      "type": "function_call",
      "id": "id",
      "encrypted_content": "encrypted_content",
      "status": "status"
    }
  ],
  "output_messages": [
    {}
  ],
  "parallel_tool_calls": true,
  "previous_response_id": "previous_response_id",
  "prompt": "prompt",
  "reasoning": "reasoning",
  "service_tier": "service_tier",
  "status": "status",
  "temperature": 0,
  "text": "text",
  "tool_choice": "tool_choice",
  "tools": [
    {
      "type": "function",
      "description": "description",
      "name": "name",
      "parameters": {
        "foo": "bar"
      }
    }
  ],
  "top_logprobs": 0,
  "top_p": 0,
  "truncation": "truncation",
  "user": "user"
}