Serverless Inference

Generated on 26 Mar 2026

DigitalOcean Gradient™ AI Agentic Cloud allows access to serverless inference models. You can access models by providing an inference key.

Note: The Serverless Inference API uses a separate base URL (https://inference.do-ai.run) and is independent of the main DigitalOcean control-plane API (https://api.digitalocean.com).

Base URL https://inference.do-ai.run

POST Generate Image, Audio, or Text-to-Speech Using fal Models

/v1/async-invoke
Authorizations: bearer_auth
Http: Bearer

OAuth Authentication

In order to interact with the DigitalOcean API, you or your application must authenticate.

The DigitalOcean API handles this through OAuth, an open standard for authorization. OAuth allows you to delegate access to your account. Scopes can be used to grant full access, read-only access, or access to a specific set of endpoints.

You can generate an OAuth token by visiting the Apps & API section of the DigitalOcean control panel for your account.

An OAuth token functions as a complete authentication request. In effect, it acts as a substitute for a username and password pair.

Because of this, it is absolutely essential that you keep your OAuth tokens secure. In fact, upon generation, the web interface will only display each token a single time in order to prevent the token from being compromised.

DigitalOcean access tokens begin with an identifiable prefix in order to distinguish them from other similar tokens.

  • dop_v1_ for personal access tokens generated in the control panel
  • doo_v1_ for tokens generated by applications using the OAuth flow
  • dor_v1_ for OAuth refresh tokens

Scopes

Scopes act like permissions assigned to an API token. These permissions determine what actions the token can perform. You can create API tokens that grant read-only access, full access, or limited access to specific endpoints by using custom scopes.

Generally, scopes are designed to match HTTP verbs and common CRUD operations (Create, Read, Update, Delete).

HTTP Verb CRUD Operation Scope
GET Read <resource>:read
POST Create <resource>:create
PUT/PATCH Update <resource>:update
DELETE Delete <resource>:delete

For example, creating a new Droplet by making a POST request to the /v2/droplets endpoint requires the droplet:create scope while listing Droplets by making a GET request to the /v2/droplets endpoint requires the droplet:read scope.

Each endpoint below specifies which scope is required to access it when using custom scopes.

How to Authenticate with OAuth

In order to make an authenticated request, include a bearer-type Authorization header containing your OAuth token. All requests must be made over HTTPS.

Authenticate with a Bearer Authorization Header

curl -X $HTTP_METHOD -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" "https://api.digitalocean.com/v2/$OBJECT"

Generate Image, Audio, or Text-to-Speech Using fal Models. This endpoint starts an asynchronous job and returns a request_id. The job status is QUEUED initially. Use the request_id to poll for the result.

Request Body: application/json

input object required

The input parameters for the model invocation. Fields vary by model type.

For image generation models (e.g., fal-ai/flux/schnell, fal-ai/fast-sdxl), use prompt along with optional image parameters like output_format, num_inference_steps, guidance_scale, num_images, and enable_safety_checker.

For audio generation models (e.g., fal-ai/stable-audio-25/text-to-audio), use prompt along with seconds_total to control the duration.

For text-to-speech models (e.g., fal-ai/elevenlabs/tts/multilingual-v2), use text with the content you want converted to speech.

Show child properties
enable_safety_checker boolean optional Nullable
Example: true

Whether to enable the safety checker for generated content.

guidance_scale number optional Nullable
Example: 3.5

Controls how closely the image generation model follows the prompt. Higher values produce output more closely matching the prompt.

num_images integer optional Nullable
Example: 1

The number of images to generate.

num_inference_steps integer optional Nullable
Example: 4

The number of inference steps to use during image generation. More steps generally produce higher quality output but take longer.

output_format string optional Nullable
Example: landscape_4_3

The desired output format or aspect ratio for image generation.

prompt string optional
Example: A futuristic city at sunset

The text prompt describing the desired output. Used for image generation and audio generation models.

seconds_total integer optional Nullable
Example: 60

The total duration in seconds for generated audio. Used for audio generation models.

text string optional
Example: This text-to-speech example uses DigitalOcean multilingual voice.

The text content to convert to speech. Used for text-to-speech models.

(additional properties) object optional

Additional properties are allowed.

model_id string required
Example: fal-ai/flux/schnell

The ID of the model to invoke asynchronously.

tags array of object optional Nullable

An optional list of key-value tags to attach to the invocation request for tracking or categorization.

Show child properties
key string required
Example: type

The tag key.

value string required
Example: test

The tag value.

Content type application/json
Example
{
  "input": {
    "prompt": "Techno song with futuristic sounds",
    "seconds_total": 60
  },
  "model_id": "fal-ai/stable-audio-25/text-to-audio",
  "tags": [
    {
      "key": "type",
      "value": "test"
    }
  ]
}
curl -X POST \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": "fal-ai/flux/schnell",
    "input": {
      "prompt": "A futuristic city at sunset"
    }
  }' \
  "https://inference.do-ai.run/v1/async-invoke"

Responses

202

The async invocation request was accepted.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

completed_at string (date-time) optional Nullable

The timestamp when the job completed. Null until finished.

created_at string (date-time) required
Example: 2026-01-22T19:19:19.112403432Z

The timestamp when the request was created.

error string optional Nullable

Error message if the job failed. Null on success.

model_id string required
Example: fal-ai/fast-sdxl

The model ID that was invoked.

output object optional Nullable

The output of the invocation. Null while the job is queued or in progress. Contains the result once completed.

Show child properties
(additional properties) object optional

Additional properties are allowed.

request_id string required
Example: 6590784a-ce47-4556-9ff4-53baff2693fb

A unique identifier for the async invocation request. Use this ID to check the status and retrieve the result.

started_at string (date-time) optional Nullable

The timestamp when the job started processing. Null while queued.

status string, one of: QUEUED, IN_PROGRESS, COMPLETED, FAILED required
Example: QUEUED

The current status of the async invocation.

401

Authentication failed due to invalid credentials.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

429

The API rate limit has been exceeded.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

500

There was a server error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

default

There was an unexpected error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

{
  "completed_at": "2019-08-24T14:15:22Z",
  "created_at": "2026-01-22T19:19:19.112403432Z",
  "error": "string",
  "model_id": "fal-ai/fast-sdxl",
  "request_id": "6590784a-ce47-4556-9ff4-53baff2693fb",
  "started_at": "2019-08-24T14:15:22Z",
  "status": "QUEUED"
}
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}
{
  "id": "too_many_requests",
  "message": "API rate limit exceeded."
}
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}
{
  "id": "example_error",
  "message": "some error message"
}

POST Create a model response for the given chat conversation

/v1/chat/completions
Authorizations: bearer_auth
Http: Bearer

OAuth Authentication

In order to interact with the DigitalOcean API, you or your application must authenticate.

The DigitalOcean API handles this through OAuth, an open standard for authorization. OAuth allows you to delegate access to your account. Scopes can be used to grant full access, read-only access, or access to a specific set of endpoints.

You can generate an OAuth token by visiting the Apps & API section of the DigitalOcean control panel for your account.

An OAuth token functions as a complete authentication request. In effect, it acts as a substitute for a username and password pair.

Because of this, it is absolutely essential that you keep your OAuth tokens secure. In fact, upon generation, the web interface will only display each token a single time in order to prevent the token from being compromised.

DigitalOcean access tokens begin with an identifiable prefix in order to distinguish them from other similar tokens.

  • dop_v1_ for personal access tokens generated in the control panel
  • doo_v1_ for tokens generated by applications using the OAuth flow
  • dor_v1_ for OAuth refresh tokens

Scopes

Scopes act like permissions assigned to an API token. These permissions determine what actions the token can perform. You can create API tokens that grant read-only access, full access, or limited access to specific endpoints by using custom scopes.

Generally, scopes are designed to match HTTP verbs and common CRUD operations (Create, Read, Update, Delete).

HTTP Verb CRUD Operation Scope
GET Read <resource>:read
POST Create <resource>:create
PUT/PATCH Update <resource>:update
DELETE Delete <resource>:delete

For example, creating a new Droplet by making a POST request to the /v2/droplets endpoint requires the droplet:create scope while listing Droplets by making a GET request to the /v2/droplets endpoint requires the droplet:read scope.

Each endpoint below specifies which scope is required to access it when using custom scopes.

How to Authenticate with OAuth

In order to make an authenticated request, include a bearer-type Authorization header containing your OAuth token. All requests must be made over HTTPS.

Authenticate with a Bearer Authorization Header

curl -X $HTTP_METHOD -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" "https://api.digitalocean.com/v2/$OBJECT"

Creates a model response for the given chat conversation.

Request Body: application/json

frequency_penalty number optional Nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

logit_bias object optional Nullable

Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.

Show child properties
(additional properties) integer optional

Additional properties are allowed.

logprobs boolean optional Nullable

Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.

max_completion_tokens integer optional Nullable

The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run.

max_tokens integer optional Nullable

The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length.

messages array of object required

A list of messages comprising the conversation so far.

Show child properties
content string optional Nullable
Example: Hello, how are you?

The contents of the message.

reasoning_content string optional Nullable

The reasoning content generated by the model (assistant messages only).

refusal string optional Nullable

The refusal message generated by the model (assistant messages only).

role string, one of: system, developer, user, assistant, tool required
Example: user

The role of the message author.

tool_call_id string optional
Example: call_abc123

Tool call that this message is responding to (tool messages only).

tool_calls array of object optional

The tool calls generated by the model (assistant messages only).

Show child properties
function object required
Show child properties
arguments string required
Example: {"location": "Boston"}

The arguments to call the function with, as generated by the model in JSON format.

name string required
Example: get_weather

The name of the function to call.

id string required
Example: call_abc123

The ID of the tool call.

type string, one of: function required
Example: function

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

metadata object optional Nullable

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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Show child properties
(additional properties) string optional

Additional properties are allowed.

model string required
Example: llama3-8b-instruct

Model ID used to generate the response.

n integer optional Nullable
Example: 1

How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.

presence_penalty number optional Nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

reasoning_effort string (enum) optional Nullable

Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

seed integer optional Nullable

If specified, the system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed.

stop array | string optional

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

stream boolean optional Nullable

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

stream_options object optional Nullable

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

Show child properties
include_usage boolean optional

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.

temperature number optional Nullable
Example: 1

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.

tool_choice oneOf optional

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.

One of:
Option 1
function
function object required
Show child properties
name string required
Example: get_weather

The name of the function to call.

type string, one of: function required
Example: function
tools array of object optional

A list of tools the model may call. Currently, only functions are supported as a tool.

Show child properties
function object required
Show child properties
description string optional
Example: Get the current weather for a location.

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

name string required
Example: get_weather

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 object optional

The parameters the function accepts, described as a JSON Schema object.

Show child properties
(additional properties) object optional

Additional properties are allowed.

type string, one of: function required
Example: function

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

top_logprobs integer optional Nullable

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.

top_p number optional Nullable
Example: 1

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.

user string optional
Example: user-1234

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

Content type application/json
{
  "frequency_penalty": 0,
  "logprobs": false,
  "max_completion_tokens": 0,
  "max_tokens": 0,
  "messages": [
    {
      "content": "Hello, how are you?",
      "reasoning_content": "string",
      "refusal": "string",
      "role": "user",
      "tool_call_id": "call_abc123",
      "tool_calls": []
    }
  ],
  "model": "llama3-8b-instruct",
  "n": 1,
  "presence_penalty": 0,
  "reasoning_effort": "none",
  "seed": 0,
  "stop": "string",
  "stream": false,
  "stream_options": {
    "include_usage": true
  },
  "temperature": 1,
  "tool_choice": "none",
  "tools": [
    {
      "type": "function"
    }
  ],
  "top_logprobs": 0,
  "top_p": 1,
  "user": "user-1234"
}
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  -d '{"messages": [{"role": "user", "content": "What is the capital of Portugal?"}], "model": "meta-llama/Meta-Llama-3.1-8B-Instruct"}' \
  "https://inference.do-ai.run/v1/chat/completions"

Responses

200

Successful chat completion. When stream is true, response is sent as Server-Sent Events (text/event-stream); otherwise a single JSON object (application/json) is returned.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

choices array of object required

A list of chat completion choices. Can be more than one if n is greater than 1.

Show child properties
finish_reason string, one of: stop, length, tool_calls, content_filter required
Example: stop

The reason the model stopped generating tokens. 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, tool_calls if the model called a tool.

index integer required
Example: 0

The index of the choice in the list of choices.

logprobs object required Nullable

Log probability information for the choice.

Show child properties
content array of object required Nullable

A list of message content tokens with log probability information.

Show child properties
bytes array of integer required Nullable

A list of integers representing the UTF-8 bytes representation of the token. Can be null if there is no bytes representation for the token.

Additional nested properties not shown. Refer to the full API spec for details.
logprob number required
Example: -1.2345

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.

token string required
Example: Hello

The token.

top_logprobs array of object required

List of the most likely tokens and their log probability, at this token position.

Additional nested properties not shown. Refer to the full API spec for details.
refusal array of object required Nullable

A list of message refusal tokens with log probability information.

Show child properties
bytes array of integer required Nullable

A list of integers representing the UTF-8 bytes representation of the token. Can be null if there is no bytes representation for the token.

Additional nested properties not shown. Refer to the full API spec for details.
logprob number required
Example: -1.2345

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.

token string required
Example: Hello

The token.

top_logprobs array of object required

List of the most likely tokens and their log probability, at this token position.

Additional nested properties not shown. Refer to the full API spec for details.
message object required

A chat completion message generated by the model.

Show child properties
content string required Nullable
Example: Hello! How can I help you today?

The contents of the message.

reasoning_content string required Nullable

The reasoning content generated by the model.

refusal string required Nullable

The refusal message generated by the model.

role string, one of: assistant required
Example: assistant

The role of the author of this message.

tool_calls array of object optional

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

Show child properties
function object required
Additional nested properties not shown. Refer to the full API spec for details.
id string required
Example: call_abc123

The ID of the tool call.

type string, one of: function required
Example: function

The type of the tool.

created integer required
Example: 1677649420

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

id string required
Example: chatcmpl-abc123

A unique identifier for the chat completion.

model string required
Example: llama3-8b-instruct

The model used for the chat completion.

object string, one of: chat.completion required
Example: chat.completion

The object type, which is always chat.completion.

usage object optional

Usage statistics for the completion request.

Show child properties
cache_created_input_tokens integer required
Example: 0

Number of prompt tokens written to cache.

cache_creation object required

Breakdown of prompt tokens written to cache.

Show child properties
ephemeral_1h_input_tokens integer required
Example: 0

Number of prompt tokens written to 1h cache.

ephemeral_5m_input_tokens integer required
Example: 0

Number of prompt tokens written to 5m cache.

cache_read_input_tokens integer required
Example: 0

Number of prompt tokens read from cache.

completion_tokens integer required
Example: 20

Number of tokens in the generated completion.

prompt_tokens integer required
Example: 10

Number of tokens in the prompt.

total_tokens integer required
Example: 30

Total number of tokens used in the request (prompt + completion).

401

Authentication failed due to invalid credentials.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

429

The API rate limit has been exceeded.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

500

There was a server error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

default

There was an unexpected error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0
    }
  ],
  "created": 1677649420,
  "id": "chatcmpl-abc123",
  "model": "llama3-8b-instruct",
  "object": "chat.completion",
  "usage": {
    "cache_created_input_tokens": 0,
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "completion_tokens": 20,
    "prompt_tokens": 10,
    "total_tokens": 30
  }
}
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}
{
  "id": "too_many_requests",
  "message": "API rate limit exceeded."
}
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}
{
  "id": "example_error",
  "message": "some error message"
}

POST Generate images from text prompts

/v1/images/generations
Authorizations: bearer_auth
Http: Bearer

OAuth Authentication

In order to interact with the DigitalOcean API, you or your application must authenticate.

The DigitalOcean API handles this through OAuth, an open standard for authorization. OAuth allows you to delegate access to your account. Scopes can be used to grant full access, read-only access, or access to a specific set of endpoints.

You can generate an OAuth token by visiting the Apps & API section of the DigitalOcean control panel for your account.

An OAuth token functions as a complete authentication request. In effect, it acts as a substitute for a username and password pair.

Because of this, it is absolutely essential that you keep your OAuth tokens secure. In fact, upon generation, the web interface will only display each token a single time in order to prevent the token from being compromised.

DigitalOcean access tokens begin with an identifiable prefix in order to distinguish them from other similar tokens.

  • dop_v1_ for personal access tokens generated in the control panel
  • doo_v1_ for tokens generated by applications using the OAuth flow
  • dor_v1_ for OAuth refresh tokens

Scopes

Scopes act like permissions assigned to an API token. These permissions determine what actions the token can perform. You can create API tokens that grant read-only access, full access, or limited access to specific endpoints by using custom scopes.

Generally, scopes are designed to match HTTP verbs and common CRUD operations (Create, Read, Update, Delete).

HTTP Verb CRUD Operation Scope
GET Read <resource>:read
POST Create <resource>:create
PUT/PATCH Update <resource>:update
DELETE Delete <resource>:delete

For example, creating a new Droplet by making a POST request to the /v2/droplets endpoint requires the droplet:create scope while listing Droplets by making a GET request to the /v2/droplets endpoint requires the droplet:read scope.

Each endpoint below specifies which scope is required to access it when using custom scopes.

How to Authenticate with OAuth

In order to make an authenticated request, include a bearer-type Authorization header containing your OAuth token. All requests must be made over HTTPS.

Authenticate with a Bearer Authorization Header

curl -X $HTTP_METHOD -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" "https://api.digitalocean.com/v2/$OBJECT"

Creates a high-quality image from a text prompt using GPT-IMAGE-1, the latest image generation model with automatic prompt optimization and enhanced visual capabilities.

Request Body: application/json

background string optional Nullable
Example: auto

The background setting for the image generation. Supported values: transparent, opaque, auto.

model string required
Example: openai-gpt-image-1

The model to use for image generation.

moderation string optional Nullable
Example: auto

The moderation setting for the image generation. Supported values: low, auto.

n integer required
Example: 1

The number of images to generate. Must be between 1 and 10.

output_compression integer optional Nullable
Example: 100

The output compression level for the image generation (0-100).

output_format string optional Nullable
Example: png

The output format for the image generation. Supported values: png, webp, jpeg.

partial_images integer optional Nullable
Example: 1

The number of partial image chunks to return during streaming generation. Defaults to 0. When stream=true, this must be greater than 0 to receive progressive updates of the image as it is being generated.

prompt string required
Example: A cute baby sea otter floating on its back in calm blue water

A text description of the desired image(s). Supports up to 32,000 characters and provides automatic prompt optimization for best results.

quality string optional Nullable
Example: auto

The quality of the image that will be generated. Supported values: auto, high, medium, low.

size string, one of: auto, 1536x1024, 1024x1536 optional
Example: auto

The size of the generated images. GPT-IMAGE-1 supports: auto (automatically select best size), 1536x1024 (landscape), 1024x1536 (portrait).

stream boolean optional Nullable
Example: false

If set to true, partial image data will be streamed as the image is being generated. The response will be sent as server-sent events with partial image chunks. When stream is true, partial_images must be greater than 0.

user string optional Nullable
Example: user-1234

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

Content type application/json
{
  "background": "auto",
  "model": "openai-gpt-image-1",
  "moderation": "auto",
  "n": 1,
  "output_compression": 100,
  "output_format": "png",
  "partial_images": 1,
  "prompt": "A cute baby sea otter floating on its back in calm blue water",
  "quality": "auto",
  "size": "auto",
  "stream": false,
  "user": "user-1234"
}
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  -d '{"prompt": "A cute baby sea otter floating on its back in calm blue water", "model": "openai-gpt-image-1", "size": "auto", "quality": "auto"}' \
  "https://inference.do-ai.run/v1/images/generations"

Responses

200

Successful image generation. When stream is true, response is sent as Server-Sent Events (text/event-stream); otherwise a single JSON object (application/json) is returned.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

background string optional Nullable
Example: opaque

The background setting used for the image generation.

created integer required
Example: 1677649456

The Unix timestamp (in seconds) of when the images were created.

data array of object required

The list of generated images.

Show child properties
b64_json string required
Example: iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEX...

The base64-encoded JSON of the generated image.

revised_prompt string optional

The optimized prompt that was used to generate the image.

output_format string optional Nullable
Example: png

The output format of the generated image.

quality string optional Nullable
Example: high

The quality setting used for the image generation.

size string optional Nullable
Example: 1024x1024

The size of the generated image.

usage object optional Nullable

Usage statistics for the image generation request.

401

Authentication failed due to invalid credentials.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

429

The API rate limit has been exceeded.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

500

There was a server error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

default

There was an unexpected error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

{
  "background": "opaque",
  "created": 1677649456,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEX...",
      "revised_prompt": "A cute baby sea otter floating on its back in calm blue water, captured with professional photography lighting and composition"
    }
  ],
  "output_format": "png",
  "quality": "high",
  "size": "1024x1024",
  "usage": {
    "input_tokens": 12,
    "input_tokens_details": {
      "image_tokens": 0,
      "text_tokens": 12
    },
    "output_tokens": 4160,
    "total_tokens": 4172
  }
}
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}
{
  "id": "too_many_requests",
  "message": "API rate limit exceeded."
}
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}
{
  "id": "example_error",
  "message": "some error message"
}

GET List available models

/v1/models
Authorizations: bearer_auth
Http: Bearer

OAuth Authentication

In order to interact with the DigitalOcean API, you or your application must authenticate.

The DigitalOcean API handles this through OAuth, an open standard for authorization. OAuth allows you to delegate access to your account. Scopes can be used to grant full access, read-only access, or access to a specific set of endpoints.

You can generate an OAuth token by visiting the Apps & API section of the DigitalOcean control panel for your account.

An OAuth token functions as a complete authentication request. In effect, it acts as a substitute for a username and password pair.

Because of this, it is absolutely essential that you keep your OAuth tokens secure. In fact, upon generation, the web interface will only display each token a single time in order to prevent the token from being compromised.

DigitalOcean access tokens begin with an identifiable prefix in order to distinguish them from other similar tokens.

  • dop_v1_ for personal access tokens generated in the control panel
  • doo_v1_ for tokens generated by applications using the OAuth flow
  • dor_v1_ for OAuth refresh tokens

Scopes

Scopes act like permissions assigned to an API token. These permissions determine what actions the token can perform. You can create API tokens that grant read-only access, full access, or limited access to specific endpoints by using custom scopes.

Generally, scopes are designed to match HTTP verbs and common CRUD operations (Create, Read, Update, Delete).

HTTP Verb CRUD Operation Scope
GET Read <resource>:read
POST Create <resource>:create
PUT/PATCH Update <resource>:update
DELETE Delete <resource>:delete

For example, creating a new Droplet by making a POST request to the /v2/droplets endpoint requires the droplet:create scope while listing Droplets by making a GET request to the /v2/droplets endpoint requires the droplet:read scope.

Each endpoint below specifies which scope is required to access it when using custom scopes.

How to Authenticate with OAuth

In order to make an authenticated request, include a bearer-type Authorization header containing your OAuth token. All requests must be made over HTTPS.

Authenticate with a Bearer Authorization Header

curl -X $HTTP_METHOD -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" "https://api.digitalocean.com/v2/$OBJECT"

Lists the currently available models, and provides basic information about each one such as the owner and availability.

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  "https://inference.do-ai.run/v1/models"

Responses

200

A list of available models.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

data array of object required

The list of available models.

Show child properties
created integer required
Example: 1686935002

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

id string required
Example: meta-llama/Meta-Llama-3.1-8B-Instruct

The model identifier, which can be referenced in the API endpoints.

object string, one of: model required
Example: model

The object type, which is always "model".

owned_by string required
Example: digitalocean

The organization that owns the model.

object string, one of: list required
Example: list

The object type, which is always "list".

401

Authentication failed due to invalid credentials.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

429

The API rate limit has been exceeded.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

500

There was a server error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

default

There was an unexpected error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

{
  "data": [
    {
      "created": 1686935002,
      "id": "meta-llama/Meta-Llama-3.1-8B-Instruct",
      "object": "model",
      "owned_by": "digitalocean"
    }
  ],
  "object": "list"
}
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}
{
  "id": "too_many_requests",
  "message": "API rate limit exceeded."
}
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}
{
  "id": "example_error",
  "message": "some error message"
}

POST Send Prompt to a Model Using the Responses API

/v1/responses
Authorizations: bearer_auth
Http: Bearer

OAuth Authentication

In order to interact with the DigitalOcean API, you or your application must authenticate.

The DigitalOcean API handles this through OAuth, an open standard for authorization. OAuth allows you to delegate access to your account. Scopes can be used to grant full access, read-only access, or access to a specific set of endpoints.

You can generate an OAuth token by visiting the Apps & API section of the DigitalOcean control panel for your account.

An OAuth token functions as a complete authentication request. In effect, it acts as a substitute for a username and password pair.

Because of this, it is absolutely essential that you keep your OAuth tokens secure. In fact, upon generation, the web interface will only display each token a single time in order to prevent the token from being compromised.

DigitalOcean access tokens begin with an identifiable prefix in order to distinguish them from other similar tokens.

  • dop_v1_ for personal access tokens generated in the control panel
  • doo_v1_ for tokens generated by applications using the OAuth flow
  • dor_v1_ for OAuth refresh tokens

Scopes

Scopes act like permissions assigned to an API token. These permissions determine what actions the token can perform. You can create API tokens that grant read-only access, full access, or limited access to specific endpoints by using custom scopes.

Generally, scopes are designed to match HTTP verbs and common CRUD operations (Create, Read, Update, Delete).

HTTP Verb CRUD Operation Scope
GET Read <resource>:read
POST Create <resource>:create
PUT/PATCH Update <resource>:update
DELETE Delete <resource>:delete

For example, creating a new Droplet by making a POST request to the /v2/droplets endpoint requires the droplet:create scope while listing Droplets by making a GET request to the /v2/droplets endpoint requires the droplet:read scope.

Each endpoint below specifies which scope is required to access it when using custom scopes.

How to Authenticate with OAuth

In order to make an authenticated request, include a bearer-type Authorization header containing your OAuth token. All requests must be made over HTTPS.

Authenticate with a Bearer Authorization Header

curl -X $HTTP_METHOD -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" "https://api.digitalocean.com/v2/$OBJECT"

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

Request Body: application/json

input array | string required

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.

instructions string optional Nullable
Example: You are a helpful assistant.

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

max_output_tokens integer optional Nullable
Example: 50

The maximum number of tokens to generate in the response.

metadata object optional Nullable
Example: {"session_id":"abc123"}

Set of key-value pairs that can be attached to the request.

Show child properties
(additional properties) string optional

Additional properties are allowed.

model string required
Example: openai-gpt-oss-20b

The model ID of the model you want to use. Get the model ID using /v1/models or on the available models page.

stop array | string optional Nullable

Up to 4 sequences where the API will stop generating further tokens.

stream boolean optional Nullable
Example: false

Set to true to stream partial responses as Server-Sent Events.

stream_options object optional Nullable

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

Show child properties
include_usage boolean optional
Example: true

If set, an additional chunk will be streamed before the data: [DONE] message with token usage statistics for the entire request.

temperature number optional Nullable
Example: 0.7

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.

tool_choice oneOf optional

Controls which (if any) tool is called by the model.

One of:
Option 1
function
function object required
Show child properties
name string required
Example: get_weather

The name of the function to call.

type string, one of: function required
Example: function
tools array of object optional Nullable

A list of tools the model may call.

Show child properties
description string optional
Example: Get the current weather in a given location.

A description of what the function does.

name string optional
Example: get_weather

The name of the function to be called.

parameters object optional

The parameters the function accepts, described as a JSON Schema object.

Show child properties
(additional properties) object optional

Additional properties are allowed.

type string, one of: function required
Example: function

The type of the tool.

top_p number optional Nullable
Example: 1

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.

user string optional Nullable
Example: user-1234

A unique identifier representing your end-user.

Content type application/json
{
  "input": "What is the capital of France?",
  "instructions": "You are a helpful assistant.",
  "max_output_tokens": 50,
  "metadata": {
    "session_id": "abc123"
  },
  "model": "openai-gpt-oss-20b",
  "stop": "\n",
  "stream": false,
  "stream_options": {
    "include_usage": true
  },
  "temperature": 0.7,
  "tool_choice": "auto",
  "tools": [
    {
      "description": "Get the current weather in a given location.",
      "name": "get_weather",
      "type": "function"
    }
  ],
  "top_p": 1,
  "user": "user-1234"
}
curl -sS -X POST \
  -H "Authorization: Bearer $MODEL_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai-gpt-oss-20b",
    "input": "What is the capital of France?",
    "max_output_tokens": 50,
    "temperature": 0.7,
    "stream": false
  }' \
  "https://inference.do-ai.run/v1/responses"

Responses

200

Successful response. When stream is true, response is sent as Server-Sent Events (text/event-stream); otherwise a single JSON object (application/json) is returned.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

created integer required
Example: 1721596428

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

id string required
Example: response-abc123def456

A unique identifier for the response.

max_output_tokens integer optional Nullable
Example: 50

Maximum output tokens setting.

model string required
Example: openai-gpt-oss-20b

The model used to generate the response.

object string, one of: response required
Example: response

The object type, which is always response.

output array of object required

An array of content items generated by the model. Each item has a type and a content array. Types include reasoning and output text.

Show child properties
arguments string optional Nullable
Example: {"location": "San Francisco"}

JSON string of function arguments (present when type is function_call).

call_id string optional Nullable
Example: call_abc123

The unique ID of the function tool call (present when type is function_call).

content array of object required

Array of content parts for this output item. Each part has a type and text. Content types include reasoning_text for reasoning items and output_text for final output.

Show child properties
text string required
Example: The capital of France is **Paris**.

The text content.

type string, one of: reasoning_text, output_text required
Example: output_text

The type of content part. reasoning_text for reasoning content, output_text for final output text.

id string optional
Example: item_abc123

The unique ID of the output item.

name string optional Nullable
Example: get_weather

The name of the function to call (present when type is function_call).

role string optional Nullable
Example: assistant

The role associated with this output item (typically assistant).

status string optional Nullable
Example: completed

Status of the item.

type string, one of: reasoning, message, function_call required
Example: message

The type of output item. One of reasoning, message, or function_call.

parallel_tool_calls boolean optional Nullable
Example: false

Whether parallel tool calls are enabled.

status string optional Nullable
Example: completed

Status of the response.

temperature number optional Nullable
Example: 0.7

Temperature setting used for the response.

tool_choice string optional Nullable
Example: auto

Tool choice setting used for the response.

tools array of object optional Nullable

Tools available for the response.

Show child properties
description string optional
Example: Get the current weather in a given location.

A description of what the function does.

name string optional
Example: get_weather

The name of the function.

parameters object optional

The parameters the function accepts.

Show child properties
(additional properties) object optional

Additional properties are allowed.

type string, one of: function required
Example: function

The type of the tool.

top_p number optional Nullable
Example: 1

Top-p setting used for the response.

usage object required

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

Show child properties
input_tokens integer required
Example: 133

The number of input tokens.

input_tokens_details object required

A detailed breakdown of the input tokens.

Show child properties
cached_tokens integer required
Example: 128

The number of tokens that were retrieved from the cache.

output_tokens integer required
Example: 41

The number of output tokens.

output_tokens_details object required

A detailed breakdown of the output tokens.

Show child properties
reasoning_tokens integer required
Example: 24

The number of reasoning tokens.

tool_output_tokens integer required
Example: 0

The number of tool output tokens.

total_tokens integer required
Example: 174

The total number of tokens used.

user string optional Nullable
Example: user-1234

User identifier.

401

Authentication failed due to invalid credentials.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

429

The API rate limit has been exceeded.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

500

There was a server error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

default

There was an unexpected error.

ratelimit-limit integer

The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.

ratelimit-remaining integer

The number of requests in your hourly quota that remain before you hit your request limit. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

ratelimit-reset integer

The time when the oldest request will expire. The value is given in Unix epoch time. See https://docs.digitalocean.com/reference/api/reference/#rate-limit for information about how requests expire.

id string required
Example: not_found

A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."

message string required
Example: The resource you were accessing could not be found.

A message providing additional information about the error, including details to help resolve it when possible.

request_id string optional
Example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9

Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

{
  "created": 1721596428,
  "id": "response-abc123def456",
  "max_output_tokens": 50,
  "model": "openai-gpt-oss-20b",
  "object": "response",
  "output": [
    {
      "arguments": "{\"location\": \"San Francisco\"}",
      "call_id": "call_abc123",
      "content": [],
      "id": "item_abc123",
      "name": "get_weather",
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "parallel_tool_calls": false,
  "status": "completed",
  "temperature": 0.7,
  "tool_choice": "auto",
  "tools": [
    {
      "description": "Get the current weather in a given location.",
      "name": "get_weather",
      "type": "function"
    }
  ],
  "top_p": 1,
  "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
  },
  "user": "user-1234"
}
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}
{
  "id": "too_many_requests",
  "message": "API rate limit exceeded."
}
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}
{
  "id": "example_error",
  "message": "some error message"
}

We can't find any results for your search.

Try using different keywords or simplifying your search terms.