# One AI SDK provider for every model family

> Markdown mirror of https://router.one/integrations/vercel-ai-sdk for AI assistants and crawlers. Router One is an OpenAI-compatible LLM API gateway.
> Last updated: 2026-08-24

The Vercel AI SDK abstracts providers behind a uniform interface — and Router One collapses them further: configure the OpenAI provider once with the gateway base URL and reach GPT, Claude, Gemini, and DeepSeek family models by changing a model string. Streaming, tool calls, and generateText/streamText work unchanged, and each request is traced for cost on the gateway.

## Configure Vercel AI SDK to use the Router One base URL

Create the provider with createOpenAI and the Router One base URL, then use any catalog model ID:

`ai-sdk-example.ts`

```bash
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const router = createOpenAI({
  baseURL: "https://api.router.one/v1",
  apiKey: "sk-your-router-one-key",
});

const { text } = await generateText({
  model: router("<model-id-from-/models>"),
  prompt: "Hello!",
});
```

## Which model ID should Vercel AI SDK send?

Copy the exact model ID from the /models page — IDs are case-sensitive, and the page lists each model's context window, capabilities, and current per-token rates. Create a dedicated API key per tool with its own maxSpend cap, so one runaway tool can't affect other workloads.

## Verify the Vercel AI SDK call in your request trace

After your first request, open Dashboard → Logs to see its full trace: model, tokens, cost, latency, and status code. From here every Vercel AI SDK call has a ledger and a trail instead of being a black box.

## FAQ

### Does streaming work through the gateway?

Yes — streamText and streaming chat completions work unchanged; the gateway speaks the OpenAI streaming protocol. The full request still shows up as one traced entry with tokens and cost.

### Which models can Vercel AI SDK use through the gateway?

Any chat-capable model in the catalog — GPT, Claude, Gemini, Grok, DeepSeek, GLM, MiniMax, and Doubao families. The /models page is the source of truth for model IDs and per-token rates.

### Does this work from Mainland China?

Yes. The gateway is reachable from Mainland China without a VPN, and the configuration is identical to the global setup.

### How do I debug a 401/403/429?

Open Dashboard → Logs first to see whether requests reached the gateway and with what status, then walk the error-codes reference to check env vars, key status, and limits.

## See also

- All integration guides: https://router.one/integrations
- Debug 401/403/429 in Vercel AI SDK: https://router.one/llm-api-error-codes
- OpenAI SDK setup: https://router.one/integrations/openai-sdk
- Dify setup: https://router.one/integrations/dify
- What the gateway layer does: https://router.one/llm-api-gateway
- OpenAI-compatible API: https://router.one/openai-compatible-api
- API docs: https://router.one/docs
- Canonical page: https://router.one/integrations/vercel-ai-sdk
- Models and per-model token rates: https://router.one/models (markdown: https://router.one/models.md)
- Pricing: https://router.one/pricing
- API docs (markdown): https://router.one/docs.md
- Company facts: https://router.one/facts/company.md
