Image & video generation API

One async API for image and video generation.

Submit a task, poll for it, download the result. The endpoint and the envelope never change — switching models means changing parameters, not code paths.

~0.9 s
submit returns a task id
4K
max image resolution
15 s
video clips, up to 1080p
24 h
output URLs stay live

Three steps. Every model.

The flow is identical whether you generate a still image or a fifteen‑second clip, and regardless of which model you pick.

  1. 01

    Submit

    POST the model id and an input object to /v1/task/submit. The call returns in about a second with a task id while generation continues in the background.

  2. 02

    Poll

    GET /v1/task/{id} with a 2–3 s back‑off until status reaches completed or failed. Or hand us a callback_url and skip the loop entirely.

  3. 03

    Download

    Read outputs[] for direct URLs — JPEG or PNG for images, MP4 for video. Links need no auth and stay live for 24 hours after completion.

Built around parameter differences, not endpoint differences.

Most gateways make you learn a new endpoint, request body and response shape per provider. WideRouter keeps all three fixed.

One envelope

Endpoint, headers, status machine and error table are shared. What changes between models is the set of fields inside input.

Images and video, same API

A 4K still from Nano Banana Pro and a 1080p clip from Grok Imagine come back through the same task object.

Official model ids

Model ids match the provider’s names exactly. No invented aliases, no -preview suffixes to guess at.

Callbacks and a live playground

Pass callback_url to be notified on completion. Try every model from the docs playground with a real key before writing code.

Models

Two families today. Each card links to a comparison matrix with parameters, resolution tiers and measured latency.

Nano Banana

Google image models
Parameter matrix

Up to 14 reference images per request, n from 1 to 4, resolution tiers from 512 px to 4K.

  • Nano Banana Pro gemini-3-pro-image
    1K · 2K · 4K ~29 s at 1K
  • Nano Banana 2 gemini-3.1-flash-image
    512 px – 4K · thinking ~15 s at 1K
  • Nano Banana 2 Lite gemini-3.1-flash-lite-image
    single size ~6.6 s
  • Nano Banana gemini-2.5-flash-image
    single size · PNG 6.6 – 10 s

Grok Imagine

xAI image and video models
Parameter matrix

Images at 1k or 2k with up to 3 references. Video from 1 to 15 seconds, 480p to 1080p, with edit and extend modes.

  • Image 2.0 grok-imagine-image-2.0
    1k · 2k · quality tiers image
  • Image Quality grok-imagine-image-quality
    portrait default image
  • Image grok-imagine-image
    1k · 2k image
  • Video 1.5 grok-imagine-video-1.5
    480p · 720p · 1080p · voices video
  • Video grok-imagine-video
    video input · edit · extend video

Official list prices. The discount lives in the group multiplier.

WideRouter’s list price matches the provider’s published price exactly. Your charge is list price × group multiplier — 0.8 for the Grok‑Official group.

list price × group multiplier = charge
$0.02 per image grok-imagine-image, 1k or 2k
$0.08 per second, from grok-imagine-video-1.5 at 480p
0.8× multiplier Grok‑Official group

Reference images and additional outputs are billed per item. Full tables, including Nano Banana, are in the docs. See pricing in the docs

Your first task in two calls.

Export your key, submit, poll. The same two calls work for every model on the platform.

Full quickstart ↗
# 1. submit
curl https://api.widerouter.com/v1/task/submit \
  -H "Authorization: Bearer $WIDEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image",
    "input": { "prompt": "a lighthouse at dusk" }
  }'

# 2. poll until status is completed or failed
curl https://api.widerouter.com/v1/task/task_koYlX7Gm6lEn5jfPS54TcDZcN7OvZA8M \
  -H "Authorization: Bearer $WIDEROUTER_API_KEY"
import os, time, requests

BASE = "https://api.widerouter.com"
HEADERS = {"Authorization": f"Bearer {os.environ['WIDEROUTER_API_KEY']}"}

# 1. submit
task = requests.post(f"{BASE}/v1/task/submit", headers=HEADERS, timeout=30, json={
    "model": "gemini-3.1-flash-image",
    "input": {"prompt": "a lighthouse at dusk"},
}).json()

# 2. poll with a 3 s back-off
while task["status"] not in ("completed", "failed"):
    time.sleep(3)
    task = requests.get(f"{BASE}/v1/task/{task['id']}", headers=HEADERS, timeout=30).json()

print(task["outputs"])

Ship the same integration for every model.

Create a key in the console, then follow the five‑minute quickstart.

图片与视频生成 API

一套异步 API 覆盖图片与视频生成。

提交任务、轮询任务、下载结果。端点和外层信封固定不变,换模型只改参数,不改代码路径。

~0.9 s
提交即返回任务 ID
4K
图片最高分辨率
15 s
视频时长,最高 1080p
24 h
产物链接有效期

三步走完,所有模型通用。

无论生成一张静态图还是一段十五秒的视频,无论选哪个模型,流程都是同一个。

  1. 01

    提交

    把模型 ID 和 input 对象 POST 到 /v1/task/submit。约一秒返回任务 ID,生成在后台继续进行。

  2. 02

    轮询

    以 2–3 秒退避 GET /v1/task/{id},直到 status 变为 completed 或 failed。也可以传 callback_url,完全省掉轮询。

  3. 03

    下载

    从 outputs[] 读取直链:图片为 JPEG 或 PNG,视频为 MP4。链接无需鉴权,完成后 24 小时内有效。

围绕参数差异设计,而不是端点差异。

多数中转平台要求你为每家供应商学一套端点、一套请求体、一套响应结构。WideRouter 把这三样都固定下来。

统一信封

端点、请求头、状态机和错误表全部共用。模型之间变的只是 input 里那组字段。

图片与视频同一套 API

Nano Banana Pro 的 4K 静态图和 Grok Imagine 的 1080p 视频,通过同一个任务对象返回。

模型 ID 对齐官方

模型 ID 与供应商官方名称完全一致。不自造别名,也不用猜 -preview 后缀。

回调与在线 Playground

传 callback_url 即可在完成时收到通知。写代码前先在文档的 Playground 里用真实 Key 试每一个模型。

模型

目前收录两个系列。每张卡片链接到对照矩阵,包含参数、分辨率档位和实测时延。

Nano Banana

Google 图像模型
参数对照矩阵

每次最多 14 张参考图,n 取 1 到 4,分辨率档位从 512 px 到 4K。

  • Nano Banana Pro gemini-3-pro-image
    1K · 2K · 4K 1K 约 29 s
  • Nano Banana 2 gemini-3.1-flash-image
    512 px – 4K · 思考模式 1K 约 15 s
  • Nano Banana 2 Lite gemini-3.1-flash-lite-image
    单一尺寸 约 6.6 s
  • Nano Banana gemini-2.5-flash-image
    单一尺寸 · PNG 6.6 – 10 s

Grok Imagine

xAI 图像与视频模型
参数对照矩阵

图片 1k 或 2k,最多 3 张参考图。视频 1 到 15 秒、480p 到 1080p,支持编辑与续写模式。

  • Image 2.0 grok-imagine-image-2.0
    1k · 2k · 质量档位 图片
  • Image Quality grok-imagine-image-quality
    默认竖构图 图片
  • Image grok-imagine-image
    1k · 2k 图片
  • Video 1.5 grok-imagine-video-1.5
    480p · 720p · 1080p · 人声 视频
  • Video grok-imagine-video
    视频输入 · 编辑 · 续写 视频

标价对齐官方,折扣体现在分组倍率。

WideRouter 的标价与供应商公布价格完全一致。实际扣费 = 标价 × 分组倍率,Grok-Official 分组的倍率为 0.8。

标价 × 分组倍率 = 实际扣费
$0.02 每张 grok-imagine-image,1k 与 2k 同价
$0.08 每秒起 grok-imagine-video-1.5,480p
0.8× 倍率 Grok-Official 分组

参考图与额外输出按件计费。完整价目表(含 Nano Banana)见文档。 在文档中查看计价

两次调用,跑通第一个任务。

导出 Key、提交、轮询。平台上每一个模型都是这同样的两次调用。

# 1. submit
curl https://api.widerouter.com/v1/task/submit \
  -H "Authorization: Bearer $WIDEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image",
    "input": { "prompt": "a lighthouse at dusk" }
  }'

# 2. poll until status is completed or failed
curl https://api.widerouter.com/v1/task/task_koYlX7Gm6lEn5jfPS54TcDZcN7OvZA8M \
  -H "Authorization: Bearer $WIDEROUTER_API_KEY"
import os, time, requests

BASE = "https://api.widerouter.com"
HEADERS = {"Authorization": f"Bearer {os.environ['WIDEROUTER_API_KEY']}"}

# 1. submit
task = requests.post(f"{BASE}/v1/task/submit", headers=HEADERS, timeout=30, json={
    "model": "gemini-3.1-flash-image",
    "input": {"prompt": "a lighthouse at dusk"},
}).json()

# 2. poll with a 3 s back-off
while task["status"] not in ("completed", "failed"):
    time.sleep(3)
    task = requests.get(f"{BASE}/v1/task/{task['id']}", headers=HEADERS, timeout=30).json()

print(task["outputs"])

一次接入,所有模型通用。

在控制台创建 Key,然后跟着五分钟的快速开始走一遍。