Grok Imagine
grok-imagine-image 與 grok-imagine-image-quality 透過 PopGo OpenAI Images 相容端點提供同步生成與編輯。PopGo 會把標準 size、resolution、aspect_ratio 轉換為模型欄位。
Endpoint 與規格
POST https://api.popgo.site/v1/images/generations
POST https://api.popgo.site/v1/images/edits
Authorization: Bearer YOUR_API_KEY
| 模型 | 解析度 | 長寬比 |
|---|---|---|
grok-imagine-image | 1K、2K | 1:1、16:9、9:16、4:3、3:4、3:2、2:3 |
grok-imagine-image-quality | 目前按 2K 級別配置,請看即時頁 | 同上七種 |
例如 2048x1152 會轉成 2K 與 16:9。同時傳多個規格欄位時,必須保持一致。
欄位與範例
| 欄位 | 類型 | 說明 |
|---|---|---|
model | string | 必填,公開模型 ID |
prompt | string | 必填,生成或編輯描述 |
resolution | string | 1K 或 2K |
aspect_ratio | string | 上表七種長寬比之一 |
size | string | WIDTHxHEIGHT,由 PopGo 轉換 |
n | integer | 選填,通常為 1 |
response_format | string | url 或 b64_json |
image | file | /edits 的 multipart 參考檔案 |
curl https://api.popgo.site/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL","prompt":"A neon city street in the rain, realistic photography","resolution":"2K","aspect_ratio":"16:9","n":1}'
限制與錯誤
resolution 不可傳 4K,長寬比必須使用列出的七種值,尺寸不可超過 2K 範圍。模型 ID 中的 quality 不是請求欄位;未列出的 quality、style 不要傳。編輯使用 multipart 檔案。回應可為 data[].url 或不含前綴的 data[].b64_json,計費依即時配置。