Image Generation
AI Photos (LoRA)
Generate images from a LoRA you trained with /v2/loras.
POST /v2/images/generate — model: "flux-lora"
Once you've trained a LoRA via POST /v2/loras, pass its id here to generate AI photos of that subject from any text prompt. The API generates a unique trigger word per LoRA and exposes it on the READY LoRA object so you can pre-fill it into your prompt; if your prompt already contains the trigger word it's used as-is, otherwise it's auto-prepended. Either way, the trained subject shows up.
Model-specific parameters
| Parameter | Type | Description |
|---|---|---|
fluxLoraParams.loraId | string (uuid) | Required. The id returned by POST /v2/loras. The LoRA must be in READY status and belong to your team. |
fluxLoraParams.num_outputs | integer | Number of images to generate (1–4, default 1). |
fluxLoraParams.aspect_ratio | string | One of 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3. |
fluxLoraParams.output_format | string | png, jpg, or webp. |
fluxLoraParams.lora_strength | number | How much weight to give the trained LoRA (0–1.5, default 1.0). Lower for more prompt freedom, higher to lock onto the subject. |
fluxLoraParams.guidance_scale | number | Classifier-free guidance scale (1–10, default 3.5). |
fluxLoraParams.num_inference_steps | integer | Diffusion steps (4–50, default 28). |
fluxLoraParams.seed | integer | Reproducibility seed. |
Credit cost
2 credits per output image. A request with num_outputs: 4 therefore costs 8 credits.
Example
curl -X POST https://api.apiframe.ai/v2/images/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-lora",
"prompt": "a cinematic black-and-white portrait, dramatic side lighting, 50mm lens",
"fluxLoraParams": {
"loraId": "8a4d2c14-...-...-...-...",
"num_outputs": 2,
"aspect_ratio": "3:4"
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/images/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"model": "flux-lora",
"prompt": "a cinematic black-and-white portrait, dramatic side lighting, 50mm lens",
"fluxLoraParams": {
"loraId": "8a4d2c14-...-...-...-...",
"num_outputs": 2,
"aspect_ratio": "3:4",
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "flux-lora",
prompt: "a cinematic black-and-white portrait, dramatic side lighting, 50mm lens",
fluxLoraParams: {
loraId: "8a4d2c14-...-...-...-...",
num_outputs: 2,
aspect_ratio: "3:4",
},
}),
});
console.log(await response.json());Prompt tips
- Don't mention the subject by name — the trigger word handles that. Just describe the scene, lighting, mood, and camera.
- Vary the photo type — portrait, full-body, candid, studio. The LoRA generalizes across compositions.
- Lower
lora_strength(e.g. 0.7) if the subject feels too rigid; raise it (e.g. 1.2) to lock onto the trained look.