One envelope
Endpoint, headers, status machine and error table are shared. What changes between models is the set of fields inside input.
Submit a task, poll for it, download the result. The endpoint and the envelope never change — switching models means changing parameters, not code paths.
The flow is identical whether you generate a still image or a fifteen‑second clip, and regardless of which model you pick.
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.
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.
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.
Most gateways make you learn a new endpoint, request body and response shape per provider. WideRouter keeps all three fixed.
Endpoint, headers, status machine and error table are shared. What changes between models is the set of fields inside input.
A 4K still from Nano Banana Pro and a 1080p clip from Grok Imagine come back through the same task object.
Model ids match the provider’s names exactly. No invented aliases, no -preview suffixes to guess at.
Pass callback_url to be notified on completion. Try every model from the docs playground with a real key before writing code.
Two families today. Each card links to a comparison matrix with parameters, resolution tiers and measured latency.
Up to 14 reference images per request, n from 1 to 4, resolution tiers from 512 px to 4K.
gemini-3-pro-image gemini-3.1-flash-image gemini-3.1-flash-lite-image gemini-2.5-flash-image Images at 1k or 2k with up to 3 references. Video from 1 to 15 seconds, 480p to 1080p, with edit and extend modes.
grok-imagine-image-2.0 grok-imagine-image-quality grok-imagine-image grok-imagine-video-1.5 grok-imagine-video 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 Reference images and additional outputs are billed per item. Full tables, including Nano Banana, are in the docs. See pricing in the docs
Export your key, submit, poll. The same two calls work for every model on the platform.
# 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"])
Create a key in the console, then follow the five‑minute quickstart.
无论生成一张静态图还是一段十五秒的视频,无论选哪个模型,流程都是同一个。
把模型 ID 和 input 对象 POST 到 /v1/task/submit。约一秒返回任务 ID,生成在后台继续进行。
以 2–3 秒退避 GET /v1/task/{id},直到 status 变为 completed 或 failed。也可以传 callback_url,完全省掉轮询。
从 outputs[] 读取直链:图片为 JPEG 或 PNG,视频为 MP4。链接无需鉴权,完成后 24 小时内有效。
多数中转平台要求你为每家供应商学一套端点、一套请求体、一套响应结构。WideRouter 把这三样都固定下来。
端点、请求头、状态机和错误表全部共用。模型之间变的只是 input 里那组字段。
Nano Banana Pro 的 4K 静态图和 Grok Imagine 的 1080p 视频,通过同一个任务对象返回。
模型 ID 与供应商官方名称完全一致。不自造别名,也不用猜 -preview 后缀。
传 callback_url 即可在完成时收到通知。写代码前先在文档的 Playground 里用真实 Key 试每一个模型。
目前收录两个系列。每张卡片链接到对照矩阵,包含参数、分辨率档位和实测时延。
每次最多 14 张参考图,n 取 1 到 4,分辨率档位从 512 px 到 4K。
gemini-3-pro-image gemini-3.1-flash-image gemini-3.1-flash-lite-image gemini-2.5-flash-image 图片 1k 或 2k,最多 3 张参考图。视频 1 到 15 秒、480p 到 1080p,支持编辑与续写模式。
grok-imagine-image-2.0 grok-imagine-image-quality grok-imagine-image grok-imagine-video-1.5 grok-imagine-video WideRouter 的标价与供应商公布价格完全一致。实际扣费 = 标价 × 分组倍率,Grok-Official 分组的倍率为 0.8。
标价 × 分组倍率 = 实际扣费 参考图与额外输出按件计费。完整价目表(含 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"])