Skip to content

Images overview

Generate and edit images with the OpenAI Images-compatible API.

PurposeEndpoint
Base URLhttps://api.hop-base.com/v1
Generate imagesPOST /v1/images/generations
Edit imagesPOST /v1/images/edits
Query async tasksGET /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.png

The 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.

FamilyHighlightsCalling modeReference image limitOfficial price (representative model)
GPT ImageSupports mask-based local edits; billed by tokenSync; async optional16 (official)$5 / $30/ 1M tokens
Gemini image generation1K–4K tiers, any aspect ratio as WIDTHxHEIGHTSync; async optional14 (official)$0.1344from/ image
SeedreamReturns a URL valid for 24 hours, or b64_jsonSync; Lite / 4.5 can stream14$0.045from/ image
Grok Imagine imagesDoes not use size; returns a temporary URLSync only2$0.02/ image
Kling imagesSeveral models, including outpainting and multiple referencesAsync0–10, by model$0.0294/ image
MidjourneyAlways 4 images per requestAsync1$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

ModeFamiliesGet the result
Sync (default)GPT Image, Gemini, Seedream, Grokdata[] in the response body
Async (add Prefer: respond-async)GPT Image, GeminiGET /v1/images/tasks?task_id=…
Always asyncKling, MidjourneyGET /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

FamilyField and shape
GPT Imageimage on /v1/images/edits, or multipart image[]
Geminiimage / images on generations; Gemini (all models, incl. image) can also use edits
Seedreamimage on generations; local files go through edits multipart
Grok Imagineimage or image[] on /v1/images/edits
Kling / Midjourneyimages: [{"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