Vercel AI SDK with idapt
Found this helpful? Share it:
Found this helpful? Share it:
Set up Vercel AI SDK against idapt's compatible APIs with the steps below. This article and the AI Gateway quickstarts lander render the same shared steps, so they never drift.
Vercel AI SDK with idapt
The OpenRouter provider package pointed at idapt: 200+ models, effort control, usage cost in the response.
npm i ai @openrouter/ai-sdk-providerimport { createOpenRouter } from "@openrouter/ai-sdk-provider";
const openrouter = createOpenRouter({
apiKey: process.env.IDAPT_API_KEY,
baseURL: "https://idapt.app/api/openrouter/v1",
});
const model = openrouter("anthropic/claude-sonnet-5");Model ids are catalog slugs. The provider package speaks the OpenRouter dialect, so reasoning effort and usage cost flow through natively.
import { streamText } from "ai";
const result = streamText({
model,
prompt: "Summarize this repo's README in three bullets.",
providerOptions: {
openrouter: { extraBody: { reasoning: { effort: "high" } } },
},
});
for await (const chunk of result.textStream) process.stdout.write(chunk);Related articles
API keys and scopes
Create a key, choose its scopes, pin it to an API version, rotate it, and cap what it can spend.
Rate limits and errors
Every error shape the API returns, what each rate limit is, and how to handle a wall in code.
Cap what an API key spends
Give every Gateway API key a lifetime, monthly, or daily USD cap, and what a capped-out key returns.
OpenAI-compatible API
Use idapt's 200+ models from any app that speaks the OpenAI API format.
OpenAI SDK (JS) with idapt
Point the official OpenAI Node SDK at idapt's compatible API: a three-line change routes 200+ models through your existing code.
LangChain (JS) with idapt
Use LangChain JS with idapt: configure ChatOpenAI with a custom base URL and route any catalog model, tools included.
LiteLLM with idapt
Configure LiteLLM to route through idapt's OpenAI-compatible API: SDK call and proxy config.yaml forms, one key for 200+ models.
Was this helpful?