model_run
GenerationRun Model
Run any Scenario model to generate, edit, upscale, segment, post-process, or transform any asset type.
First call model_schema_get for the selected model's exact parameter contract. For fields marked prompt_spark=true, optionally use prompt_spark to rewrite short or underspecified prompts into model-tuned prompts and parameters. It rewrites rather than lightly edits: pass an exact prompt you or the user already wrote directly.
File parameters require Scenario asset_ids, not local paths; use upload_asset first if needed. Names do not determine cardinality: trust model_schema_get, where array: true means an array even for one asset.
Use search with query="tool" to discover utility models.
Args:
- model_id: required model id to run
- parameters: JSON model payload; defaults to {}, which most models reject. Virtually every model requires a prompt or image input; get exact fields from model_schema_get. prompt_spark can draft on-model prompts and parameters
- wait: optional — true waits for completion, streaming progress notifications with the job's real percentage when reported by the model; false returns immediately with a job_id
- dry_run: optional — true estimates cost
- team_id, project_id: required for OAuth callers
Returns: model_id, job_id, status (in that order), plus output assets (id, app_url) if completed in time. Unfinished jobs return no outputs; the message specifies the jobs_wait call to make. With dry_run=true, returns the cost estimate without creating a job.
Examples:
- "Generate an image" -> model_schema_get, then model_id="model_xxx", parameters={"prompt": "cinematic portrait"} (optionally prompt_spark first to rewrite a thin prompt)
- "Edit using an uploaded reference" -> model_id="model_xxx", parameters={"prompt": "...", "image": "asset_xxx"}
- "Kick off a long job and return immediately" -> wait=false
- "How much would this cost?" -> dry_run=true
Don't use before inspecting the model schema or with only a local file path.
open-world
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model_id | string | ✓ | Model ID to run (e.g. 'model_google-gemini-3-1-flash'). Call model_schema_get first to discover accepted parameters and whether prompt_spark can help draft the prompt. |
| parameters | record | [object Object] | Model parameters as a JSON object. Use model_schema_get to discover exact fields; a prompt field with prompt_spark=true supports prompt_spark for rewriting a thin prompt into an on-model one — pass a detailed prompt directly when the user wants it used verbatim. Common fields: prompt, image, aspectRatio, numImages, seed. |
| wait | boolean | true | Wait up to 180s for completion (default true), streaming progress notifications while waiting; if unfinished, status is 'in_progress'. With false, status is live at job creation (typically 'queued', 'in-progress' or 'warming-up'). Neither returns outputs; call jobs_wait with the returned job_id in job_ids. |
| dry_run | boolean | — | Estimate cost without running. Sends ?dryRun=true so the API returns the cost estimate without executing or charging credits. |
| team_id | string | — | Team ID. Required with project_id for OAuth callers; an API key is scoped by the key. |
| project_id | string | — | Project ID. Required with team_id for OAuth callers; an API key is scoped by the key. |
| response_format | enum(json | markdown) | json | Output format: 'json' for structured data, 'markdown' for human-readable text. |
Example Request
JSON
{
"model_id": "model_google-gemini-3-1-flash",
"parameters": {
"prompt": "a majestic dragon perched on a mountain at sunset",
"aspectRatio": "16:9",
"numImages": 1,
"seed": 42
},
"wait": true,
"team_id": "team_abc123",
"project_id": "proj_xyz789"
}Example Response
JSON
{
"model_id": "model_google-gemini-3-1-flash",
"job_id": "job_1a2b3c4d",
"status": "success",
"assets": [
{
"id": "asset_img001",
"app_url": "https://app.scenario.com/assets/asset_img001"
}
],
"message": "Completed. Call asset_display with an asset_id to show the result to the user."
}Common Use Cases
- Generate concept art from a text prompt using a community or fine-tuned model
- Run image-to-image transformations by passing an input image URL in parameters
- Produce multiple variations by setting numImages > 1 with a fixed seed
- Trigger long-running video or 3D generation jobs asynchronously with wait: false