Skip to content
Router One

One AI SDK provider for every model family

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
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.