Most developers using video generation in Codex pick a model manually for each task. For one-off jobs, that's fine. But when video generation becomes part of a workflow — where the agent handles different task types at different frequencies — choosing a model by hand is a decision cost you can engineer away.
The better approach: give Codex decision logic, and let the agent choose the right video model based on task signals automatically.
This guide focuses on how to design agent workflows that trigger Veo 3.1 — what task characteristics should cause the agent to select it, when it shouldn't, and how to structure the full automation sequence from direction-finding to final delivery.
If you haven't connected video generation to Codex yet, start with How to Generate Video with Codex.

The 4 signals that should trigger Veo 3.1
For the agent to reliably select Veo 3.1, it needs to recognize four task characteristics. Each of these signals should be expressible from the task description or system prompt:
Signal 1: The output is going to an external audience
Product page hero video. Launch announcement. Press asset. The output goes directly into a publishing workflow without additional polish. Quality tolerance is lowest here — Veo 3.1's single-pass quality ceiling earns its place.
Signal 2: The prompt is confirmed and specific
A visual concept already approved by the client. Specific brand guidelines. A creative direction that's been iterated to locked. The task description is precise and prompt fidelity matters — Veo 3.1 executes on detailed prompts more reliably than most models.
Signal 3: The clip is 8 seconds or under
Veo 3.1 generates up to 8 seconds. Anything longer, and the agent should automatically switch to Kling 3 (up to 15 seconds). This is a clean rule that can be evaluated entirely in code.
Signal 4: Quality beats speed for this task
The goal is the best single-pass quality, not fast iteration or high-volume batch output.
Designing the decision logic: model selection rules for Codex
Translate the four signals into rules Codex can execute. The simplest implementation: include model selection criteria in the system prompt or task instructions:
Video model selection rules (agent evaluates from task context):
- External delivery + confirmed prompt + ≤ 8 seconds → veo-3.1
- Direction testing / fast iteration / internal preview → veo-3.1-fast
- > 8 seconds OR motion realism is the primary need → kling-3
- Repeatable high-volume batch production → seedance-2
With this in place, the agent reads the task description and selects the model without manual intervention:
# Agent selects veo-3.1 based on task signals
anycap video generate \
--prompt "product launch announcement: dark UI interface with glowing accent elements, smooth reveal of the core feature, premium aesthetic, cinematic lighting" \
--model veo-3.1 \
-o announcement.mp4
The three-stage automation sequence: direction to delivery
This is the agent sequence that covers the full video production cycle. Three stages, three model selections, each with a distinct trigger:

Stage 1: Direction finding (Gemini Omni Flash)
When the task is exploratory, use Gemini Omni Flash for multi-turn conversational iteration — without spending Veo 3.1 generation time on a direction that isn't confirmed yet:
# Direction not confirmed → iterate with Gemini Omni Flash
anycap video generate \
--prompt "product hero video, exploring style direction" \
--model gemini-omni-flash \
-o explore.mp4
Stage 2: Direction preview (Veo 3.1 Fast)
Once the direction is confirmed, verify the output quality with Veo 3.1 Fast before committing to the full-quality pass:
# Direction confirmed → preview with Veo 3.1 Fast
anycap video generate \
--prompt "product reveal with dark ambient lighting, smooth camera movement, premium aesthetic" \
--model veo-3.1-fast \
-o preview.mp4
Stage 3: Final delivery (Veo 3.1)
When the task is ready to deliver, the agent triggers Veo 3.1 for the final pass:
# Ready to deliver → commit to Veo 3.1
anycap video generate \
--prompt "product reveal with dark ambient lighting, smooth camera movement, premium aesthetic" \
--model veo-3.1 \
-o final.mp4
The design principle across all three stages: Veo 3.1's generation time is spent only on confirmed directions — not on searching for the right one.
Image-to-video: the automated path
When the task requires animating a static asset, the agent runs a two-step sequence. The first step can be parallelized or conditionally skipped if a reference image already exists:

# Step 1: generate the keyframe
anycap image generate \
--prompt "premium SaaS product hero, dark interface, floating UI elements, cinematic lighting" \
--model seedream-5 \
-o keyframe.jpg
# Step 2: trigger Veo 3.1 image-to-video
anycap video generate \
--prompt "slow cinematic push-in, subtle parallax, interface elements breathe gently, premium feel" \
--model veo-3.1 \
--mode image-to-video \
--param images=./keyframe.jpg \
-o hero-animated.mp4
Exclusion rules: when not to trigger Veo 3.1
Good decision logic needs explicit exclusion conditions too:
| Situation | Correct model | Reason |
|---|---|---|
| Creative direction still being explored | Gemini Omni Flash | Conversational iteration — don't spend Veo 3.1 time on direction-finding |
| Clip longer than 8 seconds | Kling 3 | Veo 3.1 hard limit, auto-switch on length |
| High-volume repeatable batch content | Seedance 2 | Consistency over peak quality |
| Internal preview or draft review | Veo 3.1 Fast | Same model family, speed first |
Agent stage-to-model mapping
This mapping can be written directly into Codex's task processing logic:
| Task state | Model | Notes |
|---|---|---|
| Exploring | gemini-omni-flash |
Multi-turn conversational direction-finding |
| Direction confirmed | veo-3.1-fast |
Preview with same model family before committing |
| Ready to deliver | veo-3.1 |
Final single-pass quality output |
| Long-form (>8s) | kling-3 |
Beyond Veo 3.1 length limit |
| Batch production | seedance-2 |
High-volume consistency |
FAQ
How does the agent know when a direction is "confirmed"? The simplest approach is a status signal in the task description (e.g., status: confirmed) or a required human confirmation step that must complete before the Veo 3.1 call fires.
Does using Veo 3.1 through AnyCap require a separate Google account? No. AnyCap manages all video model API keys centrally. Codex only needs one AnyCap API key to access Veo 3.1 alongside every other model in the catalog.
Both Gemini Omni Flash and Veo 3.1 Fast are fast — what's the difference? Gemini Omni Flash supports multi-turn conversation: the model carries context forward and edits from the previous output. Veo 3.1 Fast is single-pass: each call starts fresh from the new prompt with no session memory. Use Gemini Omni Flash for direction-finding; use Veo 3.1 Fast for previewing a confirmed direction before the final Veo 3.1 commit.
What's next
- Gemini Omni Flash in Codex: Conversational Video Editing — full workflow guide for the direction-finding stage
- Gemini Omni Flash vs Veo 3.1 in Codex: Which Model When — side-by-side comparison
- AI Powered Video Editor for Coding Agents — the broader conversational editing landscape
The bottom line
The key to letting Codex automatically choose its video model is designing explicit decision rules — not relying on manual specification for each task. Four signals — external delivery, confirmed prompt, ≤ 8 seconds, quality over speed — translate directly into agent-executable logic.
In a Codex workflow powered by AnyCap, this decision layer means Veo 3.1's generation time is spent only where it belongs: on tasks where the direction is locked and the quality bar is highest.
→ Add Veo 3.1 to Codex — install AnyCap, free to start