Skip to content

Repository files navigation

WaveSpeed provider for the Vercel AI SDK

The WaveSpeed provider for the Vercel AI SDK gives you access to WaveSpeed's image and video generation models through the standard AI SDK interfaces (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',
});

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, 10 minute timeout by default — configurable via pollIntervalMillis / pollTimeoutMillis in createWaveSpeed), 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('bytedance/seedance-2.5/text-to-video'),
  prompt: 'A drone shot flying over a rugged coastline at golden hour',
  aspectRatio: '16:9',
  duration: 5,
});

console.log(video.url);

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

AI SDK option WaveSpeed request field
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

About

WaveSpeed provider for the Vercel AI SDK — image & video generation via wavespeed.ai

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages