返回模型列表

GLM Image

zhipuzhipu/glm-image

Zhipu AI GLM Image — flagship text-to-image generation model. 2K resolution, strong Chinese typography support.

上下文长度
--
最大输出
--
请求价格按次
$0.0167每次请求
图片价格按次
$0.0209每张图片

模态能力

文本图像

价格明细

类型费率
请求$0.0167 每次请求
图片$0.0209 每张图片
Per image$0.0209 每张图片

Per-image flat fee

支持参数

promptsizequalitynuser

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": "zhipu/glm-image",
    "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
客服支持