API
Generuj obrazy z własnego kodu za pomocą jednego klucza.
Zaloguj się, aby utworzyć klucz API.
Zaloguj sięWygeneruj obraz
Wyślij prompt, otrzymaj obraz.
# 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"Trafia do prawdziwego endpointu z kluczem powyżej i zużywa jeden kredyt — dokładnie to wywołanie, które wykona Twój kod.
Odpowiedź
// 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
}
// Błędy
// 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 kredytsamimage-maxSam Max1 kredyt · Max
Styl
realisticRealistycznyanimeAnime3d3DwatercolorAkwarelaoilOlejpixelPixel artcyberpunkCyberpunkfantasyFantasyminimalMinimalistycznysketchSzkic ołówkiemcomicKomikscartoonKreskówkalineartGrafika liniowalowpolyLow polyisometricIzometrycznyvaporwaveVaporwavesteampunkSteampunknoirNoirpopartPop artimpressionistImpresjonizmsurrealSurrealizmneonNeonclayPlastelinapapercutWycinankaeditEdycja
Format
1:1Kwadrat16:9Szeroki9:16Wysoki4:3Standardowy
Rozmiar
1K1024×10242K2048×2048
Pola
promptstring · 5000style25 × string · opcjonalneaspect1:1 | 16:9 | 9:16 | 4:3 · opcjonalneresolution1K | 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
Błędy
- 401
unauthorizedBrak klucza lub klucz stracił ważność. - 401
browser-keyTen klucz ma listę dozwolonych witryn, więc służy do osadzenia. Wywołania serwerowe wymagają klucza bez wymienionych witryn. - 429
too-many-requests · 30/60sZbyt wiele prób. Poczekaj kilka minut. - 200
no-creditsSkończyły Ci się kredyty. Wykup subskrypcję lub kredyty, aby kontynuować generowanie. - 200
no-promptNajpierw opisz, co chcesz wygenerować. - 200
not-configuredGenerowanie obrazów jest teraz niedostępne. - 200
generation-failedTo generowanie się nie powiodło. Spróbuj ponownie. - 200
image-too-largeTen obraz jest za duży. Użyj pliku poniżej 8 MB. - 200
not-allowedGenerowanie obrazów jest wyłączone dla tego konta. Skontaktuj się z pomocą. - 200
storage-failedObraz powstał, ale nie udało się go zapisać. To po naszej stronie — powiadom pomoc. - 200
no-source-imageNajpierw wybierz obraz do edycji. - 200
busyZbyt wiele żądań naraz. Twoje kredyty są bezpieczne — spróbuj za chwilę. - 200
blockedTen prompt narusza naszą politykę dopuszczalnego użytkowania i nie został wysłany. Nie zużyto żadnego kredytu. - 200
email-unverifiedPotwierdź swój adres e-mail przed generowaniem. Otwórz stronę konta, aby otrzymać nowy link.