The Vercel AI SDK provider does not expose a built-in listModels() helper.
Use one of these patterns to keep model IDs current.
Option 1: Fetch from the Gateway API
const response = await fetch("https://api.phaseo.app/v1/models", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.AI_STATS_API_KEY}`,
},
});
const filteredResponse = await fetch(
"https://api.phaseo.app/v1/models?provider=anthropic&status=active,deprecated&availability=all",
{
headers: {
Authorization: `Bearer ${process.env.AI_STATS_API_KEY}`,
},
},
);
if (!response.ok || !filteredResponse.ok) {
throw new Error("Failed to load models");
}
const models = await response.json();
const filteredModels = await filteredResponse.json();
console.log(models, filteredModels);
Option 2: Use the official TypeScript SDK
import AIStats from "@ai-stats/sdk";
const client = new AIStats({ apiKey: process.env.AI_STATS_API_KEY! });
const models = await client.getModels({
provider: ["anthropic"],
status: ["active", "deprecated"],
availability: "all",
});
console.log(models);
Using discovered IDs with AI SDK
import { aiStats } from "@ai-stats/ai-sdk-provider";
import { generateText } from "ai";
const result = await generateText({
model: aiStats("openai/gpt-5-nano"),
prompt: "Hello from a discovered model ID.",
});
console.log(result.text);
Notes
- Model IDs use
provider/model format.
/v1/models supports filters such as provider, status, organisation, endpoints, and availability.
- Re-check model availability periodically for routing and deprecations.
- Prefer selecting IDs from
/v1/models over hard-coding long-term.
Last modified on June 10, 2026