You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ai-grok): add duration range options to grok video adapter
Replace the throwing `validateVideoDuration` with the standard duration-options
mechanism. Both grok-imagine video models declare a continuous 1–15 integer-
second range via a `GROK_VIDEO_DURATIONS` table, and the adapter overrides
`availableDurations()` / `snapDuration()` (backed by the shared
`snapToDurationOption` helper) so consumers can discover and pre-snap durations.
`createVideoJob` now snaps the requested duration into range (clamp + round)
instead of rejecting it, and the snapped value is spread after `...modelOptions`
so it is authoritative. Adds the per-model `GrokVideoModelDurationByName`
generic, narrows the `createVideoJob` signature to carry the size/duration type
params, exports the new helpers/type, and documents the range in the media docs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both models accept any whole second in the **1–15** range. A raw `duration` is coerced into that range rather than rejected — values are clamped to `[1, 15]` and rounded to the nearest second. Inspect or pre-snap the range the same way as Veo:
adapter.snapDuration(2.5) // 3 — clamped/rounded into range
607
+
adapter.snapDuration(99) // 15
608
+
```
609
+
600
610
Generated clips include an audio track. When the job completes, the adapter reports `usage.unitsBilled` (billed seconds of video) and `usage.cost` (exact USD cost as returned by the API) on the result.
0 commit comments