Creates a text-to-text response
Generate text responses from text prompts. This endpoint supports both streaming and non-streaming responses for VLLM models only.
Body Parameters
Model ID used to generate the response. Must be a VLLM model.
System-level instructions for the model. This sets the behavior and context for the response generation.
Maximum number of tokens to generate in the response. If not specified, the model will use a default value.
The maximum number of tokens that can be generated in the completion. Alias for max_output_tokens for compatibility.
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.
Whether to enable parallel tool calls. When true, the model can make multiple tool calls in parallel.
If set to true, the model response data will be streamed to the client as it is generated using server-sent events.
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.
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.
A unique identifier representing your end-user, which can help DigitalOcean to monitor and detect abuse.
Returns
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"
}