OpenCode Lets Developers Generate MP4 Videos Inside Coding Agent Sessions
The open source coding agent adds an experimental video generation tool, letting you call Grok Imagine and Gemini Omni directly from your coding workflow.
Takeaways
- OpenCode adds an experimental video generation tool that any provider with video models can use.
- OpenCode Console users get Grok Imagine and Gemini Omni access by default, with Seedance and Kling landing in follow-up PRs.
- Pricing matches xAI direct: $0.08 to $0.25 per second depending on resolution, plus $0.01 per input image.
- Tool submits an async job, returns immediately, then copies finished MP4s into the workspace.
- Gated behind a
video_generatefeature flag covering both the HTTP API and the tool. - Best for short social clips, demo assets, and prototyping; not for physically accurate or long-form video.
OpenCode, an open source coding agent that edits files and runs tools inside a project workspace, has added experimental video generation. When a configured provider exposes a supported model, the agent can submit a prompt during a chat and save the completed MP4 alongside the project’s code and assets.
Developers using OpenCode Console receive managed access to xAI’s Grok Imagine and Google’s Gemini Omni. The OpenCode team demonstrated the feature with a generated clip in its rollout post.
From prompt to MP4
The merged pull request introduces an experimental_video_generate tool alongside OpenCode’s image generator. It submits a job to the server-side video service and returns control without waiting for the render. After the provider finishes, the service copies the resulting video into the workspace.
- Model selection: A default can be set explicitly with
{ "model": "xai/grok-imagine-video" }. If that model is unavailable, OpenCode selects the newest video model from the chat’s provider, followed by the newest available model across configured providers. - Feature gating: The
video_generateflag controls access through both the HTTP API and the agent tool. - Job tracking: The tool stores only OpenCode’s video ID. Provider-specific job IDs remain behind the server’s video service.
- Provider coverage: Companion changes add Seedance support through Volcengine and BytePlus, plus integrations for Gemini Omni and Kling.
Seconds set the bill
OpenCode’s Zen routing layer follows xAI’s published pricing. The catalog update lists these per-second rates:
| Variant | 480p | 720p | 1080p |
|---|---|---|---|
grok-imagine-video-1.5 |
$0.08/sec | $0.14/sec | $0.25/sec |
| Lite | $0.02/sec | $0.03/sec | $0.14/sec |
At those rates, a 10-second 720p clip costs about $1.40 with the full model or $0.30 with the Lite variant. The catalog also lists a $0.01 charge per input image. Each unsuccessful render or revised generation creates another billable job, so automated workflows need retry and spending limits.
Where each model fits
Grok Imagine accepts text, still images, or existing footage and can generate short clips with audio. Its core duration range is 6 to 10 seconds. Some provider wrappers expose durations from 6 to 30 seconds at 480p or 720p, with controls for 16:9, 9:16, 1:1, 2:3, and 3:2 aspect ratios. Applications should read the selected provider’s model metadata instead of hard-coding those limits.
Gemini Omni emphasizes conversational generation and editing across text, images, audio, and video. Successive prompts can revise earlier output while attempting to preserve characters, motion, and scene continuity. That interaction maps cleanly to an agent session in which each instruction builds on the files and conversation already in the workspace.
Why the agent owns the plumbing
Video APIs create orchestration work that coding agents already perform for other tools: submitting asynchronous jobs, tracking status, handling failures, saving binary files, and connecting those files to the surrounding project. OpenCode packages those steps behind one tool call, allowing the agent to generate an asset and then reference it from source code, documentation, or configuration in the same session.
Workflows that benefit
- Frontend prototypes: Generate placeholder or preview clips while scaffolding the interface that displays them.
- Marketing and documentation: Create a short hero or tutorial video and place it beside the page code that embeds it.
- Automated demos: Write and run an application, then produce a companion clip within the same scripted workflow.
- Games and animation: Generate an MP4 and wire it directly into a scene, asset manifest, or build pipeline.
Limits before production
Because the feature remains experimental, production automation must account for unstable interfaces, provider-specific limits, and potentially expensive retries. The shipped implementation handles submission and file delivery, but it does not describe an automated evaluator that checks whether a render follows its prompt.
- Set generation budgets, duration caps, and retry limits before enabling unattended jobs.
- Validate file type, dimensions, duration, and playback before adding an output to a build.
- Review continuity and physical accuracy when generated footage supports technical claims, simulations, or product demonstrations.
- Apply the selected provider’s licensing, safety, retention, and content policies before publishing an asset.
The new tool lets one OpenCode session produce source files, run the project, and generate the video assets it consumes. Its practical value comes from keeping prompts, job orchestration, output files, and follow-up edits inside the same workspace.