How to Retrieve Available Models
Last verified 22 Jun 2026
Inference provides a single control plane for managing inference workflows. It includes a Model Catalog where you can view available foundation models, including both DigitalOcean-hosted and third-party commercial models, compare model capabilities and pricing, use routing to match inference requests to the best-fit model, and run inference using serverless or dedicated deployments.
The following cURL and Python examples show how to retrieve models available for serverless inference.
Create a model access key and save it for use with the API.
Using PyDo, the official DigitalOcean API client for Python:
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
resp = client.models.list()
for model in resp.data:
print(model.id)Using dots, the official DigitalOcean API client for JavaScript:
import { InferenceClient } from "@digitalocean/dots";
const client = new InferenceClient({
apiKey: process.env.DIGITALOCEAN_TOKEN,
});
const resp = await client.models.list();
for (const model of resp.data) {
console.log(model.id);
}Send a GET request to https://inference.do-ai.run/v1/models.
Using cURL:
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://inference.do-ai.run/v1/models"You can also use the Python OpenAI and Gradient Python SDKs:
from openai import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
client = OpenAI(
base_url="https://inference.do-ai.run/v1/",
api_key=os.getenv("MODEL_ACCESS_KEY"),
)
models = client.models.list()
for m in models.data:
print("-", m.id)from gradient import Gradient
from dotenv import load_dotenv
import os
load_dotenv()
client = Gradient(model_access_key=os.getenv("MODEL_ACCESS_KEY"))
models = client.models.list()
print("Available models:")
for model in models.data:
print(f" - {model.id}")