How to Retrieve Available Models
Last verified 16 Oct 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 Godo, the official DigitalOcean API client for Go:
package main
import (
"context"
"fmt"
"os"
"github.com/digitalocean/godo"
)
func main() {
client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
ctx := context.Background()
page, _, err := client.Models.List(ctx)
if err != nil {
panic(err)
}
for _, model := range page.Data {
fmt.Println(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 SDK:
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)You can also use the Go SDK (Godo):
package main
import (
"context"
"fmt"
"os"
"github.com/digitalocean/godo"
)
func main() {
client := godo.NewFromToken(os.Getenv("MODEL_ACCESS_KEY"))
ctx := context.Background()
page, _, err := client.Models.List(ctx)
if err != nil {
panic(err)
}
for _, m := range page.Data {
fmt.Println("-", m.ID)
}
}