WaveSpeed provider for the Vercel AI SDK
The WaveSpeed provider for the
Vercel AI SDK gives you access to WaveSpeed's LLMs, image
models and video models through the standard AI SDK interfaces
(generateText / streamText, generateImage, generateVideo).
Installation
npm install @wavespeed/ai-sdk-provider
Setup
Get an API key from the WaveSpeed dashboard and expose
it as the WAVESPEED_API_KEY environment variable:
export WAVESPEED_API_KEY="your-api-key"
Alternatively, pass it explicitly:
import { createWaveSpeed } from '@wavespeed/ai-sdk-provider';
const wavespeed = createWaveSpeed({
apiKey: 'your-api-key',
});
Language models
Chat models are served by the WaveSpeed LLM gateway
(https://llm.wavespeed.ai/v1, override with llmBaseURL) and support
streaming, tool calls and structured output. Browse model IDs in the
LLM catalog.
import { wavespeed } from '@wavespeed/ai-sdk-provider';
import { generateText, streamText } from 'ai';
const { text } = await generateText({
model: wavespeed('deepseek/deepseek-v4.1-flash-1017'),
prompt: 'Write a haiku about GPUs.',
});
const result = streamText({
model: wavespeed.chat('deepseek/deepseek-v4.1-flash-1017'),
prompt: 'Explain diffusion models in one paragraph.',
});
for await (const chunk of result.textStream) process.stdout.write(chunk);
Image generation
import { wavespeed } from '@wavespeed/ai-sdk-provider';
import { experimental_generateImage as generateImage } from 'ai';
import { writeFileSync } from 'node:fs';
const { image } = await generateImage({
model: wavespeed.image('bytedance/seedream-v5.0-pro'),
prompt: 'A serene mountain lake at sunrise, photorealistic',
size: '2048x2048',
});
writeFileSync('output.png', image.uint8Array);
The provider submits the prediction, polls WaveSpeed until it completes
(1s interval by default, no overall time limit — long-running tasks keep
polling until they finish; set pollIntervalMillis / pollTimeoutMillis in
createWaveSpeed to change the interval or to opt in to a cap. Each individual
HTTP request is bounded (submit 60s, each status poll 30s, output download 120s); abort with abortSignal), and returns
the downloaded image bytes.
Video generation
import { wavespeed } from '@wavespeed/ai-sdk-provider';
import { experimental_generateVideo as generateVideo } from 'ai';
const { video } = await generateVideo({
model: wavespeed.video('wavespeed-ai/minimax-h3/text-to-video'),
prompt: 'A drone shot flying over a rugged coastline at golden hour',
aspectRatio: '16:9',
duration: 5,
});
console.log(video.url);
MiniMax H3 is the cheap open-weights starting point; use
wavespeed.video('bytedance/seedance-2.5/text-to-video') for the highest quality.
Video models implement the AI SDK's asynchronous start/status flow, so the
AI SDK core orchestrates polling for you.
Provider options
Model-specific inputs that are not part of the standard AI SDK call options
can be passed through providerOptions.wavespeed. They are merged into the
request body and take precedence over the mapped standard options:
const { image } = await generateImage({
model: wavespeed.image('bytedance/seedream-v5.0-pro'),
prompt: 'A cyberpunk city street at night',
providerOptions: {
wavespeed: {
size: '3840*2160',
enable_sync_mode: false,
},
},
});
Consult the model's page on wavespeed.ai for the
exact input schema of each model. Fields that a model does not declare in its
schema are ignored by the API.
Argument mapping
prompt | prompt |
size ({width}x{height}) | size ({width}*{height}) |
aspectRatio | aspect_ratio |
seed | seed |
duration (video) | duration |
resolution (video) | resolution |
fps (video) | fps |
generateAudio (video) | generate_audio |
| image / file inputs | image / images |
providerOptions.wavespeed.* | passed through as-is (wins on conflict) |
Only defined values are sent.
License
MIT
WaveSpeed AI — AI image & video generation platform.
Try it in the browser: Image generator · Video generator