API Endpoints
All endpoints follow OpenAI-compatible conventions
Generate images or videos. For video models (RunwayML, Leonardo, Weavy video models),
the response uses the same format but the url fields point to video files.
This endpoint handles all image and video generation requests.
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | required | Model identifier (e.g. dall-e-3, weavy-kling, leo-sora-2) |
| prompt | string | required | Text description of the image or video to generate |
| n | integer | optional | Number of images to generate. Default: 1. Max: 4 (provider-dependent) |
| size | string | optional | Output dimensions or aspect ratio. Format varies by provider — see per-provider details below |
| quality | string | optional | Quality preset. Values: standard | hd (DALL-E 3), low | medium | high | auto (GPT Image) |
| negative_prompt | string | optional | Elements to exclude from the output (supported by most non-OpenAI providers) |
| image_url | string | optional | Reference image URL or base64 data URI. Used for img2img conditioning or as video start frame |
| end_image_url | string | optional | End/last-frame image URL. For first-last-frame video models (Kling, Veo). Interpolates between image_url and end_image_url |
| duration | integer | optional | Video duration in seconds. Valid values are model-specific (e.g. 5/8/10 for Runway, 3–15 for Kling) |
| resolution | string | optional | Video resolution: 480p | 720p | 1080p (Weavy video models) |
| aspect_ratio | string | optional | Explicit aspect ratio string (e.g. 16:9). Some providers accept this instead of size |
Returns full metadata for a single model including all supported parameters and their constraints.
Lists all available models in OpenAI-compatible format.
Authentication
Bearer token authentication, provider-dependent credential handling
Request Format
JSON body with OpenAI-compatible fields plus extended provider params
Response Format
OpenAI-compatible response for both images and videos
n parameter (usually 1)
OpenAI
DALL-E 3, DALL-E 2, GPT Image 1 — native OpenAI image generation
size accepts OpenAI pixel strings: 1024x1024, 1792x1024, 1024x1792, 512x512, 256x256
Gemini (Google)
Imagen 3, Gemini Flash image generation
xAI Grok
Aurora image generation model by xAI
Stability AI
Stable Diffusion 3.5, SDXL, SD Ultra — industry-standard open diffusion models
size accepts aspect ratio strings: 1:1, 16:9, 9:16, 4:3, 3:2, etc.
Black Forest Labs (FLUX)
FLUX Pro, FLUX Dev, FLUX Schnell — state-of-the-art text-to-image
OpenRouter
Access multiple model providers through OpenRouter
fal.ai
Fast inference platform — FLUX, Ideogram, Recraft, and more
Cloudflare AI
Edge-deployed AI workers — fast, low-latency generation
MiniMax
MiniMax Image 01 — high-quality image generation
NanoBanana
Proprietary fast generation models
SD WebUI
Local Stable Diffusion WebUI (AUTOMATIC1111) integration
ComfyUI
Local ComfyUI workflow integration
HuggingFace
HuggingFace Inference API models
Recraft
Recraft V3 — design-focused vector and illustration generation
RunwayML
Gen-4 Turbo, Gen-3 Alpha — professional AI video generation
_image suffix route to image endpoints. Video models: duration options 5, 8, 10 seconds.
Leonardo AI
24 image models + 30 video models via Leonardo's GraphQL API
Image Generation (v1/v2)
v1 path: Phoenix, Flux Dev, Lucid Origin — uses modelId UUID + contrast. v2 path: Seedream, GPT Image, Flux Pro, native models — no modelId UUID required.
Video Generation
Kling, Veo, Sora, Hailuo, Seedance, LTX and more — routed via Leonardo's GraphQL Generate mutation. Adapter currently forwards: prompt, n, size, negative_prompt.
prompt, n, size, and negative_prompt only. Additional video params (duration, image_url, etc.) are listed for future support.
Weavy
34 image models + 41 video models via Weavy's recipe execution API
How Weavy Works
Weavy executes AI workflows via a recipe/flow system. 9Router duplicates a template recipe, configures parameters, then polls for completion via a Python subprocess (weavy_generate.py).
Image Architecture
Image models use two paths: Predefined nodes (Flux Pro, Imagen 3, Gemini Nano) with native Weavy nodes, and Wildcard nodes (all FAL-ai based models) injected dynamically. The size ratio string is auto-converted to params.aspect_ratio internally.
Video Architecture
Video models use two routing paths: Predefined nodes (Runway, Kling, Seedance, Wan, Veo, LTX, Higgsfield) with direct duration mapping, and Wildcard nodes (all others) routing through fal.ai endpoints.
size parameter is always an aspect ratio string — NOT pixel dimensions. Valid values: 1:1 · 9:16 (portrait) · 16:9 (landscape) · 3:4 · 4:3. Backend auto-converts to the correct format per model (image_size, aspect_ratio, or pixel dimensions).
image_url is NOT supported.First-last-frame models (Kling O1/2.5/2.1): use
image_url for first frame and end_image_url for last frame.Predefined duration models: service maps your value to nearest valid option.
Model Info API
Query full parameter schema for any model programmatically
Error Reference
Standard error response format
| HTTP Status | Error Type | Description |
|---|---|---|
| 400 | invalid_request_error | Missing required parameters, invalid model ID, or unsupported parameter value |
| 401 | authentication_error | Invalid or missing API key / Bearer token |
| 403 | permission_error | Account does not have access to this model or provider |
| 404 | not_found | Model not found in registry |
| 429 | rate_limit_error | Provider rate limit or quota exceeded |
| 500 | server_error | Internal server error or upstream provider failure |
| 504 | timeout | Generation timed out. Video generation can take up to 10 minutes |
Code Examples
Ready-to-use code snippets