Skip to content

Grok Imagine 图片

Grok Imagine 图片用于创意图、海报草图、风格探索和轻量视觉素材生成。MoonApiX 当前常见模型包括 grok-imagine-imagegrok-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-imageGrok Imagine 标准图片生成。
grok-imagine-image-proGrok Imagine Pro 图片生成,适合更高质量或更稳定输出。

常用字段

字段类型说明
modelstring图片模型名。
promptstring图片描述,建议包含主体、画面、风格、用途和比例。
sizestring输出尺寸。具体可用值以模型列表和 API Reference 为准。
ninteger生成数量。
response_formatstring返回格式,以 API Reference 为准。

响应处理

Grok Imagine 图片通常同步返回。客户端应从响应中的图片 URL 或图片内容字段读取结果,并保存原始请求参数用于重试和排障。

json
{
  "created": 1730000000,
  "data": [
    {
      "url": "https://example.com/generated-image.png"
    }
  ]
}

接入建议

  • Prompt 里写清主体、场景、光线、风格和用途,比只写关键词更稳定。
  • 如果需要精确图像编辑,请先确认所选 Grok 图片模型是否支持 /v1/images/edits
  • grok-imagine-*-videogrok-video-* 属于异步视频任务,请使用 Grok 视频

相关页面