在 APIMart 通过 Grok Imagine API 调用 xAI 的标准图像模型 grok-imagine-image:支持文生图和最多五张参考图的自然语言编辑,1K 或 2K 输出,auto 加 13 种比例,单次 1–10 张。
服务亮点
74 / 8000

透明定价,无隐藏费用。按量付费,用多少付多少。
| 型号 | 规格 | 黄金价当前价格 | 铂金价 | 钻石价 | 官方价 | 为你节省 |
|---|---|---|---|---|---|---|
grok-imagine-image | 1K | 0.16Credits(~$0.016)/张 | 0.152Credits(~$0.0152)/张 | 0.144Credits(~$0.0144)/张 | 0.2Credits(~$0.02)/张 | 20% |
| 2K | 0.16Credits(~$0.016)/张 | 0.152Credits(~$0.0152)/张 | 0.144Credits(~$0.0144)/张 | 0.2Credits(~$0.02)/张 | 20% | |
| 参考图片(每张) | 0.016Credits(~$0.0016)/张 | 0.0152Credits(~$0.0015)/张 | 0.0144Credits(~$0.0014)/张 | 0.02Credits(~$0.002)/张 | 20% |
* 实际费用以最终输出为准。
根据 APIMart API 文档,grok-imagine-image 在 APIMart 支持的能力
按照以下简单步骤开始使用 Grok Imagine 生成图像
创建免费的 APIMart 账号以访问 Grok Imagine API。
为账户充值以开始使用 Grok Imagine。
在控制台为 Grok Imagine 创建专属 API 密钥。
在 APIMart 用一个 POST 请求调用 grok-imagine-image。生成是异步的:先提交任务,再查询任务接口获取图片地址。本示例不带 X-APIMart-Response-Version 请求头,提交返回 HTTP 200,任务 ID 在 data[0].task_id;文档示例带了该请求头,返回 HTTP 202,任务 ID 在 data.id。
把上面创建的密钥保存到环境变量 APIMART_API_KEY,并在每个请求中以 Authorization: Bearer <key> 发送。
POST /v1/images/generations,传入 model grok-imagine-image、提示词、aspect_ratio、resolution 和 n。编辑图片再加上 image_urls,不要传 quality 字段。任务 ID 在 data[0].task_id。
轮询 GET /v1/tasks/{task_id} 直到 status 为 completed,再从 data.result.images[0].url[0] 读取图片地址。结果保留 72 小时。任务失败不收费。
完整参数与返回字段见 Grok Imagine API 文档。
curl -X POST https://api.apimart.ai/v1/images/generations \
-H "Authorization: Bearer $APIMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image",
"prompt": "石质台面上的白色陶瓷杯极简产品摄影,柔和窗光,干净背景",
"n": 1,
"aspect_ratio": "1:1",
"resolution": "2k"
}'import os
import time
import requests
API_BASE = "https://api.apimart.ai"
headers = {"Authorization": f"Bearer {os.environ['APIMART_API_KEY']}"}
# 1. Submit the generation task
payload = {
"model": "grok-imagine-image",
"prompt": "石质台面上的白色陶瓷杯极简产品摄影,柔和窗光,干净背景",
"n": 1,
"aspect_ratio": "1:1",
"resolution": "2k"
}
resp = requests.post(f"{API_BASE}/v1/images/generations", headers=headers, json=payload, timeout=60)
resp.raise_for_status()
task_id = resp.json()["data"][0]["task_id"]
# 2. Poll the task until it finishes
for _ in range(200):
task_resp = requests.get(f"{API_BASE}/v1/tasks/{task_id}", headers=headers, timeout=30)
task_resp.raise_for_status()
task = task_resp.json()["data"]
if task["status"] == "completed":
print(task["result"]["images"][0]["url"][0])
break
if task["status"] == "failed":
raise RuntimeError(task.get("error", {}).get("message", "generation failed"))
time.sleep(3)
else:
raise TimeoutError(f"task {task_id} did not finish in time; continue GET polling with this task ID")curl -X POST https://api.apimart.ai/v1/images/generations \
-H "Authorization: Bearer $APIMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image",
"prompt": "把产品放到晨光下的大理石厨房台面上,产品本身保持不变",
"n": 1,
"image_urls": [
"https://example.com/product.png"
]
}'TASK_ID="task_xxx" # replace with the task_id returned by the POST request
curl "https://api.apimart.ai/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer $APIMART_API_KEY"| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
model | string | 是 | 默认值: grok-imagine-image | grok-imagine-image。同一个型号负责文生图和编辑。 |
prompt | string | 是 | 默认值: — | 图片描述;传了 image_urls 时为编辑指令。最多 8000 字符。 |
aspect_ratio | string | 否 | 默认值: auto | 画面比例:auto, 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。 |
resolution | string | 否 | 默认值: 1k | 输出分辨率:1k 或 2k。在 APIMart 上两者每张同价。 |
n | integer | 否 | 默认值: 1 | 生成张数,1–10。 |
image_urls | array | 否 | 默认值: — | 编辑用的参考图,1–5 张公网 HTTP(S) 地址。文生图请省略该字段。 |
nsfw_check | boolean | 否 | 默认值: false | 设为 true 时,提交任务前会审核提示词和输入图片。 |
“Grok Imagine 的超写实质量让我真的很惊喜。色彩准确度和纹理细节都非常出色——我们每天都用它来制作产品营销视觉素材。”
Alex Chen
DesignWorks 创意总监
“编辑模型真是太厉害了。我只需用文字描述要改什么,grok-imagine-1.5-edit-apimart 就能干净利落地完成,再也不用在 Photoshop 里折腾蒙版了。”
Sarah Mitchell
UI/UX 设计师
“提示词的理解非常细腻。Grok Imagine 能捕捉到其他模型完全忽略的细微风格暗示。我的客户总在问我是怎么做到生成速度这么快的。”
Marcus Weber
自由插画师
“APIMart 上 Grok Imagine 的定价无可比拟。我们每周生成数百张产品图,成本只有以前的一小部分。”
Emma Rodriguez
市场经理
“双参数 API 简单得让人耳目一新。我不到一小时就把 Grok Imagine 集成到了我们的平台里。通过 APIMart 的稳定性非常可靠。”
James Liu
全栈开发者
“我们把所有活动创意概念都切换到了 Grok Imagine。它是我们找到的速度与质量比最好的方案,APIMart 的定价让大规模使用完全可行。”
Sophie Anderson
AdVision 艺术总监
关于 APIMart 上 Grok Imagine API 的型号、价格、参数与结果
Grok Imagine API 是 xAI 于 2026 年 1 月 28 日发布的图像与视频生成接口。本页介绍其中的标准图像模型 grok-imagine-image,支持文生图和图片编辑;视频生成请看 Grok Imagine Video 页面。
xAI 官方 grok-imagine-image 每张 $0.02。2026 年 10 月,APIMart 黄金会员每张输出图 $0.016(1K 与 2K 同价),参考图每张 $0.0016;铂金和钻石会员最高可省 28%。任务失败不收费,实时价格见价格表。
model 和 prompt 必填,提示词最多 8000 字符。可选 n(1–10,默认 1)、aspect_ratio(默认 auto)、resolution(1k 或 2k,默认 1k)、image_urls(1–5 张)和 nsfw_check。不要传 quality 字段。
能。在 image_urls 中传入一张公网 HTTP(S) 图片地址并写明修改指令即可编辑这张图;最多传五张可组合多个参考。文生图时省略 image_urls。本地图片先通过 POST /v1/uploads/images 上传。
aspect_ratio 支持 auto, 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,默认 auto。resolution 支持 1k 或 2k。在 APIMart 上 1K 与 2K 每张同价。
n 可设为 1 到 10。每张输出图都计费,输出费用随 n 增加。参考图每次请求按输入张数计费一次,不乘以 n。
两者参数相同,都支持 1K / 2K 和单次最多 10 张。grok-imagine-image 最多五张参考图、价格更低;grok-imagine-image-quality 最多三张参考图、价格更高(xAI 官方每张 $0.05)。两个型号在 APIMart 各有独立页面和价格。
Grok Imagine 2.0 是 xAI 于 2026 年 8 月 7 日发布的新一代图像模型,增加了 low / medium 质量选项。想用最多五张参考图、并且要官方渠道最低的单张价格时,用 grok-imagine-image;Grok Imagine 2.0 可在其独立页面对比。
向 POST /v1/images/generations 提交请求,保存任务 ID,轮询 GET /v1/tasks/{task_id} 直到状态为 completed,再从结果中读取图片地址。结果保留 72 小时,请下载到自己的存储。
注册 APIMart,在控制台打开 API Keys 页面创建密钥。同一个密钥可调用 Grok Imagine API 及平台上的所有其他模型,按量付费,无需订阅。
不免费。APIMart 上的 Grok Imagine API 没有免费额度,按张按量付费:任务失败不收费,会员所有价格享 8 折或更低。
不会。根据 APIMart 服务条款,你的提示词和图片不会用于训练 AI 模型,除提供服务所必需外也不会与第三方共享。
探索同类型的其他模型。

GPT Image 2.6 Sunburst
GPT Image 2.6 Sunburst brings a fresh burst of creativity to your ideas. From vibrant illustrations to atmospheric scenes and striking product concepts, explore rich colors, expressive lighting, and thoughtful compositions that make your vision shine.

GPT Image 2.6 Flare
GPT Image 2.6 Flare brings your imagination into focus, turning creative ideas into expressive visuals. From cinematic scenes and bold illustrations to polished product concepts, explore color, light, and composition to give every idea its own distinctive look.

Muse Image Ext
Muse Image turns inspiration into compelling visuals. From a spark of an idea to a fully imagined scene, it helps bring your creative vision to life with images that express your style and tell your story. Explore new possibilities and give every idea a visual voice.

Hy Image V3.5 Preview
HY Image 3.5 Preview is an image generation and editing model developed by Tencent Hunyuan. It supports text-to-image creation, reference-based generation, and multi-turn editing, allowing users to refine images through conversational instructions. With support for up to 4K output and flexible image dimensions, it offers a versatile tool for creating and refining visual content.