API
Buat gambar dari kodemu sendiri dengan satu kunci.
Masuk untuk membuat kunci API kamu.
MasukMembuat sebuah gambar
Kirim deskripsi, dapatkan gambar.
# 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_kunci_kamu_di_sini" \
-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_kunci_kamu_di_sini"Berjalan pada alamat sungguhan dengan kunci di atas dan memakai satu kredit — panggilan yang sama dengan yang akan dilakukan kodemu.
Respons
// 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
}
// Kesalahan
// 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 kreditsamimage-maxSam Max1 kredit · Max
Gaya
realisticRealistisanimeAnime3d3DwatercolorCat airoilLukisan cat minyakpixelPixel artcyberpunkCyberpunkfantasyFantasiminimalMinimalissketchSketsa pensilcomicKomikcartoonKartunlineartSeni garislowpolyLow polyisometricIsometrikvaporwaveVaporwavesteampunkSteampunknoirNoirpopartPop artimpressionistImpresionissurrealSurealisneonNeonclayTanah liatpapercutPotongan kertaseditSunting
Format
1:1Persegi16:9Lebar9:16Tegak4:3Standar
Ukuran
1K1024×10242K2048×2048
Kolom
promptstring · 5000style25 × string · opsionalaspect1:1 | 16:9 | 9:16 | 4:3 · opsionalresolution1K | 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
Kesalahan
- 401
unauthorizedKuncinya tidak ada atau sudah tidak berlaku. - 401
browser-keyKunci ini punya daftar situs yang diizinkan, jadi tempatnya di kode sematan. Panggilan dari server butuh kunci tanpa daftar situs. - 429
too-many-requests · 30/60sTerlalu banyak percobaan. Tunggu beberapa menit. - 200
no-creditsKreditmu habis. Berlangganan atau beli kredit untuk terus berkarya. - 200
no-promptJelaskan dulu apa yang ingin kamu buat. - 200
not-configuredPembuatan gambar tidak tersedia saat ini. - 200
generation-failedPembuatan itu gagal. Silakan coba lagi. - 200
image-too-largeGambar itu terlalu besar. Pakai yang di bawah 8 MB. - 200
not-allowedPembuatan gambar dinonaktifkan untuk akun ini. Hubungi dukungan. - 200
storage-failedGambarnya sudah dibuat tapi tidak bisa disimpan. Ini kesalahan kami — tolong beri tahu dukungan. - 200
no-source-imagePilih dulu gambar yang mau disunting. - 200
busyTerlalu banyak permintaan sekaligus. Kreditmu aman — coba lagi sebentar. - 200
blockedDeskripsi ini melanggar kebijakan Penggunaan yang Wajar dan tidak dikirim. Tidak ada kredit yang terpakai. - 200
email-unverifiedKonfirmasi alamat emailmu sebelum membuat gambar. Buka halaman akunmu untuk mendapat tautan baru.