Use /model with the Vercel AI SDK

Use every /model model in the Vercel AI SDK through its OpenAI Compatible provider, and Claude through its Anthropic provider.

Checked November 23, 2026

In the AI SDK, the OpenAI Compatible provider serves every /model model. Claude also works through the Anthropic provider.

Before you start

Install

bash
npm install ai @ai-sdk/openai-compatible @ai-sdk/anthropic

Code

JavaScript
import { createAnthropic } from "@ai-sdk/anthropic";
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";

const slashmodel = createOpenAICompatible({
  name: "slashmodel",
  baseURL: "https://api.slashmodel.com/v1",
  apiKey: process.env.SLASHMODEL_API_KEY,
  includeUsage: true, // token counts in streamed answers too
});
const anthropic = createAnthropic({
  baseURL: "https://api.slashmodel.com/v1", // with /v1 for this provider
  apiKey: process.env.SLASHMODEL_API_KEY,
});

const gpt = await generateText({ model: slashmodel("gpt-6.1-sol"), prompt: "Say hello in French." });
console.log(gpt.text);
const claude = await generateText({ model: anthropic("claude-sonnet-5-5"), prompt: "Say hello in Spanish." });
console.log(claude.text);

streamText works the same way.

Good to know

  • With @ai-sdk/openai, openai.chat("gpt-6.1-sol") works for every model. openai("gpt-6.1-sol") sends the request to the Responses API instead, which /model serves for GPT models only.
  • The Anthropic provider's base URL needs /v1.
  • includeUsage: true makes streamed answers report their token counts; the provider leaves it off by default.

One key for every model here.

Top up from $10, change one URL, and pay only for the tokens you use.