Grok Imagine Image 2.0 API

xAI Grok Imagine Image 2.0: bold, detailed images with low/medium quality tiers at 1K or 2K.

xAI·图片可用

低至$0.018/ 张

模型 IDgrok-imagine-image-2.0

text-to-imageimage-edit

输入

文本 · 图片

输出

图片

供应商

10 家供应商

Aspect ratio

1:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 · 2:3

Resolution

1K · 2K

Quality

low · medium

近 7 天表现 · 近期请求较少,暂无统计数据。

Grok Imagine Image 2.0 价格

价格按单位计费;未指定供应商时,会路由到支持该参数组合且价格最低的供应商。

规格价格(美元)
全部规格
$0.018 / 张
2 积分

接入前先试用 Grok Imagine Image 2.0

写代码之前,先测试生成效果、对比各供应商价格并预估费用。

供应商
图片
预计费用

输入

prompt
image_urls
aspect_ratio
resolution
quality
num_images

结果

空闲
生成结果会显示在这里。

本次请求的各供应商报价

输入提示词即可对比各供应商价格。

Grok Imagine Image 2.0 提示词示例

可直接使用的提示词,一键载入 Playground 再调整。

来源
场景分类

共 8 条提示词

Create a high-end hero infographic titled “SPECTRAL FLOW INDEX”. Design it as a large

Create a high-end hero infographic titled “SPECTRAL FLOW INDEX”. Design it as a large circular radial diagram with a bright central glowing core, surrounded by five clean concentric rings expanding outward like a precision instrument dial. Each ring is divided into evenly spaced segments containing miniature visual studies rendered in distinctly different styles: photorealism, blueprint linework, volumetric particle render, ink stipple, soft watercolor, isometric technical drawing, cinematic still, macroscopic crystal close-up, luminous wireframe, and matte clay sculpture. The overall atmosphere is electric, refined, and extremely polished — deep charcoal background, subtle luminous cyan and soft amber accents, thin glowing guide lines, and perfect geometric alignment. Typography is dense, hierarchical, and perfectly legible with sharp edges and straight baselines: Large precise bold sans-serif title centered at the very top Medium-weight subtitle directly beneath it: “Mapping energy gradients across observable scales” A clean horizontal band of eight short, evenly spaced labels in sharp small caps across the upper third, naming invented measurement zones Two tall vertical columns of text, one on the far left and one on the far right, each containing five tightly spaced entries in clear body text (definitions on the left, observational notes on the right) A single thin full-width footer line at the very bottom in micro but still razor-sharp text: “Advanced visualization reference · Educational series only” All text sits on straight horizontal or vertical axes. No curved or circular text. Consistent spacing, strong visual hierarchy, and absolute clarity at every scale.

A vast battlefield outside the ancient city of Troy, thousands of Greek and Trojan war

A vast battlefield outside the ancient city of Troy, thousands of Greek and Trojan warriors clashing beneath towering stone walls. Heroes in bronze armor ride chariots through clouds of dust, giant banners wave in the wind, while the golden light of sunset illuminates the legendary battlefield. The scale of war stretches beyond the horizon, cinematic epic composition, Homeric mythology, dramatic storytelling, ultra realistic, IMAX movie frame, 8K masterpiece.

A cinematic, photorealistic late-night workspace in a near-future city. A developer si

A cinematic, photorealistic late-night workspace in a near-future city. A developer sits casually at a clean desk beside a large rain-covered window, focused on a laptop. Outside, the city glows softly through the rain with restrained cyan, emerald-green and occasional violet light. The atmosphere feels slightly cyberpunk, but realistic and lived-in rather than futuristic fantasy. The room is quiet and minimal: dark graphite surfaces, a mechanical keyboard, a half-finished cup of coffee, subtle cable details, soft reflections on glass and brushed metal. Natural posture, realistic hands, authentic skin texture, understated clothing, candid documentary feeling. The laptop screen shows a clean dark interface with the small word “EvoLink” in the corner, spelled exactly and clearly. No large logo, no slogan, no floating holograms, no obvious network diagrams. Soft emerald #00FF88 and cyan #00D4FF screen light gently illuminate the developer’s face and hands, with a very subtle violet #7C3AED accent in the distant city. Moody cinematic lighting, realistic rain reflections, shallow depth of field, medium-format editorial photography, premium technology brand aesthetic, sophisticated and understated. No excessive neon, no crowded cyberpunk signs, no sci-fi armor, no dramatic holograms, no fake interface text, no extra words, no malformed hands, no plastic skin, no oversaturated colors.

Create a high-end hero infographic titled “SPECTRAL FLOW INDEX”. Design it as a large

Create a high-end hero infographic titled “SPECTRAL FLOW INDEX”. Design it as a large circular radial diagram with a bright central glowing core, surrounded by five clean concentric rings expanding outward like a precision instrument dial. Each ring is divided into evenly spaced segments containing miniature visual studies rendered in distinctly different styles: photorealism, blueprint linework, volumetric particle render, ink stipple, soft watercolor, isometric technical drawing, cinematic still, macroscopic crystal close-up, luminous wireframe, and matte clay sculpture. The overall atmosphere is electric, refined, and extremely polished — deep charcoal background, subtle luminous cyan and soft amber accents, thin glowing guide lines, and perfect geometric alignment. Typography is dense, hierarchical, and perfectly legible with sharp edges and straight baselines: Large precise bold sans-serif title centered at the very top Medium-weight subtitle directly beneath it: “Mapping energy gradients across observable scales” A clean horizontal band of eight short, evenly spaced labels in sharp small caps across the upper third, naming invented measurement zones Two tall vertical columns of text, one on the far left and one on the far right, each containing five tightly spaced entries in clear body text (definitions on the left, observational notes on the right) A single thin full-width footer line at the very bottom in micro but still razor-sharp text: “Advanced visualization reference · Educational series only” All text sits on straight horizontal or vertical axes. No curved or circular text. Consistent spacing, strong visual hierarchy, and absolute clarity at every scale.

Photoreal late-night developer desk by a rainy window in a near-future city, cyan, emerald and violet palette, code on a laptop screen, a mug of tea, soft reflections, no people.

Dense infographic titled "SPECTRAL FLOW INDEX": a radial dial with a glowing core and five rings of tiles, eight small-caps labels, two side columns of stats, charcoal background with cyan and amber accents.

Grok Imagine Image 2.0 API 文档

该模型的接口、请求字段与可直接运行的调用示例。

Base URL

https://01router.com/api/v1
llms.txt

快速开始

将 API_KEY 设为项目密钥,在服务端运行示例。示例中的媒体地址需替换为您自己的公开地址。

自动路由会选择支持当前请求的供应商。选择指定供应商,可查看它的参数约束和调用示例。

curl https://01router.com/api/v1/generations \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "grok-imagine-image-2.0",
  "input": {
    "prompt": "A cinematic shot of a red fox running through snow",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "quality": "medium",
    "num_images": 1
  }
}
JSON

# Replace GENERATION_ID with the id returned above; poll until status is "succeeded" or "failed"
curl https://01router.com/api/v1/generations/GENERATION_ID -H "Authorization: Bearer $API_KEY"

接口列表

这里只列出当前模型相关的接口,路径已包含 /api/v1。点击接口可跳转到使用说明。

鉴权

以 Bearer Token 方式发送 API Key,费用从 Key 所属账户的积分中扣除。

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
获取 API Key

输入参数

使用 Content-Type: application/json 发送请求。模型参数放在 input 中,model、provider、callback_url 放在最外层。

请求体

参数名类型必填说明
modelstring是"grok-imagine-image-2.0"
providerstring否指定供应商;不传则自动路由到最便宜的。可选: fal | 01router | replicate | wavespeed | kie | apimart | evolink | atlascloud | vercel | openrouter
inputobject是模型参数,字段见下方 input 字段表。
callback_urlstring否可选的公开 HTTPS 回调地址,接收带签名的任务最终结果;仍可通过查询接口获取状态。

input · input 字段

必填字段已明确标记,其他字段省略时使用所列默认值。

参数名类型必填可选值默认值
prompt*string是——
image_urls
Optional — switches to image editing
string[]否maxItems: 4—
aspect_ratiostring否1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 3:2 | 2:31:1
resolutionstring否1K | 2K1K
qualitystring否low | mediummedium
num_imagesinteger否min: 1 · max: 41
任务回调 →

输出结果

创建任务成功不代表生成完成。保存 id,查询到 succeeded 或 failed 后,读取 outputs 或 error。示例金额仅作说明,实际费用由请求决定。

queued→processing→succeeded / failed

提交后的响应

{
  "id": "gen_example",
  "object": "generation",
  "model": "grok-imagine-image-2.0",
  "type": "image",
  "provider": "fal",
  "status": "processing",
  "input": {
    "prompt": "A cinematic shot of a red fox running through snow",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "quality": "medium",
    "num_images": 1
  },
  "outputs": [],
  "error": null,
  "credits": 0,
  "price_usd": 0,
  "created_at": "2026-10-25T08:00:00.000Z",
  "completed_at": null
}

完成后的响应

{
  "id": "gen_example",
  "object": "generation",
  "model": "grok-imagine-image-2.0",
  "type": "image",
  "provider": "fal",
  "status": "succeeded",
  "input": {
    "prompt": "A cinematic shot of a red fox running through snow",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "quality": "medium",
    "num_images": 1
  },
  "outputs": [
    "https://example.com/output.png"
  ],
  "error": null,
  "credits": 0,
  "price_usd": 0,
  "created_at": "2026-10-25T08:00:00.000Z",
  "completed_at": "2026-10-25T08:01:00.000Z"
}

响应字段

参数名类型必填说明
idstring是任务 ID,用于查询或取消任务。
objectstring是generation
modelstring是grok-imagine-image-2.0
typestring是image
providerstring是供应商
statusstring是queued → processing → succeeded / failed。进入任一终态后停止轮询。
inputobject是模型参数,字段见下方 input 字段表。
outputsstring[]是结果文件 URL 数组。处理中为空;成功后读取并及时下载保存。
errorstring | null是失败原因;无错误时为 null。
creditsnumber是本次请求扣除的积分。
price_usdnumber是本次请求的美元价格。
created_atstring是ISO 8601 格式的任务创建时间。
completed_atstring | null是ISO 8601 格式的完成时间;未完成时为 null。

获取结果

每隔几秒轮询,直到 status 为 succeeded 或 failed。输出链接由供应商托管,可能过期,请及时下载保存;也可以传 callback_url 接收推送。

curl "https://01router.com/api/v1/generations/GENERATION_ID" \
  -H "Authorization: Bearer $API_KEY"

queued → processing → succeeded / failed。进入任一终态后停止轮询。 结果文件 URL 数组。处理中为空;成功后读取并及时下载保存。

取消任务

取消取决于供应商支持情况和任务状态。确认取消后返回 status: failed、error: Canceled by user;不支持取消或已完成的任务返回 409 not_cancelable。

curl -X POST "https://01router.com/api/v1/generations/GENERATION_ID/cancel" \
  -H "Authorization: Bearer $API_KEY"

报价

请求体与创建任务相同。返回按价格排序的可用供应商,以及无法处理该请求的供应商及原因。

curl "https://01router.com/api/v1/quote" -H "Content-Type: application/json" --data-binary @- <<'JSON'
{
  "model": "grok-imagine-image-2.0",
  "input": {
    "prompt": "A cinematic shot of a red fox running through snow",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "quality": "medium",
    "num_images": 1
  }
}
JSON

OpenAI 兼容图片接口

使用 OpenAI SDK 时,可调用此接口并在最外层传入 prompt。它会等待结果并返回 data[].url。异步任务和完整模型参数请使用 /generations。

curl "https://01router.com/api/v1/images/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" --data-binary @- <<'JSON'
{
  "model": "grok-imagine-image-2.0",
  "prompt": "A cinematic shot of a red fox running through snow"
}
JSON
{
  "created": 1792915200,
  "data": [
    {
      "url": "https://example.com/output.png"
    }
  ]
}

模型信息与参数

此公开接口返回模型参数,以及各供应商支持的参数约束和价格。

curl "https://01router.com/api/v1/models/grok-imagine-image-2.0"

错误码

结合 HTTP 状态码和 error.message 排查。参数或认证错误需修正后再重试;生成任务失败则通过任务本身的 status 和 error 返回。

{
  "error": {
    "message": "Invalid or missing API key",
    "code": "unauthorized"
  }
}

400请求体或参数取值不合法

401缺少或无效的 API Key

402积分不足

404模型或任务不存在

409任务无法取消(已结束,或该供应商不支持取消)

429请求过于频繁,请稍后重试

502所有供应商都拒绝了任务(积分已退回)

鉴权、路由、计费与错误码详见 →

交给 AI 使用

将本模型文档交给编程助手:纯文本包含接口、输入约束、输出字段和请求示例。

打开 llms.txt

Grok Imagine Image 2.0 与同类模型对比

并排对比规格与起步价,选择前建议用同一提示词实测。

Grok Imagine Image 2.0GPT Image 2.5 FlareGPT Image 2.5 SunburstNano Banana 2.1
厂商xAIOpenAIOpenAIGoogle
起步价$0.018 / 张$0.0053 / 张$0.0053 / 张$0.018 / 张
输入文本 · 图片文本 · 图片文本 · 图片文本 · 图片
供应商10 家供应商6 家供应商6 家供应商8 家供应商
Aspect ratio1:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 · 2:31:1 · 4:3 · 3:4 · 16:9 · 9:16 · 3:2 · 2:31:1 · 4:3 · 3:4 · 16:9 · 9:16 · 3:2 · 2:31:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 · 2:3 · 4:5 · 5:4 · 21:9
Resolution1K · 2K——1K · 2K · 4K
Qualitylow · mediumlow · medium · high · xhigh · maxlow · medium · high · xhigh · max—

Grok Imagine Image 2.0 API 常见问题

Grok Imagine Image 2.0 是什么?

xAI 的图片生成和编辑模型,排版和字体规划细致,小字清晰,适合海报、信息图和商品图。

low 和 medium 质量有什么区别?

low 速度快、价格低,适合草稿;medium(默认)更慢但细节更多。分辨率(1K 或 2K)需单独设置。

能用参考图编辑吗?

能。在 image_urls 中放入原图并描述修改内容即可,可接受的参考图数量因供应商而异。

中文文字渲染效果如何?

英文文字非常可靠,中文稳定性稍弱,建议检查结果;中文为主的版式可以考虑 Qwen Image 3.0。

在 01router 上怎么计费?

按图片张数计费,价格取决于质量和分辨率,部分供应商对输入图片按请求加收少量费用,详见价格表。生成失败会退还积分。

相关模型

同一个 API Key 即可调用的其他模型。