API
Generate images from your own code with one key.
Sign in to create your API key.
Sign InGenerate an image
Send a prompt, get back an image.
# 1) Send the prompt. The endpoint does not wait for the image:
# it queues the job and answers 202 with an id.
curl https://samimagegenerator.com/api/v1/generate \
-H "Authorization: Bearer sig_your_key_here" \
-H "Content-Type: application/json" \
-d '{"prompt":"a red fox in the snow","style":"realistic","aspect":"1:1","resolution":"1K","count":1,"model":"samimage-mini"}'
# 2) Ask for the result every couple of seconds until status is no longer "pending".
# Generation takes 20-60s. Polling is safe to repeat: it never spends a credit.
curl "https://samimagegenerator.com/api/v1/generate?id=<ID>" \
-H "Authorization: Bearer sig_your_key_here"Runs against the real endpoint with the key above and spends one credit — the same call your code will make.
Response
// 1) POST — the job is accepted, nothing is generated yet (202)
{ "ok": true, "id": "…", "status": "pending" }
// 2) GET ?id=… — while the worker is on it (200)
{ "ok": true, "status": "pending" }
// 2) GET ?id=… — finished (200)
{
"ok": true,
"status": "done",
"generations": [
{ "id": "…", "model": "samimage-mini", "url": "https://samimagegenerator.com/api/generations/…/file" }
],
"refunded": 0,
// credits: null on an unlimited plan — there is no number to count down.
"credits": 96
}
// Errors
// The job failed: HTTP is still 200 — the poll itself worked, the generation did not.
{ "ok": false, "status": "error", "error": "no-credits" }
// generation-failed / storage-failed: the credit was spent and refunded,
// so the fresh balance comes back with the error.
{ "ok": false, "status": "error", "error": "generation-failed", "credits": 96 }
// Unknown or expired id (404). Jobs are kept for one day.
{ "ok": false, "error": "not-found" }Model
samimage-miniSam Mini1 creditsamimage-maxSam Max1 credit · Max
Style
realisticRealisticanimeAnime3d3DwatercolorWatercoloroilOil paintingpixelPixel artcyberpunkCyberpunkfantasyFantasyminimalMinimalsketchPencil sketchcomicComiccartoonCartoonlineartLine artlowpolyLow polyisometricIsometricvaporwaveVaporwavesteampunkSteampunknoirNoirpopartPop artimpressionistImpressionistsurrealSurrealneonNeonclayClaypapercutPaper cuteditEdit
Format
1:1Square16:9Wide9:16Tall4:3Standard
Size
1K1024×10242K2048×2048
Fields
promptstring · 5000style25 × string · optionalaspect1:1 | 16:9 | 9:16 | 4:3 · optionalresolution1K | 2Kcount1-1model2 × stringisPublicbooleanremoveBgbooleanenhancebooleancleanbooleanuseSeedbooleansourceImagedata URI · 8 MBmarkedImagedata URI · 8 MBmaskedbooleanregionsstring[] · 8 × 300langen | de | es | fr | it | nl | pl | sv | tr | pt | hi | id | ko | ja | arreferenceImages(url | data URI)[] · 4 × 8 MB
Errors
- 401
unauthorizedThe key is missing or no longer valid. - 401
browser-keyThis key has an allowed-site list, so it belongs in an embed. Server calls need a key with no sites listed. - 429
too-many-requests · 30/60sToo many tries. Please wait a few minutes. - 200
no-creditsYou are out of credits. Subscribe or buy credits to keep generating. - 200
no-promptDescribe what you want to generate first. - 200
not-configuredImage generation is not available right now. - 200
generation-failedThat generation failed. Please try again. - 200
image-too-largeThat image is too large. Use one under 8 MB. - 200
not-allowedImage generation is disabled for this account. Contact support. - 200
storage-failedThe image was created but could not be saved. This is on us — please tell support. - 200
no-source-imageChoose an image to edit first. - 200
busyToo many requests at once. Your credits are safe — try again in a moment. - 200
blockedThis prompt breaks our Acceptable Use policy and was not sent. No credit was used. - 200
email-unverifiedConfirm your email address before you generate. Open your account page to get a new link.