Image GenerationStable Diffusion
Stable Diffusion 3.5 Medium
A smaller, efficient SD 3.5 model balancing quality and speed.
POST /v2/images/generate — model: "stable-diffusion-3.5-medium"
A 2.5-billion-parameter Stable Diffusion 3.5 model that balances quality, speed, and resource efficiency. A great default for high-volume generation. Supports image-to-image via the image parameter.
See Image Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Description |
|---|---|---|
stableDiffusionParams.aspect_ratio | string | Output aspect ratio. Values: "1:1", "16:9", "21:9", "3:2", "2:3", "4:5", "5:4", "9:16", "9:21". Ignored when image is set |
stableDiffusionParams.cfg | number | Guidance scale (0–20). How strictly to follow the prompt. Default 3.5 |
stableDiffusionParams.steps | integer | Number of sampling steps (1–40). Default 28 |
stableDiffusionParams.seed | integer | Random seed for reproducible generation |
stableDiffusionParams.negative_prompt | string | What you do NOT want to see in the image |
stableDiffusionParams.image | string | Input image URL for image-to-image mode. Output aspect ratio matches this image |
stableDiffusionParams.prompt_strength | number | Denoising strength for image-to-image (0–1). 1.0 fully replaces the input image. Default 0.85 |
stableDiffusionParams.output_format | string | Output image format. Values: "webp", "jpg", "png". Default "webp" |
stableDiffusionParams.output_quality | integer | Output quality for lossy formats (0–100). Default 90 |
Credit cost
| Credits per generation |
|---|
| 7 |
Example result
Once the job is COMPLETED, the result object on GET /v2/jobs/:id looks like:
{
"images": [
"https://cdn2.apiframe.ai/images/a1b2c3d4-e5f6-7890-abcd-ef1234567890-1.png"
]
}See Result format for field details.
Code examples
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 '{
"prompt": "A cozy reading nook with warm afternoon light",
"model": "stable-diffusion-3.5-medium",
"stableDiffusionParams": {
"aspect_ratio": "3:2",
"cfg": 3.5,
"steps": 28
}
}'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={
"prompt": "A cozy reading nook with warm afternoon light",
"model": "stable-diffusion-3.5-medium",
"stableDiffusionParams": {
"aspect_ratio": "3:2",
"cfg": 3.5,
"steps": 28,
},
},
)
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({
prompt: "A cozy reading nook with warm afternoon light",
model: "stable-diffusion-3.5-medium",
stableDiffusionParams: { aspect_ratio: "3:2", cfg: 3.5, steps: 28 },
}),
});
console.log(await response.json());Try it
POST
/v2/images/generateTry it