Skip to content

fix(videos): allow up to 9 reference images on Seedance 2.0 - #3027

Merged
steebchen merged 1 commit into
mainfrom
fix/seedance-2-reference-images
Jul 13, 2026
Merged

steebchen merged 1 commit into
mainfrom
fix/seedance-2-reference-images

Conversation

@steebchen

@steebchen steebchen commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Summary

A user reported that Seedance 2.0 Fast only accepted up to 3 reference images, while ByteDance's official Seedance 2.0 omni-reference documentation states it supports up to 9 reference images (alongside up to 3 reference videos and 3 reference audio clips).

This was not Fast-specific: the shared reference_images request schema in apps/gateway/src/videos/videos.ts was hard-capped at .max(3) for every video model, so all three Seedance 2.0 variants (seedance-2-0, seedance-2-0-fast, seedance-2-0-mini) were affected.

Changes

  • Raise the shared videoReferenceImagesSchema cap from 3 → 9 (the maximum any model supports).
  • Enforce the real per-provider limits in getVideoProviderConstraintReasons:
    • bytedance Seedance 2.0 → up to 9 reference images
    • all other providers (google-vertex / avalanche Veo, etc.) → keep the previous cap of 3 (no behavior change)
  • Update the reference_images OpenAPI description to reflect the new range.
  • Extend the mock server to capture ByteDance reference_image content items so forwarding can be asserted.

Tests

New tests in videos.spec.ts:

  • Seedance 2.0 Fast forwards all 9 reference images.
  • Seedance 2.0 Fast rejects 10 (schema cap).
  • Veo rejects more than 3 reference images (per-provider cap preserved).

The reference videos/audios .max(3) caps already matched the docs and were left unchanged. Full videos.spec.ts suite (45 tests) passes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Support up to nine reference images for Seedance 2.0 Fast video generation.
    • Updated reference-image guidance to reflect provider-specific limits.
  • Bug Fixes

    • Added validation to reject requests exceeding supported reference-image limits.
    • Other video providers now allow up to three reference images, with clear error messages when exceeded.

Seedance 2.0 (including Fast/Mini) supports up to 9 reference images per
ByteDance's omni-reference documentation, but the shared video request
schema hard-capped reference_images at 3 for every model.

Raise the schema cap to 9 and enforce the real per-provider limits in the
constraint checker: bytedance Seedance 2.0 accepts up to 9, all other
providers keep the previous cap of 3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 13, 2026 11:40
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 54d42982-9e1c-42fd-a9d2-807c106c72dc

📥 Commits

Reviewing files that changed from the base of the PR and between 9177a84 and ef4acd3.

📒 Files selected for processing (3)
  • apps/gateway/src/test-utils/mock-openai-server.ts
  • apps/gateway/src/videos/videos.spec.ts
  • apps/gateway/src/videos/videos.ts

Walkthrough

Changes

The gateway now supports provider-specific reference image limits: up to 9 for Seedance 2.0 and up to 3 for other providers. Tests cover acceptance and rejection cases, while the mock upstream server parses and stores reference images.

Reference image limits

Layer / File(s) Summary
Provider-specific image limits and validation
apps/gateway/src/videos/videos.ts, apps/gateway/src/videos/videos.spec.ts
Schemas, OpenAPI text, routing constraints, and tests now enforce Seedance’s 9-image limit and the 3-image default limit.
Mock upstream reference image parsing
apps/gateway/src/test-utils/mock-openai-server.ts
Reference-image content entries are parsed from data URLs and stored on MockVideoJobState when present.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: increasing Seedance 2.0 reference-image support to 9.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/seedance-2-reference-images

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@steebchen
steebchen merged commit ab3d4e7 into main Jul 13, 2026
17 checks passed
@steebchen
steebchen deleted the fix/seedance-2-reference-images branch July 13, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants