Run fal.ai Model (Synchronous)
fal_run_modelRun a fal.ai model synchronously and receive the result. Ideal for fast models like image generation, image editing, and short text or audio tasks.
Instructions
Run a fal.ai model and block until the result is ready. Best for fast models (a few seconds up to ~2 minutes) like most image generation, image editing, and short text/audio models.
This does NOT use the queue — there is no request_id to check later. For slow models (video generation, training jobs) or when you want to fire off a job and check back later, use fal_submit_request instead.
Args:
model_id (string): The fal.ai model id, e.g. "fal-ai/flux/dev"
arguments (object): Model-specific input, e.g. { "prompt": "a cat astronaut" }
response_format ('markdown' | 'json'): Output format (default: markdown)
Returns: The model's result payload (structure is model-specific — images/video/audio/text). For JSON format: the complete raw result object. For markdown format: a summary with any generated media URLs surfaced up top.
Examples:
Use when: "Generate an image of a sunset" -> model_id="fal-ai/flux/dev", arguments={"prompt": "a sunset over mountains"}
Use when: "Edit this image to add snow" -> model_id="fal-ai/flux-pro/kontext", arguments={"prompt": "add snow", "image_url": "https://..."}
Don't use when: the model is slow (video, training) — use fal_submit_request instead
Don't use when: you don't know the model's required fields — call fal_get_model_schema first
Error Handling:
Returns "Authentication failed" if FAL_KEY is missing or invalid
Returns "Invalid input (422)" if arguments don't match the model's schema — check fal_get_model_schema
Returns "Request timed out" if the model takes longer than 5 minutes — use fal_submit_request instead
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | Yes | The fal.ai model/endpoint id, e.g. "fal-ai/flux/dev", "fal-ai/flux-pro/kontext", or "fal-ai/minimax/video-01". Find valid ids with fal_list_models or at https://fal.ai/models. | |
| arguments | Yes | The model's input arguments as a JSON object, matching that model's own schema (e.g. { "prompt": "a cat astronaut", "image_size": "square_hd" }). Call fal_get_model_schema first if you're unsure what fields a model accepts. | |
| response_format | No | Output format: 'markdown' for human-readable or 'json' for machine-readable (default: markdown) | markdown |