WZRD Studio’s generation layer is a set of Supabase Edge Functions that sit behind a client-side Unified Generation Service. Every AI generation request — whether fired from the storyboard, a Studio node, or the editor — is normalized into aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/gratitude5dee/wzrd-studio-desktopfinal/llms.txt
Use this file to discover all available pages before exploring further.
GenerationInput object, routed to the correct edge function, and returned in a consistent GenerationResult envelope. This page documents the HTTP contracts for each generation endpoint and explains how the client-side routing layer dispatches to them.
All generation endpoints are deployed as Supabase Edge Functions. The base URL is your project’s
VITE_SUPABASE_URL environment variable. Every function lives at /functions/v1/<name>.Base URL: https://<your-project-ref>.supabase.co/functions/v1/Authentication
Every request must carry a valid Supabase JWT in theAuthorization header.
supabase.auth.getSession() in the client or by exchanging a Thirdweb wallet signature through /functions/v1/wallet-auth.
POST /functions/v1/gen-shots
Streams incremental shot generation updates for a storyboard scene over Server-Sent Events (SSE). The server uses Groq (Llama 3.3 70B) to generate cinematic shot descriptions, inserts shot rows into theshots table, and pushes each phase transition as a named SSE event.
This endpoint is gated by the
VITE_ENABLE_SHOT_STREAM feature flag (default: true). When the flag is false, clients must fall back to the Supabase CRUD flow for shot creation instead of calling this endpoint.Request
Body
Supabase project identifier. Must belong to the authenticated user.
Scene to generate shots for. Defaults to the first scene ordered by
scene_number when omitted.Array of previously created shot summaries used to assign the next sequential shot number server-side. Clients should send the current ordered list when present.
Number of shots to generate (1–6). Defaults to
3.Client-supplied idempotency key. A UUID is generated server-side when omitted.
Example
SSE Response Stream
The response isContent-Type: text/event-stream with Cache-Control: no-cache, no-transform and Connection: keep-alive. Events are emitted in FIFO order per connection. Clients should merge shot events by id rather than appending blindly.
meta — Stream Established
Emitted immediately after the SSE connection is open and the project/scene context is resolved.
The request ID (provided or server-generated).
Confirmed project UUID.
Resolved scene UUID.
Milliseconds elapsed until the first chunk was sent.
shot — Incremental Shot Update
Emitted multiple times per shot as it progresses through phases. Each event represents the latest known state for that shot.
Shot UUID (stable across phase updates).
Parent project UUID.
Parent scene UUID.
Sequential shot number within the scene.
Current generation phase:
creating → drafting → enriching → ready.Short title derived from the shot idea (available from
drafting phase).Narrative description / prompt idea text.
Full enriched visual prompt for image generation.
null during creating phase; set from drafting phase onward.Thumbnail URL (populated after image generation;
null in the stream itself).drafting
prompt_idea and shot_type written to the database. title and visual_prompt are now populated in the event payload.done — Stream Complete
Terminal event. No more shot events will follow.
Always
true on a clean completion.Number of shots that were streamed.
Echo of the request ID.
error — Stream Error
Emitted if the server encounters an error mid-stream. Abort the stream and surface the message to the user.
Human-readable error message.
Echo of the request ID.
Feature Flags
VITE_ENABLE_SHOT_STREAM
Default:
trueEnables the SSE streaming workflow. When false, bypass useShotStream entirely and revert to the Supabase shots CRUD flow.VITE_ENABLE_STREAM_TELEMETRY
Default:
trueEnables client-side logging of meta/latency metrics emitted by the stream. When disabled, telemetry hooks become no-ops — the core streaming UX continues to function.Credit Billing
Credits are reserved at request time and committed on completion. The formula isgetWorkflowCreditCost('gen-shots', insertedShots / 2). If the stream errors before any shots are inserted, the hold is released.
POST /functions/v1/project-auto-generate
Queues parallel generation for all shots in a project. This is the batch trigger that fires image and video generation for every shot at once rather than one at a time.Request
Body
UUID of the project whose shots should be generated.
Generation phase to run. Either
"images" or "videos".POST /functions/v1/compute-execute
Executes a saved Studio compute graph for a project. The function fetches allcompute_nodes and compute_edges for the project, performs a topological sort, and processes each level in parallel. Results are streamed back via SSE as nodes transition through running → succeeded / failed / skipped.
Request
Body
UUID of the project whose compute graph should be executed.
Optional subset of node IDs to execute. When omitted, all executable nodes in the graph run. The function automatically resolves upstream dependencies for any specified nodes.
Whether to use cached node outputs where available. Defaults to
true.Client-supplied idempotency key for credit deduplication.
SSE Events
Emitted first. Contains
run_id, project_id, and total_nodes.Emitted whenever a node changes state. Fields:
node_id, status (running | succeeded | failed | skipped), output (on success), error (on failure), processing_time_ms.Progress updates from long-running nodes. Fields:
node_id, progress (0–100), message, logs.Terminal event. Fields:
run_id, status, outputs (map of nodeId → result), completed_nodes, total_nodes, failed_nodes.Emitted on fatal execution errors. Fields:
run_id, error.POST /functions/v1/director-cut
Orchestrates Director’s Cut assembly — syncing timeline assets, performing preflight readiness checks, and launching the export render job. Supports four actions via theaction field.
Request
Body
One of
"sync", "create", "retry", or "status".Required for
sync, create, and retry actions.Required for the
status action.Optional export settings passed to the render pipeline.
Actions
action: sync — Sync Timeline Assets
action: sync — Sync Timeline Assets
Rebuilds the Response:
timeline_assets table for the project by walking scenes and shots in order. Returns a DirectorCutSummary without starting a render job.action: create — Start a New Export Job
action: create — Start a New Export Job
Syncs timeline assets, runs preflight checks, and creates a new Response (success):Response (preflight failure — HTTP 409):
export_jobs row if the project is ready. Returns a job ID immediately; the render runs asynchronously.action: retry — Retry a Failed Job
action: retry — Retry a Failed Job
Similar to
create but skips the sync step. Checks readiness on existing timeline data and creates a new job if the project can export.action: status — Poll Job Status
action: status — Poll Job Status
Returns the current state of a running or completed export job.Response:
GET /functions/v1/model-catalog
Returns the full catalog of AI models available in WZRD Studio, including credit costs, provider information, and media type classifications.Request
Response
An array of model objects:Canonical model ID used in generation requests (e.g.,
fal-ai/flux/schnell).Human-readable display name (e.g.,
FLUX Schnell).AI provider:
fal-ai, gmi-cloud, lovable-ai, etc.Credit cost per generation.
Output type:
image, video, audio, or text.Workflow classification: e.g.,
text-to-image, image-to-video, text-to-video, video-edit.Unified Generation Service
The client-side Unified Generation Service (src/services/unifiedGenerationService.ts) is the single entry point for all AI generation in WZRD Studio. It normalizes inputs, selects the correct edge function, handles queue polling, optionally stores outputs to Supabase Storage, and returns a consistent result.
GenerationInput Interface
GenerationResult Interface
Routing Logic
The service selects a backend route by inspecting the model ID:| Route | Trigger | Edge Function |
|---|---|---|
fal-stream | Default for all fal-ai/* models | /functions/v1/fal-stream |
gmi-cloud | model.provider === 'gmi-cloud' or modelId.startsWith('gmi/') | /functions/v1/gmi-execute |
gemini-text | google/gemini-* or openai/gpt-* text models | /functions/v1/gemini-text-generation |
groq-text | groq/* or llama-* models | /functions/v1/groq-chat |
elevenlabs-tts | elevenlabs-tts model ID | /functions/v1/elevenlabs-tts |
elevenlabs-sfx | elevenlabs-sfx model ID | /functions/v1/elevenlabs-sfx |
elevenlabs-music | elevenlabs-music model ID | /functions/v1/elevenlabs-music |
edge-function | parameters._edgeFunction is set | Named edge function |
Usage Examples
Error Types
| Error Code | Description |
|---|---|
insufficient_credits | Not enough credits for the requested model |
stream_error | HTTP error from fal-stream |
no_body | No response body from provider |
no_result | Stream completed without a result |
provider_error | Provider returned an error event |
text_error | Text generation failed |
groq_error | Groq API error |
audio_error | Audio generation failed |
edge_function_error | Edge function invocation failed |
gmi_error | GMI Cloud error |
gmi_timeout | GMI generation timed out |
unknown_route | Unrecognized generation route |