---
title: "Vercel AI SDK Provider (@rawroute/ai-sdk)"
canonical: "https://rawroute.dev/integrations/vercel-ai-sdk"
lang: "en"
last_verified: "2026-11-28"
description: "Drop @rawroute/ai-sdk into Next.js and TypeScript apps for streamText, generateObject, Veo 3.1 video, and speech at 50–70% below list with 0% fee."
---

# Use rawroute with Vercel AI SDK.

Our @rawroute/ai-sdk package implements the Vercel AI SDK provider interface for chat streaming, tool calling, structured outputs, and image generation—plus typed generateRawrouteVideo and generateRawrouteSpeech helpers on one API key with 0% top-up fee.

## Setup Steps

1. Install @rawroute/ai-sdk alongside ai in your TypeScript or Next.js project.
2. Set RAWROUTE_API_KEY in .env.local (base URL defaults to https://api.rawroute.dev/v1).
3. Call streamText({ model: rawroute("claude-sonnet-5-5"), ... }) with full type safety.

### TypeScript · streamText + Video Helper

```ts
import { rawroute, generateRawrouteVideo } from "@rawroute/ai-sdk"
import { streamText } from "ai"

const { textStream } = streamText({
  model: rawroute("claude-sonnet-5-5"),
  prompt: "Write a PostgreSQL migration for API key spend caps.",
})

const video = await generateRawrouteVideo({
  model: "veo-3.1",
  prompt: "Macro shot of rain droplets on neon glass at night",
  baseURL: "https://api.rawroute.dev",
})
```

## When NOT to use rawroute

- If you prefer zero extra packages, @ai-sdk/openai-compatible pointed at https://api.rawroute.dev/v1 also works immediately.
