Images overview
Generate and edit images with the OpenAI Images-compatible API.
| Purpose | Endpoint |
|---|---|
| Base URL | https://api.hop-base.com/v1 |
| Generate images | POST /v1/images/generations |
| Edit images | POST /v1/images/edits |
| Query async tasks | GET /v1/images/tasks?task_id=… |
Calling GPT Image requires a key from the GPT Image (all models) group; gpt-image-2.5-flare and gpt-image-2.5-sunburst also work with a GPT Official Direct (Azure) key, returned synchronously as Base64. For other families, see "Choose a family".
Generate your first image in 3 lines
In the console's API Keys page, create a key in the GPT Image (all models) group. A key without this group (for example one with only Codex Plus or Codex Pro) returns 404 when calling gpt-image-*; you can also add the group to an existing key.
Replace sk-your-key with the new key and run. The curl example requires jq.
curl https://api.hop-base.com/v1/images/generations \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A Shiba Inu under cherry blossoms, watercolor style",
"size": "1024x1024"
}' \
| jq -r '.data[0].b64_json' | base64 --decode > result.pngThe image comes back as Base64 in data[].b64_json; decoded, it is a PNG. One image usually takes 15–40 seconds. Set your client's read timeout to at least 300 seconds (see GPT Image for why).
Choose a family
Families belong to different plan groups. A key that works for one does not necessarily work for another. Parameters, responses, and errors are on each family's page.
| Family | Highlights | Calling mode | Reference image limit | Official price (representative model) |
|---|---|---|---|---|
| GPT Image | Supports mask-based local edits; billed by token | Sync; async optional | 16 (official) | $5 / $30/ 1M tokens |
| Gemini image generation | 1K–4K tiers, any aspect ratio as WIDTHxHEIGHT | Sync; async optional | 14 (official) | $0.1344from/ image |
| Seedream | Returns a URL valid for 24 hours, or b64_json | Sync; Lite / 4.5 can stream | 14 | $0.045from/ image |
| Grok Imagine images | Does not use size; returns a temporary URL | Sync only | 2 | $0.02/ image |
| Kling images | Several models, including outpainting and multiple references | Async | 0–10, by model | $0.0294/ image |
| Midjourney | Always 4 images per request | Async | 1 | $0.0067from/ image |
Before a paid request, call GET /v1/models with the key you intend to use and take the complete model ID from the response. Each family's groups are in the quick-reference table at the top of its page.
Shared rules
Authentication and request body
Every endpoint uses Authorization: Bearer sk-your-key. The Base URL is https://api.hop-base.com/v1. The whole request body is capped at 60 MB; larger bodies return 413.
Gemini image generation also uses the OpenAI Images structure. Do not send a Gemini-native generateContent payload; HopBase adapts the request for the selected model.
Sync and async
| Mode | Families | Get the result |
|---|---|---|
| Sync (default) | GPT Image, Gemini, Seedream, Grok | data[] in the response body |
Async (add Prefer: respond-async) | GPT Image, Gemini | GET /v1/images/tasks?task_id=… |
| Always async | Kling, Midjourney | GET /v1/video/tasks/{task_id} |
Use async for 2K / 4K images so long requests are not cut off by CDN timeouts. Seedream ignores Prefer and returns synchronously.
Pass reference images
| Family | Field and shape |
|---|---|
| GPT Image | image on /v1/images/edits, or multipart image[] |
| Gemini | image / images on generations; Gemini (all models, incl. image) can also use edits |
| Seedream | image on generations; local files go through edits multipart |
| Grok Imagine | image or image[] on /v1/images/edits |
| Kling / Midjourney | images: [{"url": …}] or [{"file_id": …}] |
URLs must be reachable by the server — not a page that requires a browser login, and not an internal network address. A Data URL must be the complete encoding with a MIME type that matches the image, for example data:image/png;base64,iVBORw0KGgo….
asset:// is only for the Seedance 2.0 asset library and cannot be used with any image family.
Billing
Actual charge = official price × group multiplier; the console's Usage records page is authoritative. Invalid-parameter 400s return before generation and are not billed. Each family's billing unit is on its page.
Prices are on each model card and in the signed-in model catalog.
Next steps
- Parameters and responses by family: GPT Image, Gemini image generation, Seedream, Grok Imagine images, Kling images, Midjourney
- Full parameter tables are in the API reference: Create image and Edit image
- For video generation, see Video API
- When something fails, check Troubleshooting