Vercel AI SDK with idapt
Point the AI SDK's OpenAI provider at idapt and route 200+ models through one key.
Last reviewed 2026-07-17
Install
bash
npm i ai @ai-sdk/openai-compatiblePoint it at idapt
ts
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
const idapt = createOpenAICompatible({
name: "idapt",
baseURL: "https://idapt.app/api/openai/v1",
apiKey: process.env.IDAPT_API_KEY,
});
const model = idapt("anthropic/claude-sonnet-5");Model ids are author/model slugs from the catalog; every catalog model routes through the same key.
Streaming
ts
import { streamText } from "ai";
const result = streamText({
model,
prompt: "Summarize this repo's README in three bullets.",
});
for await (const chunk of result.textStream) process.stdout.write(chunk);Pitfalls
Use the openai-compatible provider, not the OpenAI one
The first-party @ai-sdk/openai provider pins OpenAI-only auth behavior. The openai-compatible provider accepts any base URL and passes model ids through unchanged.
Keep the /v1 suffix
The base URL ends in /v1. Dropping it produces 404s on /chat/completions.