From e2465b9326abebffbbb284e4a3652279f7918af5 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Sat, 18 Apr 2026 20:04:51 +1200 Subject: [PATCH] fix: map Seedance 2.0 model IDs to API-expected format The Kie API expects "bytedance/seedance-2" as the model value, but we were sending our internal ID "bytedance/seedance-2/text-to-video" which includes the capability suffix. Strip the suffix for Seedance models before sending to the API. Co-Authored-By: Claude Opus 4.6 --- src/app/api/generate/providers/kie.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/api/generate/providers/kie.ts b/src/app/api/generate/providers/kie.ts index 9dfc5765..78f5907d 100644 --- a/src/app/api/generate/providers/kie.ts +++ b/src/app/api/generate/providers/kie.ts @@ -444,6 +444,14 @@ export async function pollKieTaskCompletion( } +// Map internal model IDs to the API model value expected by Kie +// Seedance models use a base ID without the capability suffix +function getKieApiModelId(modelId: string): string { + if (modelId.startsWith("bytedance/seedance-2/")) return "bytedance/seedance-2"; + if (modelId.startsWith("bytedance/seedance-2-fast/")) return "bytedance/seedance-2-fast"; + return modelId; +} + export function isVeoModel(modelId: string): boolean { return modelId.startsWith("veo3/") || modelId.startsWith("veo3-fast/"); } @@ -735,8 +743,11 @@ export async function generateWithKie( } // All remaining Kie models use the standard createTask endpoint + // Strip capability suffixes from model IDs that use them internally + // e.g. "bytedance/seedance-2/text-to-video" → "bytedance/seedance-2" + const apiModelId = getKieApiModelId(modelId); const requestBody: Record = { - model: modelId, + model: apiModelId, input: inputParams, };