Bug: @ai-sdk/bytedance generates wrong request body For First-and-Last Frame Video
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
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"
}
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
fixed via https://github.com/vercel/ai/pull/15798