Skip to main content
Use this guide when you need to add reference-to-video generation where images influence the output without forcing exact first or last frames. By the end, your implementation should submit a reference-to-video job with input_references.
For reusable agent knowledge across projects, install the openrouter-video skill.

Before you start

You need:
  • An OpenRouter API key available as OPENROUTER_API_KEY
  • Node.js 20 or newer
  • One or more public HTTPS image URLs, starting with REFERENCE_IMAGE_URL
  • A model that supports reference-to-video, confirmed from the current OpenRouter video docs or model description
If you haven’t chosen a model yet, read Choose a Video Generation Model first. It helps you pick one based on clip duration, output shape, input type, audio, provider controls, and cost.
Use the API reference pages as the source of truth for exact fields: Use input_references for visual guidance. Use frame_images only when you need exact frame control. Use stable, directly downloadable image URLs. Some providers cannot fetch image URLs that require cookies, redirects through HTML pages, bot checks, or unusual headers.
Submitting POST /api/v1/videos starts a real video generation job and may spend OpenRouter credits.
The video models endpoint doesn’t expose a dedicated structured reference-image field for every provider. Confirm reference support from the model description or current docs before you submit:
Example model output excerpt:
For bytedance/seedance-2.0-fast, the model list can confirm the example duration, resolution, and aspect_ratio; reference-image support may still need confirmation from the model description or docs.

Step 1: Write a prompt that tells the model how to use the references

Reference images work best when the prompt explains what should stay consistent.

Step 2: Submit the reference-to-video job

Set OPENROUTER_API_ORIGIN to https://eu.openrouter.ai or https://us.openrouter.ai for regional routing. Leave it unset to use https://openrouter.ai. Build the video request with input_references when the images should guide subject, identity, or style. Unlike frame_images, reference images are not exact frame anchors. Example request shape:
The submit call returns the job fields immediately. In the QA run, the submitted job later completed and downloaded with this final summary:

Step 3: Add more references when consistency matters

Some models can use multiple reference images. Before doing this in production, check the current docs or model description for the selected model. Start with the smallest number of references that gives you enough consistency.
Then set input_references in the request body to inputReferences. In the cURL tab, REQUEST_BODY already holds the step 2 request with the array in place: submit it to POST /api/v1/videos with -d "$REQUEST_BODY". Request shape for the optional multi-reference path:

Use a face with Seedance 2.x

bytedance/seedance-2.5 and bytedance/seedance-2.0 reject reference or frame images and videos that may show a real person. Requests fail with the error The request failed because the input image 'content[1]' may contain real person. Photos and videos of real people are not supported on these models through OpenRouter. To use a face with these models, generate it first:
  1. Generate the face with bytedance-seed/seedream-5-5 or bytedance-seed/seedream-5-0-lite via the image generation API.
  2. Within 30 days, send the returned image unmodified as a data URL in place of the rejected one in input_references or frame_images.
Edited, cropped, or re-hosted copies may fail the check. Output from bytedance-seed/seedream-4.5 does not qualify. This workaround only applies to requests that run on OpenRouter’s BytePlus account. With your own BytePlus key (BYOK), the face must be generated on that same BytePlus account, so a Seedream image generated through OpenRouter can still be rejected.

Step 4: Poll and download

After submission, poll the returned polling_url from a server route, worker, or job runner. Poll with a limit, stop on terminal failure, then download the selected unsigned_urls entry as returned. Both requests use your API key on the configured OpenRouter origin only. If you use a signed link from urls instead, follow its redirect without sending your API key. Example polling and download helper:
The QA run saved the finished video after polling completed:

Check your work

The output should borrow subject, style, or identity cues from the reference images while still following the generated scene described in the prompt. The implementation should produce a playable MP4 from the completed job.