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/gateway/models", {
headers: {
Authorization: `Bearer ${process.env.AI_STATS_API_KEY}`,
},
});
if (!response.ok) {
throw new Error(`Failed to load models: ${response.status}`);
}
const models = await response.json();
console.log(models);
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();
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.
- Re-check model availability periodically for routing and deprecations.
- Prefer selecting IDs from
/v1/gateway/models over hard-coding long-term.
Last modified on March 16, 2026