Skip to content

feat: add ByteDance Seedance video generation models (seedance-2.0, seedance-2.0-fast, seedance-1.5-pro) - #2270

Merged
steebchen merged 11 commits into
theopenco:mainfrom
analogpvt:feat/bytedance-seedance-video-models
May 17, 2026
Merged

steebchen merged 11 commits into
theopenco:mainfrom
analogpvt:feat/bytedance-seedance-video-models

Conversation

@analogpvt

@analogpvt analogpvt commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds official ByteDance provider support for three Seedance video generation models via the ModelArk API.

Models Added

  • Seedance 2.0 (seedance-2-0) — High-quality text-to-video and image-to-video generation
  • Seedance 2.0 Fast (seedance-2-0-fast) — Accelerated video generation for quicker outputs
  • Seedance 1.5 Pro (seedance-1-5-pro) — Professional model with complex instruction following and native audio

Changes

packages/models — Model definitions

  • Added 3 video model definitions with videoGenerations: true
  • Supported sizes: 1280x720, 720x1280, 1920x1080, 1080x1920
  • Supported durations: 5s, 10s
  • Audio support: yes (configurable via generate_audio)

apps/gateway — Video creation

  • Added createBytedanceVideoJob() calling ModelArk /contents/generations/tasks endpoint
  • Maps model names to versioned API names (e.g. seedance-2-0 -> seedance-2-0-250526)
  • Supports text-to-video, image-to-video (first frame), and reference images
  • Aspect ratio derived from requested video size

apps/worker — Status polling

  • Added fetchBytedanceStatus() polling /contents/generations/tasks/{id}
  • Normalizes ByteDance statuses (queued/running/succeeded/failed) to gateway format
  • Extracts video URL from content.video_url response field

API Details

Summary by CodeRabbit

  • New Features
    • ByteDance added as a video-generation provider with a default API endpoint.
    • Three ByteDance models available: seedance-2-0, seedance-2-0-fast, seedance-1-5-pro.
    • Support for first-frame and reference image inputs, aspect-ratio handling, and provider-specific duration/audio/resolution options.
    • Upstream job submission and status polling with normalized progress, output URLs, MIME info, and provider-specific error mapping.

Review Change Stack

Add official ByteDance provider support for three Seedance video generation models:

- seedance-2-0: High-quality video generation (text-to-video & image-to-video)
- seedance-2-0-fast: Accelerated video generation for quicker outputs
- seedance-1-5-pro: Professional model with complex instruction following and native audio

Changes:
- packages/models: Add model definitions with videoGenerations, supported sizes/durations
- apps/gateway: Add ByteDance video creation via ModelArk /contents/generations/tasks API
- apps/worker: Add ByteDance video status polling with proper response normalization

API endpoint: https://ark.ap-southeast.bytepluses.com/api/v3
Auth: Bearer token via LLM_BYTEDANCE_API_KEY
@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds ByteDance video generation support: three new models, gateway upstream model mapping/aspect handling and ByteDance job-creation, plus worker polling and response normalization.

Changes

ByteDance Video Provider Integration

Layer / File(s) Summary
ByteDance Model Definitions
packages/models/src/models/bytedance.ts
Three new models (seedance-2-0, seedance-2-0-fast, seedance-1-5-pro) with video generation capabilities, supported resolutions/durations, pricing, and audio support flags.
Gateway Job Creation and Routing
apps/gateway/src/videos/videos.ts
Adds getBytedanceVideoUpstreamModelName, routes providerId === "bytedance" through the mapper, adds default ByteDance base URL, implements getBytedanceVideoAspectRatio and createBytedanceVideoJob to build/post /contents/generations/tasks payloads (prompt + inline base64 images) and extract upstream task id; dispatcher calls this path for bytedance.
Worker Status Polling and Normalization
apps/worker/src/services/video-jobs.ts
Adds ByteDance base URL routing and fetchBytedanceStatus that GETs /contents/generations/tasks/{id}, normalizes status/progress/video URL/mime type into standard job fields, attaches bytedance_raw_response, and maps failures to error details with a fallback message. Status router detects bytedance provider and invokes polling function.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • steebchen
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the primary change: adding ByteDance Seedance video generation models, and names all three models being added.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/gateway/src/videos/videos.ts (1)

979-988: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Add missing ByteDance base URL case.

The getDefaultVideoProviderBaseUrl function doesn't handle providerId === "bytedance", which will cause provider context resolution to fail at line 1080 and downstream unless the base URL is explicitly set via environment variables. According to the PR summary, the ByteDance endpoint is https://ark.ap-southeast.bytepluses.com/api/v3.

🔧 Proposed fix
 function getDefaultVideoProviderBaseUrl(providerId: Provider): string | null {
 	switch (providerId) {
 		case "openai":
 			return "https://api.openai.com";
 		case "google-vertex":
 			return "https://aiplatform.googleapis.com";
+		case "bytedance":
+			return "https://ark.ap-southeast.bytepluses.com/api/v3";
 		default:
 			return null;
 	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/gateway/src/videos/videos.ts` around lines 979 - 988, The switch in
getDefaultVideoProviderBaseUrl is missing a case for providerId === "bytedance";
add a case for "bytedance" that returns
"https://ark.ap-southeast.bytepluses.com/api/v3" so the provider context
resolution and downstream code can derive the correct default base URL when not
set via env vars.
apps/worker/src/services/video-jobs.ts (1)

135-143: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Add missing ByteDance base URL case.

The getDefaultVideoProviderBaseUrl function doesn't handle providerId === "bytedance", which will cause provider context resolution to fail unless the base URL is explicitly configured via environment variables. According to the PR summary, ByteDance uses endpoint https://ark.ap-southeast.bytepluses.com/api/v3.

🔧 Proposed fix
 function getDefaultVideoProviderBaseUrl(providerId: Provider): string | null {
 	switch (providerId) {
 		case "openai":
 			return "https://api.openai.com";
 		case "google-vertex":
 			return "https://aiplatform.googleapis.com";
+		case "bytedance":
+			return "https://ark.ap-southeast.bytepluses.com/api/v3";
 		default:
 			return null;
 	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/worker/src/services/video-jobs.ts` around lines 135 - 143, The
getDefaultVideoProviderBaseUrl function is missing a case for providerId
"bytedance" causing default resolution to return null; update
getDefaultVideoProviderBaseUrl to add a case for "bytedance" that returns the
ByteDance endpoint "https://ark.ap-southeast.bytepluses.com/api/v3" so provider
context resolves when no env override is provided, keeping the existing cases
for "openai" and "google-vertex" unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/gateway/src/videos/videos.ts`:
- Around line 979-988: The switch in getDefaultVideoProviderBaseUrl is missing a
case for providerId === "bytedance"; add a case for "bytedance" that returns
"https://ark.ap-southeast.bytepluses.com/api/v3" so the provider context
resolution and downstream code can derive the correct default base URL when not
set via env vars.

In `@apps/worker/src/services/video-jobs.ts`:
- Around line 135-143: The getDefaultVideoProviderBaseUrl function is missing a
case for providerId "bytedance" causing default resolution to return null;
update getDefaultVideoProviderBaseUrl to add a case for "bytedance" that returns
the ByteDance endpoint "https://ark.ap-southeast.bytepluses.com/api/v3" so
provider context resolves when no env override is provided, keeping the existing
cases for "openai" and "google-vertex" unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1be1f812-3aab-4333-8c62-93dadaf8f6f3

📥 Commits

Reviewing files that changed from the base of the PR and between 3bc157a and be55f77.

📒 Files selected for processing (3)
  • apps/gateway/src/videos/videos.ts
  • apps/worker/src/services/video-jobs.ts
  • packages/models/src/models/bytedance.ts

- Use correct upstream model IDs (dreamina-seedance-2-0-260128,
  dreamina-seedance-2-0-fast-260128, seedance-1-5-pro-251215)
- Add per-second pricing for video models instead of flat request price
- Add base URL for ByteDance video provider in gateway and worker
- Handle different duration formats (string for Dreamina, int for 1.5)
- Send resolution parameter only for Dreamina models

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/models/src/models/bytedance.ts`:
- Line 143: The modelName fields for the Seedance entries are using unversioned
aliases (e.g. modelName: "seedance-2-0") which breaks ModelArk routing; find the
Seedance entries in the bytedance model definitions (the objects containing the
modelName property for Seedance at the three occurrences) and replace those
unversioned aliases with the exact upstream versioned model IDs used by ModelArk
(use the same versioned ID format as other providers in the file), updating all
occurrences (the ones corresponding to the diffs at the three locations) so they
are consistent and correctly route to the versioned upstream models.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 254dd232-fbcd-45dd-a398-c2a9d40e7fb9

📥 Commits

Reviewing files that changed from the base of the PR and between be55f77 and e7aca4f.

📒 Files selected for processing (3)
  • apps/gateway/src/videos/videos.ts
  • apps/worker/src/services/video-jobs.ts
  • packages/models/src/models/bytedance.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/gateway/src/videos/videos.ts
  • apps/worker/src/services/video-jobs.ts

Comment thread packages/models/src/models/bytedance.ts Outdated
analogpvt and others added 6 commits May 15, 2026 23:16
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove getBytedanceVideoUpstreamModelName() mapping function
and store the actual upstream API model names in the model
definitions directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@analogpvt
analogpvt force-pushed the feat/bytedance-seedance-video-models branch from ee4320b to ca622d8 Compare May 17, 2026 11:48
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