Developers
API reference
Everything to call any model from your code. New here? Start with the API overview.
One API for AI image and video generation. Every model (realism, anime, video) is served by the same endpoints; the media kind and the price come from the model you pick. Two ways to pay:
X-PAYMENT header.
Base URL: https://imference.com · Try it live in the
Credits or
x402 playground.
Quickstart: Credits
- Buy credits. Your API key is created with the first purchase.
- POST
/generatewith your model + prompt (Bearer auth). - Poll GET
/status?request_id=…until it returns your media URL.
curl -X POST 'https://imference.com/generate' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"model": "illustrious-hassuka-xl", "prompt": "A cat astronaut floating in space"}'
# → {"request_id": "abc-123", "kind": "image"}
curl 'https://imference.com/status?request_id=abc-123' \
-H 'Authorization: Bearer YOUR_API_KEY'
# 404 while running · 422 if failed · 200 with the media URL when done
Quickstart: x402
No account, no key: your wallet pays per call in USDC on Base. The first request answers
402 Payment Required with the price; your x402 client signs an
EIP-3009 authorization and retries automatically. Use an
x402 client library
or try the playground.
import { wrapFetchWithPayment } from "x402-fetch";
const fetchWithPay = wrapFetchWithPayment(fetch, walletClient); // your viem wallet
const res = await fetchWithPay("https://imference.com/ondemand/generate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model: "illustrious-hassuka-xl", prompt: "A cat astronaut" }),
});
const { request_id } = await res.json();
// then poll GET /ondemand/status?request_id=… (no auth needed)
Authentication & payment
Credits rail
Every request carries Authorization: Bearer YOUR_API_KEY. The per-model
cost in credits (im_cost) is debited at enqueue.
x402 rail
No auth header. Payment is proven by the signed X-PAYMENT header
(EIP-3009 USDC authorization). Price is dynamic per model: im_cost credits × $0.001.
/generate
/ondemand/generate
Generate an image or a video. One endpoint for every model. The media kind and the price come from
the model; the response echoes both. Returns a request_id for status polling.
curl -X POST 'https://imference.com/generate' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "illustrious-hassuka-xl",
"prompt": "A cat astronaut floating in space",
"width": 1024, "height": 1024,
"steps": 28, "guidance_scale": 6
}'
# A bare request returns 402 with the payment requirements (price in USDC).
# Use an x402 client to sign the X-PAYMENT header automatically:
curl -X POST 'https://imference.com/ondemand/generate' \
-H 'Content-Type: application/json' \
-d '{
"model": "illustrious-hassuka-xl",
"prompt": "A cat astronaut floating in space"
}'
Request body
model(required): model code from GET /api/modelsprompt(required): text description- every other field depends on the model, see Parameters per model below. Anything you omit falls back to that model's catalog default; anything it doesn't accept is refused with a
400.
Response
{"request_id": "abc-123", "kind": "image"}
kind is "image" or "video". Video generations take minutes; size your polling accordingly.
Parameters per model
Models don't take the same parameters: an SDXL checkpoint has CFG and CLIP-skip, MiniMax-H3 has neither but
takes a clip duration, WAN runs at exactly 6 steps. The table below comes from
GET /api/models, the same list the API validates against, so it cannot
go out of date. A parameter that isn't listed for a model is refused with a 400.
| Parameter | Type | Default | Accepted | Notes |
|---|---|---|---|---|
prompt required | string | · | · | What to generate. |
negative_prompt | string | · | · | What to avoid. Defaults to the model's own negative prompt. |
steps | int | 30 | 15 to 40 | Denoising steps. |
guidance_scale | float | 4 | 1 to 8 | Prompt adherence (CFG). |
scheduler | string | · | · | Sampler. Defaults to euler. |
img_url | string | · | · | Source image (https URL or data: URI): the model denoises from it (image-to-image). |
strength | float | 0.75 | 0.1 to 1 | img2img strength, with img_url: low keeps the source close, 1 ignores it. |
format_code | string | · | square, portrait, landscape, portrait-large, landscape-large, portrait-wide, landscape-wide, portrait-ultra-wide, landscape-utra-wide | Output format. See /api/formats for each one's resolution and price multiplier. |
loras | array | · | to 4 | Up to 4 curated LoRAs: [{code, weight}]. Codes, weight bounds and defaults: GET /api/loras?model=anima-aesthetic. An omitted weight takes the LoRA's default. |
seed | int | · | · | Reproducibility. Omit for a random seed. |
batch_nbr | int | 1 | 1 to 4 | Images per request. Each one is billed. |
LoRAs
LoRAs are small add-ons that steer a model toward a style, a character, a concept or more detail. Imference
serves a curated catalog: each LoRA is reviewed, hosted on our CDN and pre-configured (default strength and
its bounds, trigger words). Stack up to 4 on a generation with the loras
field. Same price as the generation without them.
curl -X POST 'https://imference.com/generate' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "cyberrealistic-xl",
"prompt": "Portrait of a cyborg with gold filigree, soft sidelighting",
"loras": [{"code": "detail-tweaker-xl", "weight": 1.5}]
}'
Rules
- Only models whose
parameterslistlorastake them (SDXL, Pony, Illustrious, Z-Image, Krea 2 and Anima models today). - A LoRA goes on a model when the model's
model_family_codeis in the LoRA'scompatible_family_codes(an SDXL LoRA may also fit Pony or Illustrious models). weightis optional: omitted, the LoRA'sweight_defaultapplies; otherwise it must sit within[weight_min, weight_max]. Negative weights are valid on LoRAs that allow them (sliders, detail tweakers).- If a LoRA lists
trigger_words, put them in your prompt. Whentext_encoder_trainedisfalsethey are optional. - An unknown, incompatible or out-of-range LoRA is refused with a
400before anything is charged (x402: before the payment challenge).
Catalog
Public, no auth. GET /api/loras lists every LoRA;
?model=<model_code> keeps the ones that go on that model
(unknown model: 404). Each entry also carries a direct lora_url and its
sha256, used by Imference Desktop to run them locally.
curl 'https://imference.com/api/loras?model=cyberrealistic-xl'
# → {"loras": [{"lora_code": "detail-tweaker-xl", "compatible_family_codes": ["illustrious", "pony", "sdxl"],
# "weight_default": 1.5, "weight_min": -3, "weight_max": 3, "trigger_words": [], …}]}
| Code | Name | Goes on | Weight (default · range) | Trigger words |
|---|---|---|---|---|
2000s-analog-core-zimage | 2000s Analog Core Early-2000s Camcorder Look | zimage | 0.9 · 0 to 1.5 | · |
add-micro-details-concept-krea2 | Add Micro Details - Concept Crisp Micro Details | krea2 | 0.25 · 0 to 1.5 | · |
aesthetic-quality-modifiers-masterpiece-krea2 | Aesthetic Quality Modifiers - Masterpiece Masterpiece Aesthetic Boost | krea2 | 0.8 · 0 to 1.5 | masterpiece, very aesthetic |
anime-flat-style-anima | Anime Flat Style Anime Flat-Color Style | anima | 0.8 · 0 to 1.5 | · |
anime-flat-style-krea2 | Anime Flat Style Bold Anime Flat Colors | krea2 | 0.8 · 0 to 1.5 | · |
anime-flat-style-zimage | Anime Flat Style Flat-Color Anime Style | zimage | 0.8 · 0 to 1.5 | · |
anime-in-real-anima | Anime in real Anime in Real Backgrounds | anima | 0.8 · 0 to 1.5 | @Ani3rel |
cat-citron-styles-illustrious | CAT - Citron Styles Citron Bold Toon-Gloss Style | illustrious | 1 · 0 to 1.5 | bokeh, luminescent background, |
dark-art-style-anima | Dark Art Style Dark Art Anime Look | anima | 1 · 0.7 to 1.2 | dark_art_style |
dark-art-style-illustrious | Dark Art Style Cinematic Dark Fantasy Style | illustrious | 1 · 0.7 to 1.2 | dark_art_style |
dark-art-style-krea2 | Dark Art Style Cinematic Dark-Fantasy Look | krea2 | 1 · 0.7 to 1.2 | dark_art_style |
dark-art-style-zimage | Dark Art Style Cinematic Dark Art Style | zimage | 1 · 0.7 to 1.2 | dark_art_style |
dc-vivid-dark-fantasy-painting-zimage | DC Vivid Dark Fantasy Painting Vivid Dark Fantasy Painting | zimage | 0.8 · 0.6 to 1 | dcdrkfntsy. |
detail-tweaker-anima | Detail Tweaker Detail Tweaker for Anima | anima | 0.8 · -0.75 to 0.8 | · |
detail-tweaker-xl | Detail Tweaker XL Adjustable Detail for SDXL | illustrious, pony, sdxl | 1.5 · -3 to 3 | · |
expressiveh-hentai-lora-style | ExpressiveH ExpressiveH: Glossy Anime Vibe | pony | 0.8 · 0 to 1.5 | Expressiveh |
lenovo-ultrareal-krea2 | Lenovo UltraReal Ultra-Real Phone Camera Vibe | krea2 | 0.6 · 0 to 1.5 | · |
moriimee-gothic-niji-lora-style | MoriiMee Gothic Niji LoRA Style MoriiMee Gothic Niji Style | illustrious | 0.9 · 0 to 1.5 | · |
moriimee-gothic-niji-lora-style-krea2 | MoriiMee Gothic Niji LoRA Style Gothic Jirai Kei Gloss & Cyan | krea2 | 0.8 · 0 to 1.5 | · |
moriimee-gothic-niji-lora-style-zimage | MoriiMee Gothic Niji LoRA Style MoriiMee Gothic Niji Look | zimage | 0.8 · 0 to 1.5 | · |
nsfw-v4-krea2 | NSFW V4 Realistic Skin for Adult Scenes | krea2 | 1.25 · 0.8 to 2 | · |
realistic-snapshot-krea2 | Realistic Snapshot Phone-Camera Realism, Candid Vibe | krea2 | 1.5 · 0 to 2 | · |
retro-sci-fi-90s-anime-style-anima | Retro Sci-fi 90's anime style Retro 90s Sci-Fi Anime Look | anima | 0.8 · 0.6 to 1.2 | retro_scifi_90s_anime_style, retro_artstyle, retro, |
retro-sci-fi-90s-anime-style-illustrious | Retro Sci-fi 90's anime style Retro 90s Anime Sci-Fi Style | illustrious | 0.8 · 0 to 1.5 | retro_artstyle, retro, cyberpunk |
retro-sci-fi-90s-anime-style-krea2 | Retro Sci-fi 90's anime style 90s Retro Sci-Fi Anime Style | krea2 | 0.8 · 0.6 to 1.2 | retro_scifi_90s, retro_artstyle, retro, cyberpunk |
retro-sci-fi-90s-anime-style-zimage | Retro Sci-fi 90's anime style 90s Retro Sci-Fi Anime Style | zimage | 0.8 · 0.6 to 1.2 | retro_scifi_90s, retro_artstyle, retro, cyberpunk, |
velvets-mythic-fantasy-styles-anima | Velvet's Mythic Fantasy Styles Epic Inked Anime Style | anima | 1 · 0.5 to 1.5 | Smo0thL1nes |
velvets-mythic-fantasy-styles-flux-pony-illustri | Velvet's Mythic Fantasy Styles illustrious Mythic Fantasy Anime Glow | illustrious | 1 · 0.5 to 1.5 | C0lorL1nes |
Video generation
Same endpoint: pick a video model and it generates a video. No img_url → text-to-video;
with img_url → image-to-video. The price adjusts to the model automatically.
curl -X POST 'https://imference.com/generate' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "wan22-video",
"prompt": "A fox running through a snowy forest",
"num_frames": 81, "fps": 20
}'
# → {"request_id": "…", "kind": "video"}, poll /status; expect minutes, not seconds
/status?request_id=…
/ondemand/status?request_id=…
Check a generation. The polling contract is explicit:
| HTTP | Meaning | What to do |
|---|---|---|
| 404 | Still running | Keep polling (1s is fine; videos run minutes) |
| 422 | Generation failed | Stop polling: error carries the reason |
| 200 | Done | Download data.URL |
curl 'https://imference.com/status?request_id=YOUR_REQUEST_ID' \
-H 'Authorization: Bearer YOUR_API_KEY'
curl 'https://imference.com/ondemand/status?request_id=YOUR_REQUEST_ID'
# no auth needed: the request_id is the capability
/media/all
Credits rail only
All media (images and videos) generated with your API key, newest first. Each row carries a Kind field.
curl 'https://imference.com/media/all' \
-H 'Authorization: Bearer YOUR_API_KEY'
/credits/balance
Credits rail only
Your remaining credit balance.
curl 'https://imference.com/credits/balance' \
-H 'Authorization: Bearer YOUR_API_KEY'
# → {"credits": 1250}
/ondemand/credits/add
x402 payment
Prepay API-key credits with one on-chain USDC payment. The x402 price is exactly
credits × $0.001. Saves the per-call network fee when you
generate a lot. Min 100, max 1,000,000 credits per call. An empty
api_key creates a fresh key and returns it. Or use the
pricing page UI.
const res = await fetchWithPay("https://imference.com/ondemand/credits/add", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ credits: 5000, api_key: "" }), // "" → new key
});
// → {"api_key": "…", "credits_added": 5000}
Models & formats
Public, no auth. GET /api/models lists every model with its defaults,
the parameters it accepts (parameters, see below)
and its base cost. GET /api/formats lists each model's supported
resolutions, so you never hardcode sizes.
A run costs ceil(im_cost × credit_multiplier × duration_multiplier × batch_nbr) credits, with a
floor of 1 (1 credit = $0.001; the x402 price is the same amount in USDC).
credit_multiplier comes from the chosen format (an HD format typically bills ×2) and
duration_multiplier is the requested clip length over the model's default duration, so a 10 s
clip on a model defaulting to 5 s costs twice as much. The rounding is applied once, to the whole product.
curl 'https://imference.com/api/models'
curl 'https://imference.com/api/formats'
Errors
Standard HTTP codes; error bodies are {"error": "…"}.
| Status | Meaning | Common cause |
|---|---|---|
| 400 | Bad request | Missing/invalid fields, insufficient credits, unknown or incompatible LoRA |
| 401 | Unauthorized | Missing or unknown API key (credits rail) |
| 402 | Payment required | x402: no valid payment; the body lists the requirements to sign |
| 404 | Not found | Unknown model/endpoint/request_id, or generation still running (keep polling) |
| 422 | Generation failed | Worker error: stop polling, the reason is in error |
| 429 | Too many requests | Rate limit exceeded (50 req/min) |
| 500 | Server error | Retry, or contact support |
Rate limits & terms
50 requests per minute per API key (credits) or wallet address (x402). Exceeding it returns 429.
See the Terms of Service.