Vercel AI SDK
Vercel AI SDK
You can use the Vercel AI SDK to integrate OpenRouter with your Next.js app. To get started, install @openrouter/ai-sdk-provider:
And then you can use streamText() API to stream text from OpenRouter.
Video Generation
OpenRouter supports video generation through the AI SDK’s experimental_generateVideo API. The provider handles the asynchronous submit-poll-download workflow automatically.
Passthrough Options
Each video model supports model-specific parameters that can be passed through via provider.options in extraBody, keyed by provider slug. See the video generation docs for the full list of allowed_passthrough_parameters per model.
Video Model Settings
Image-to-Video
You can pass a reference image to guide the video generation:
Provider Metadata
The response includes OpenRouter-specific metadata accessible via providerMetadata:
For the full list of supported models, resolutions, aspect ratios, and provider-specific options, see the Video Generation documentation.