Bearer 鉴权
生成、状态查询和历史列表请求都使用 Authorization 请求头传入 API key。
生成、状态查询和历史列表请求都使用 Authorization 请求头传入 API key。
通过公开端点提交提示词、查询生成进度,并读取完成后的图片结果。
Grok Imagine Image 2.0 通常每张图消耗 5 积分。
在账号中创建或复制 API key,然后用 Authorization: Bearer <YOUR_API_KEY> 传入。API key 必须保存在你自己的服务端,不要写进前端代码。
生成接口使用 JSON,传入模型 ID,以及包含 prompt 和 aspect_ratio 的 input 对象。状态和历史接口会返回任务状态与可用的结果 URL。
curl -X POST https://imagineimage2.org/api/image/grok-imagine/generate \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2-0/text-to-image",
"input": {
"prompt": "A clean product poster for a silver perfume bottle, readable headline, studio lighting",
"aspect_ratio": "16:9"
}
}'curl "https://imagineimage2.org/api/image/grok-imagine/status?task_id=<TASK_ID>" \
-H "Authorization: Bearer <YOUR_API_KEY>"curl "https://imagineimage2.org/api/image/grok-imagine/list?page=1&limit=12" \
-H "Authorization: Bearer <YOUR_API_KEY>"登录账号,创建或复制 API key,并放入你自己的后端密钥配置中。
POST 到生成接口,传入文生图模型 ID,以及 input.prompt 和 input.aspect_ratio。
使用 task_id 查询状态,在任务完成后把图片结果 URL 展示到你的产品流程中。
是。API 生成与在线工作台使用同一套积分系统,Grok Imagine Image 2.0 通常每张图消耗 5 积分。
不建议。请从你自己的后端调用 API,前端只调用你的服务端接口,避免 API key 暴露在浏览器代码中。