integrations/framework/Vercel AI SDK
AS

Vercel AI SDK + AIgateway

Use @ai-sdk/openai with a custom baseURL — every model, every modality.

Vercel's AI SDK has a first-class OpenAI provider that accepts a baseURL. Configure it for AIgateway and every AI SDK feature — streamText, generateObject, tool calling — works against any of our 100+ models.

Vercel AI SDK homepage →
Setup

Three steps or fewer.

STEP 01

Configure the provider

Create a custom OpenAI client pointed at AIgateway and use it everywhere.

import { createOpenAI } from "@ai-sdk/openai";
import { streamText } from "ai";

const ai = createOpenAI({
  baseURL: "https://api.aigateway.sh/v1",
  apiKey: process.env.AIGATEWAY_API_KEY,
});

const result = await streamText({
  model: ai("anthropic/claude-opus-4.7"),
  prompt: "hello",
});
Notes
  • Tool calling, structured outputs (generateObject), and image inputs all pass through.
More integrations

Same key. Every other tool.