Appearance
Grok Imagine 图片
Grok Imagine 图片用于创意图、海报草图、风格探索和轻量视觉素材生成。MoonApiX 当前常见模型包括 grok-imagine-image 和 grok-imagine-image-pro,使用 OpenAI Images 兼容入口。
方法与路径
http
POST /v1/images/generations请求示例
bash
curl https://moonapix.com/v1/images/generations \
-H "Authorization: Bearer <MOONAPIX_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image",
"prompt": "A cinematic poster of a futuristic harbor at sunrise, sharp product lighting.",
"size": "1024x1024",
"n": 1
}'常用模型
| 模型 | 建议用途 |
|---|---|
grok-imagine-image | Grok Imagine 标准图片生成。 |
grok-imagine-image-pro | Grok Imagine Pro 图片生成,适合更高质量或更稳定输出。 |
常用字段
| 字段 | 类型 | 说明 |
|---|---|---|
model | string | 图片模型名。 |
prompt | string | 图片描述,建议包含主体、画面、风格、用途和比例。 |
size | string | 输出尺寸。具体可用值以模型列表和 API Reference 为准。 |
n | integer | 生成数量。 |
response_format | string | 返回格式,以 API Reference 为准。 |
响应处理
Grok Imagine 图片通常同步返回。客户端应从响应中的图片 URL 或图片内容字段读取结果,并保存原始请求参数用于重试和排障。
json
{
"created": 1730000000,
"data": [
{
"url": "https://example.com/generated-image.png"
}
]
}接入建议
- Prompt 里写清主体、场景、光线、风格和用途,比只写关键词更稳定。
- 如果需要精确图像编辑,请先确认所选 Grok 图片模型是否支持
/v1/images/edits。 grok-imagine-*-video、grok-video-*属于异步视频任务,请使用 Grok 视频。