Repository navigation
feat: add ByteDance Seedance video generation models (seedance-2.0, seedance-2.0-fast, seedance-1.5-pro) - #2270
Conversation
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
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds ByteDance video generation support: three new models, gateway upstream model mapping/aspect handling and ByteDance job-creation, plus worker polling and response normalization. ChangesByteDance Video Provider Integration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 winAdd missing ByteDance base URL case.
The
getDefaultVideoProviderBaseUrlfunction doesn't handleproviderId === "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 ishttps://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 winAdd missing ByteDance base URL case.
The
getDefaultVideoProviderBaseUrlfunction doesn't handleproviderId === "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 endpointhttps://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
📒 Files selected for processing (3)
apps/gateway/src/videos/videos.tsapps/worker/src/services/video-jobs.tspackages/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>
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
apps/gateway/src/videos/videos.tsapps/worker/src/services/video-jobs.tspackages/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
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>
ee4320b to
ca622d8
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Adds official ByteDance provider support for three Seedance video generation models via the ModelArk API.
Models Added
Changes
packages/models — Model definitions
apps/gateway — Video creation
apps/worker — Status polling
API Details
Summary by CodeRabbit