ai icon indicating copy to clipboard operation
ai copied to clipboard

Bug: @ai-sdk/bytedance generates wrong request body For First-and-Last Frame Video

Open jie-lyu opened this issue 7 months ago • 3 comments

Description

In https://github.com/vercel/ai/blob/main/packages/bytedance/src/bytedance-video-model.ts, role first_frame is not set for the first frame image in First-and-Last Frame Video mode, however, in byteplus document, ref 1 ref2, role: first_frame must be set.

This results in error message: The parameter content specified in the request is not valid: role must be specified for image contents

AI SDK Version

latest code

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

jie-lyu avatar Apr 13 '26 08:04 jie-lyu

Identify issue type

{
  "evidence": [
    "The Bytedance video model request body omits `role: first_frame` for the first frame image in First-and-Last Frame Video mode.",
    "The reporter cites BytePlus documentation requiring the role and reports an API error: `role must be specified for image contents`."
  ],
  "rationale": "The issue describes current SDK behavior generating an invalid request body that causes a provider error, contradicting provider requirements.",
  "type": "bug",
  "confidence": "high"
}

lgrammel avatar Jul 02 '26 08:07 lgrammel

Bug Reproduction

Bug could not be reproduced.

Created and ran node packages/bytedance/reproductions/issue-14378.mjs; the captured First-and-Last Frame Video request body included both role: 'first_frame' and role: 'last_frame'. Also ran focused Bytedance video test successfully.

Branch: bug-reproduction/14378-1

lgrammel avatar Jul 02 '26 13:07 lgrammel

fixed via https://github.com/vercel/ai/pull/15798

aayush-kapoor avatar Oct 01 '26 22:10 aayush-kapoor