返回模型列表

Grok Imagine Image 2.0

xaixai/grok-imagine-image-2.0

Text-to-image generation at 1024×1024. Image editing and larger resolutions are not currently available through this route.

上下文长度
--
最大输出
--
图片价格按次
$0.0432每张图片

模态能力

文本→图像

能力

图像生成

媒体生成能力

image_generation
sizes
  • 1024x1024
qualities
  • low
max_outputs_per_request
4
defaults
size
1024x1024
quality
low

价格明细

类型费率
图片$0.0432 每张图片

Per generated image at 1024×1024. Low quality $0.04; other qualities are not currently available.

支持参数

promptsizenquality

API 使用示例

所有新集成都应使用下方示例中的全球端点 api.therouter.ai;旧中国加速端点已下线。

建议使用异步 API

图像生成通常需要 30–180 秒,超过同步请求的边缘超时。下方示例已使用 ?async=true + 轮询模式。 查看异步图像生成 / 编辑完整指南 →

cURL
# 1) Submit job (returns 202 immediately with a polling URL).
# Image generation takes 30-180s — always use the async path in production.
JOB=$(curl -s -X POST "https://api.therouter.ai/v1/images/generations?async=true"   -H "Content-Type: application/json"   -H "Authorization: Bearer $THE_ROUTER_API_KEY"   -d '{
    "model": "xai/grok-imagine-image-2.0",
    "prompt": "A cinematic product render with soft studio lighting"
  }' | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "submitted: $JOB"

# 2) Poll until terminal (succeeded / failed / cancelled / expired).
while :; do
  R=$(curl -s "https://api.therouter.ai/v1/jobs/$JOB"     -H "Authorization: Bearer $THE_ROUTER_API_KEY")
  S=$(echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
  echo "status: $S"
  case "$S" in
    succeeded) echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['unsigned_urls'][0])"; break ;;
    failed|cancelled|expired) echo "$R"; exit 1 ;;
  esac
  sleep 5
done
帮助与联系