Scenario
Use Mavera to generate a video script, feed it to OpenAI’s Sora to generate video, then loop results through Mavera’s Mave Agent for quality assessment — brand alignment, narrative coherence, visual impact — and iterate until quality thresholds are met. Flow: MaveraPOST /generations (script) → OpenAI Sora POST /images/generations → Mavera POST /mave/chat (analyze) → Iterate
Code
Example Output
Error Handling
Sora API availability
Sora API availability
Sora access may require a specific tier. If you get a 404 or model-not-found error, verify access at platform.openai.com/settings. Fall back to DALL-E 3 for static frames if unavailable.
Generation timeouts
Generation timeouts
Video generation can take 30-120 seconds. Set HTTP client timeout to at least 180 seconds. The OpenAI SDK handles this automatically, but raw
requests calls need timeout=180.Iteration loop safeguards
Iteration loop safeguards
The loop caps at 3 iterations to prevent runaway costs. Each iteration consumes Sora credits plus Mavera credits. If scores plateau, review the base script rather than continuing to refine.