vercel/ai · error

Video model ${model.modelId} supports at most ${knownMaxVide

Error message

Video model ${model.modelId} supports at most ${knownMaxVideosPerCall} video(s) per call, but ${n} were requested. Split the batch across multiple startVideo calls.

What it means

Each video model has a known per-call maximum (maxVideosPerCall, static or function). startVideo refuses to silently exceed it (a start yields one operation covering all n videos, no splitting), so requesting more than the maximum throws with the model's limit and the requested count.

Source

Thrown at packages/ai/src/generate-video/start-video.ts:155

        'Use generateVideo for models without an asynchronous start/status flow.',
    );
  }

  if (!Number.isInteger(n) || n < 1) {
    throw new Error(
      `Invalid n: expected a positive integer, received ${JSON.stringify(n)}.`,
    );
  }

  // A start yields one operation covering all n videos: refuse to silently
  // exceed a known per-call limit instead of splitting into several starts.
  const knownMaxVideosPerCall =
    maxVideosPerCall ??
    (typeof model.maxVideosPerCall === 'function'
      ? await model.maxVideosPerCall({ modelId: model.modelId })
      : model.maxVideosPerCall);
  if (knownMaxVideosPerCall != null && n > knownMaxVideosPerCall) {
    throw new Error(
      `Video model ${model.modelId} supports at most ${knownMaxVideosPerCall} video(s) per call, ` +
        `but ${n} were requested. Split the batch across multiple startVideo calls.`,
    );
  }

  const {
    prompt,
    resolvedImage,
    normalizedFrameImages,
    effectiveInputReferences,
    warnings,
  } = normalizeVideoCallInputs({ promptArg, frameImages, inputReferences });

  const { retry } = prepareRetries({
    maxRetries: maxRetriesArg,
    abortSignal,
  });

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Split the batch into multiple startVideo calls, each within the model's limit.
  2. Choose a model with a higher maxVideosPerCall if the provider offers one.
  3. Read the thrown message's limit and cap your UI's batch size to it.
  4. Check maxVideosPerCall on the model before calling to size the batches.

Example fix

// before
await experimental_startVideo({ model, prompt, n: 10 }); // model max is 4
// after
const max = 4;
for (let i = 0; i < 10; i += max) {
  await experimental_startVideo({ model, prompt, n: Math.min(max, 10 - i) });
}
Defensive patterns

Strategy: validation

Validate before calling

const max = model.maxVideosPerCall ?? undefined;
if (max != null && n > max) {
  // chunk n into batches of max before calling startVideo
}

Type guard

null

Try / catch

try {
  await experimental_startVideo({ model, prompt, n });
} catch (e) {
  if (e.message.includes('per call')) {
    // parse limit from message or read maxVideosPerCall, then split the batch
  }
}

Prevention

When it happens

Trigger: experimental_startVideo called with n greater than the model's maxVideosPerCall (explicit option, model property, or result of maxVideosPerCall({modelId})).

Common situations: Batch generating more videos than the provider allows per request (e.g. asking for 10 when the model caps at 4); using a batch size tuned for one model with another stricter model.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/eb5fd6d0933e1a66. Report an issue: GitHub.