grok-imagine-image-2.0 API 价格
所有价格均以 USD 计。对比 APISea 费率与相同计费单位的官方标价。
| 选项 | APISea | 官方 | 节省 |
|---|---|---|---|
| 1K · low | $0.0352 | $0.04 | −12% |
| 1K · medium默认 | $0.0528 | $0.06 | −12% |
| 2K · low | $0.0528 | $0.06 | −12% |
| 2K · medium | $0.0704 | $0.08 | −12% |
价格单位为 每张图像。
输入素材
| 选项 | 单位 | APISea | 官方 |
|---|---|---|---|
| Default | 每张图像 | $0.0088 | $0.01 |
grok-imagine-image-2.0 是什么?
grok-imagine-image-2.0 是 xAI 的 Grok Imagine 模型,可在 APISea 上异步生成和编辑图像。输入文本提示即可生成图像,也可以添加一至三张参考图,用于编辑和多图参考工作流。每次请求支持生成一至十张图像,分辨率可选 1K 或 2K,宽高比涵盖正方形、纵向和横向格式。文生图请求还支持低或中画质,中画质为默认设置。
使用 API 密钥通过 APISea 的图像生成 endpoint 调用模型。提交请求后会返回任务 ID,而不是生成好的图像;请轮询任务状态,待任务完成后获取结果。APISea 采用按需付费定价,仅对成功的请求计费。APISea 1K · low 的输出价格低至每张 $0.0352,参考图输入费用为每张 $0.0088。默认配置的价格比服务提供商的标价低约 12%。
grok-imagine-image-2.0 的亮点
图片生成与编辑
仅通过文本生成图像,或提供一至三张参考图来编辑图像并创建多图参考请求。
分辨率和画质控制
可选择 1K 或 2K 输出分辨率。文生图请求支持 low 或 medium 画质;使用参考图时请勿传入 quality。
灵活的输出格式
每次可请求生成一至十张图像,并从支持的正方形、纵向、横向和长幅宽高比中进行选择,也可以使用 auto。
异步任务跟踪
成功提交后会返回 HTTP 202 和任务 ID。请轮询任务状态,直到任务状态变为 completed 或 failed。
分 4 步调用 grok-imagine-image-2.0 API
- 01
获取 API 密钥
登录 APISea,充值 $50 起,并在控制台创建一个 sk-sea 密钥。
- 02
设置 base URL
在 SDK 或 HTTP 客户端中将 https://api.apisea.ai/v1 设置为 base URL。
- 03
发送请求
调用 POST /v1/images/generations,并传入 "model": "grok-imagine-image-2.0" 及以下参数。
- 04
处理响应
响应中包含 task_id。轮询 GET /v1/tasks/{task_id},直到状态变为 completed,然后下载结果 URL。
curl --request POST \
--url https://api.apisea.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-APISea-Response-Version: 2026-07-27' \
--data '{
"model": "grok-imagine-image-2.0",
"prompt": "A cinematic neon-lit city street in the rain",
"n": 1,
"aspect_ratio": "16:9",
"resolution": "2k",
"quality": "medium"
}'参数
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
model | string | 必填 | grok-imagine-image-2.0 | Must be `grok-imagine-image-2.0`. |
nsfw_check | boolean | 可选 | false | Whether to run content moderation before submitting the image task. |
prompt | string | 必填 | — | Image generation or editing instructions. Must be non-empty after trimming and no longer than 8,000 characters. |
n | integer | 可选 | 1 | Number of output images, from `1` to `10`. |
aspect_ratio | string | 可选 | auto | Supported values: `1:1`, `3:4`, `4:3`, `9:16`, `16:9`, `2:3`, `3:2`, `9:19.5`, `19.5:9`, `9:20`, `20:9`, `1:2`, `2:1`, and `auto`. |
resolution | string | 可选 | 1k | |
quality | string | 可选 | — | Text-to-image only: `low` or `medium` (default). Do not send this field when `image_urls` is present. |
image_urls | array | 可选 | — | One to three reference images. Only publicly accessible absolute HTTP(S) URLs are accepted. Upload local images with `POST /v1/uploads/images`, then use the returned `url`. Omit the field when there is no reference image. |
grok-imagine-image-2.0 的应用场景
创意变体工具
构建基于提示词的工作区,在一个任务中请求生成多个图像选项,供团队审核。
基于参考图进行编辑
允许用户提交可公开访问的图像 URL,并附上说明以请求编辑。
多图创意工作流
允许用户在提示词中附带最多三张参考图,满足需要多个视觉输入的工作流。
按格式创建素材
通过明确设置宽高比,为不同的展示位置要求生成正方形、纵向或横向图像。
获得更好结果的技巧
- 01
区分生成与编辑
文生图请求请省略 image_urls。编辑时请提供一至三个参考图 URL,并且不要在这些请求中传入 quality。
- 02
有计划地选择输出成本
APISea 1K · low 的费用为每张 $0.0352,而 APISea 2K · medium 的费用为每张 $0.0704。请谨慎设置 n,因为它决定输出图像的数量。
- 03
提交后轮询任务
从 data.id 读取任务 ID,并轮询 data.poll_url 或调用 GET /v1/tasks/{task_id}。HTTP 202 表示任务已被接受,并不代表结果已经生成。
- 04
在服务器端保管凭证
请从后端或 BFF 提交请求。不要在浏览器代码、公开环境变量、URL、本地存储或客户端日志中暴露长期有效的 APISea API 密钥。
限制与须知
处理过程为异步,因此提交请求时不会返回最终图像。
去除首尾空白后,提示词不能为空,且长度不得超过 8,000 个字符。
参考输入最多支持三个可公开访问的绝对 HTTP(S) URL;quality 仅适用于文生图。
grok-imagine-image-2.0 API 常见问题
在 APISea 上使用 grok-imagine-image-2.0 需要多少钱?
APISea 1K · low 的费用为每张 $0.0352;APISea 1K · medium 和 APISea 2K · low 的费用均为每张 $0.0528;APISea 2K · medium 的费用为每张 $0.0704。参考图输入(Default)的费用为每张 $0.0088。默认配置的价格比服务提供商的标价低约 12%。
如何调用 grok-imagine-image-2.0?
发送 POST https://api.apisea.ai/v1/images/generations 请求,并使用 Bearer 授权,将 model 设为 grok-imagine-image-2.0,同时提供非空的 prompt。响应会返回任务 ID;请轮询 data.poll_url 或调用 GET /v1/tasks/{task_id} 获取最终结果。
该模型支持图像编辑吗?
支持。在 image_urls 中加入一至三个可公开访问的绝对 HTTP(S) URL,并在 prompt 中描述要进行的编辑。设置了 image_urls 时请勿传入 quality。
支持哪些分辨率和质量设置?
resolution 参数接受 1k 或 2k,默认值为 1k。仅文生图支持 quality 参数,可选 low 或 medium,默认值为 medium。
一次最多可以请求生成多少张图像?
将 n 设为 1 到 10 之间的值,默认值为 1。每次请求最多可包含三张参考图,prompt 不得超过 8,000 个字符。
我可以将生成的图像用于商业用途吗?
商业用途须遵守服务提供商的条款。在将输出用于商业产品或营销活动前,请查阅 xAI 适用的条款。
相关模型
grok-imagine-1.5-apisea
grok-imagine-1.5-ext
grok-imagine-1.5-edit-apisea