Skip to main content
stability-ai avatar

Stable Diffusion 3.5 Medium API

stability-ai/stable-diffusion-v3.5-medium

Generate high-quality images from a text prompt with a fast, low-cost 2.5B model tuned for prompt adherence and typography.

0.02 per megapixel of image

Model Input

Input

The text prompt describing the image to generate.

The size of the generated image. Choose a preset (e.g. 'square_hd', 'portrait_16_9') or pass a custom {width, height} object.

Min: 1 - Max: 50

The number of inference steps to perform. More steps can improve detail at the cost of speed.

Additional Settings

Customize your input with more control.

Min: 0 - Max: 20

The CFG (Classifier Free Guidance) scale. Higher values increase adherence to the prompt.

Describe what you do NOT want to appear in the image.

The same seed and the same prompt given to the same version of the model will output the same image every time.

The format of the generated image.

Safety checker can only be disabled on API call

Automatically resize incompatible custom dimensions to the nearest supported size.

You need to be logged in to run this model and view results.
Log in

Model Output

Output

Generated image output
Generated in 4.064 seconds
Logs (1 lines)

Model Example Requests

Examples

Example output 1Example output 2Example output 3Example output 4

Stable Diffusion 3.5 Medium API

Stable Diffusion 3.5 Medium is a text-to-image AI model by stability-ai. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at $0.02 per megapixel.

POST https://queue.modelrunner.run/stability-ai/stable-diffusion-v3.5-medium

cURL

# Submit a request to the queue
curl -X POST https://queue.modelrunner.run/stability-ai/stable-diffusion-v3.5-medium \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "prompt": "a cozy Scandinavian reading nook at golden hour, soft window light, plants, warm wood tones, photorealistic",
      "auto_fix": true,
      "image_size": "landscape_4_3",
      "output_format": "jpeg",
      "guidance_scale": 4.5,
      "negative_prompt": "",
      "num_inference_steps": 40,
      "enable_safety_checker": true
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/stability-ai/stable-diffusion-v3.5-medium/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/stability-ai/stable-diffusion-v3.5-medium/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("stability-ai/stable-diffusion-v3.5-medium", {
  input: {
    "prompt": "a cozy Scandinavian reading nook at golden hour, soft window light, plants, warm wood tones, photorealistic",
    "auto_fix": true,
    "image_size": "landscape_4_3",
    "output_format": "jpeg",
    "guidance_scale": 4.5,
    "negative_prompt": "",
    "num_inference_steps": 40,
    "enable_safety_checker": true
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/stability-ai/stable-diffusion-v3.5-medium",
    headers=headers,
    json={"input": {
      "prompt": "a cozy Scandinavian reading nook at golden hour, soft window light, plants, warm wood tones, photorealistic",
      "auto_fix": true,
      "image_size": "landscape_4_3",
      "output_format": "jpeg",
      "guidance_scale": 4.5,
      "negative_prompt": "",
      "num_inference_steps": 40,
      "enable_safety_checker": true
    }},
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

NameTypeRequiredDescription
promptstringyesThe text prompt describing the image to generate.
image_sizeenumnoThe size of the generated image. Choose a preset (e.g. 'square_hd', 'portrait_16_9') or pass a custom {width, height} object. Default: "landscape_4_3".
num_inference_stepsintegernoThe number of inference steps to perform. More steps can improve detail at the cost of speed. Default: 40.
guidance_scalenumbernoThe CFG (Classifier Free Guidance) scale. Higher values increase adherence to the prompt. Default: 4.5.
negative_promptstringnoDescribe what you do NOT want to appear in the image. Default: "".
seedintegernoThe same seed and the same prompt given to the same version of the model will output the same image every time.
output_formatenumnoThe format of the generated image. Default: "jpeg".
enable_safety_checkerbooleannoIf set to true, the safety checker will be enabled. Default: true.
auto_fixbooleannoAutomatically resize incompatible custom dimensions to the nearest supported size. Default: true.

Machine-readable: OpenAPI schema · llms.txt

Use Stable Diffusion 3.5 Medium from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and Stable Diffusion 3.5 Medium becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint stability-ai/stable-diffusion-v3.5-medium.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run stability-ai/stable-diffusion-v3.5-medium on ModelRunner to generate image”. MCP setup guide.

Model Details

Model Details

Stable Diffusion 3.5 Medium turns a text prompt into a high-quality image. It is Stability AI's efficient 2.5-billion-parameter Multimodal Diffusion Transformer (MMDiT-X), a smaller and faster sibling of the 8B Large model, tuned to run well on standard consumer hardware while keeping strong prompt understanding, accurate typography, and diverse visual styles from photorealism to illustration. Give it a descriptive prompt and pick an image size; it returns one generated image. Its standout strengths are speed and cost-efficiency at a low per-megapixel price, making it a strong default for high-volume or budget-sensitive text-to-image work.

## Best for - Fast, low-cost image generation at scale from a text description - Photorealistic scenes and portraits from a detailed prompt - Rendering legible text, signage, and typography inside an image - Concept art, illustration, and stylized renders across many aesthetics - Marketing visuals, product mockups, and social imagery from a prompt

## Choose another model when - You need the highest fidelity or the most complex multi-subject prompt adherence — use the 8-billion-parameter Stable Diffusion 3.5 Large - You want to edit, restyle, or inpaint an existing image rather than generate from scratch — use an image-editing model - You need to enlarge or add detail to an existing image — use an upscaling model - You need a video or animation — use a text-to-video model

## Tips - Be specific about subject, setting, lighting, and style; SD 3.5 Medium rewards detailed prompts - Raise `guidance_scale` (default 4.5) toward 5-7 for tighter prompt adherence; lower it for more creative latitude - Use `negative_prompt` to exclude unwanted elements (e.g. "blurry, extra fingers, watermark") - Set `image_size` to a preset ("square_hd", "portrait_16_9", "landscape_4_3", …) or pass a custom `{ width, height }` object - Leave `auto_fix` on (default) so custom `{ width, height }` dimensions are rounded to the nearest supported size instead of erroring

To run via the ModelRunner JavaScript client: ```js import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("stability-ai/stable-diffusion-v3.5-medium", { input: { prompt: "a serene mountain lake at golden hour, mist over the water, photorealistic", image_size: "landscape_4_3", num_inference_steps: 40, guidance_scale: 4.5, }, }); ```