Create and manage AI videos and images using the Miraflow API. Use when a user asks to: generate an avatar video with a script, create a cinematic or AI video, generate or edit an AI image, list available avatars or voices, check video generation status, download a completed video, or upload media for use in Miraflow. Requires MIRAFLOW_API_KEY env var.
Miraflow is an AI video/image platform. The API is async — creation endpoints return a jobId, then you poll for completion.
Base URL:https://miraflow.ai/api Auth: always include -H "x-api-key: $MIRAFLOW_API_KEY" on every call. Never hardcode the key.
Full API reference: See references/api.md for endpoint details, request/response schemas, and the media upload workflow.
Rules
- Never hardcode the API key. Always read from $MIRAFLOW_API_KEY.
Always use x-api-key as the header name, not Authorization.
After creating a video, always clearly state the jobId — the user needs it to check status.
Do not auto-download a video without the user asking.
Do not poll status in a loop. Check once, report the status, and tell the user to ask again if not ready.
If an API call returns an error, show the status code and error message clearly.
NEVER retry POST /api/video/create or POST /api/image/generate. These are expensive, non-idempotent operations. Call each creation endpoint exactly once per user request, even if the response is slow or unclear. If the call succeeds (any 2xx), stop — do not call again.
Always confirm before creating. Before calling any creation endpoint, summarize what will be created (avatar, voice, name, script) and wait for the user to confirm. Only proceed after explicit confirmation.
Core Workflows
List Avatars
GET /api/avatars
Present as a numbered list with avatar name and ID.
List Voices
GET /api/voices
Present as a numbered list with voice name and ID.
Create an Avatar Video (voice + script)
1. If no avatarId given, list avatars and ask the user to pick one.
If no voiceId given, list voices and ask the user to pick one.
Ask for a video name if not provided.
Before creating: Confirm with the user — show avatar name, voice name, video name, and script. Wait for explicit approval.