API reference

Two calls. One API key.

Same workspace API key for all three. Send x-model as genaiimg-v1, genaiimg-v2, or genaiimg-v3. Each call spends 1 credit from that model’s pack, not from the others. Check credits reads all balances and spends nothing.

Auth

Create a key in API keys, then send it on every request. Credits always belong to that workspace.

Base URL

https://www.genaiimg.com

API key

Authorization: Bearer gai_YOUR_KEY

Model header

x-model: genaiimg-v1

Or send x-api-key. Use x-model: genaiimg-v2 or x-model: genaiimg-v3 for those models.

1 · Generate image

POST

/api/v1/image

Send the source image, a prompt, and x-model. v1 uses Meta image edit. v2 uses OpenAI image edit. v3 uses Gemini image edit. 1 credit is taken from that model’s balance only if generate succeeds.

x-modelrequired
genaiimg-v1, genaiimg-v2, or genaiimg-v3. Required on every generate call.
imagerequired
URL, data URL, or raw base64. image_url also works.
promptrequired
Required string in the JSON body.
sizerequired
Required for genaiimg-v2 and genaiimg-v3. WIDTHxHEIGHT, e.g. 944x816. On v3 the long side picks 1K or 2K. Over 1536px uses 2K.
aspectRatiorequired
Required for genaiimg-v3 only. e.g. 5:4, 16:9, 1:1. aspect_ratio also works.
x-user-email
Optional header for Activity only. Does not change whose credits are spent.
v1 credits
Deducted only when x-model is genaiimg-v1.
v2 credits
Deducted only when x-model is genaiimg-v2.
v3 credits
Deducted only when x-model is genaiimg-v3.

curl · genaiimg-v1

curl -X POST "https://www.genaiimg.com/api/v1/image" \
  -H "Authorization: Bearer gai_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "x-model: genaiimg-v1" \
  -H "x-user-email: artist@client.com" \
  -d "{\"image\":\"https://example.com/source.png\",\"prompt\":\"your prompt here\"}"

curl · genaiimg-v2

curl -X POST "https://www.genaiimg.com/api/v1/image" \
  -H "Authorization: Bearer gai_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "x-model: genaiimg-v2" \
  -H "x-user-email: artist@client.com" \
  -d "{\"image\":\"https://example.com/source.png\",\"prompt\":\"your prompt here\",\"size\":\"944x816\"}"

curl · genaiimg-v3

curl -X POST "https://www.genaiimg.com/api/v1/image" \
  -H "Authorization: Bearer gai_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "x-model: genaiimg-v3" \
  -H "x-user-email: artist@client.com" \
  -d "{\"image\":\"https://example.com/source.png\",\"prompt\":\"your prompt here\",\"aspectRatio\":\"5:4\",\"size\":\"1152x928\"}"

Success · 200

x-credits-remaining: 35
x-model: genaiimg-v3

{ "data": [{ "b64_json": "..." }] }

2 · Check credits

GET

/api/v1/credits

Returns v1, v2, and v3 balances for this API key. Optional x-model also returns that model’s remaining count. Do not send a user email. This call spends nothing.

body
None. The API key is enough.
x-model
Optional. If sent, remaining is that model’s credits only.

curl

curl -X GET "https://www.genaiimg.com/api/v1/credits" \
  -H "Authorization: Bearer gai_YOUR_KEY"

Success · 200

{
  "ok": true,
  "credits": { "genaiimg-v1": 36, "genaiimg-v2": 0, "genaiimg-v3": 12 },
  "hasCredits": { "genaiimg-v1": true, "genaiimg-v2": false, "genaiimg-v3": true }
}

Errors

401Missing or invalid API key.
400Missing x-model, image, or prompt.
402That model has 0 credits. Buy that model’s pack, then retry.