Skip to content

Image Generation

POST https://api.studiolm.dev/v1/images/generations

Quick example

import studiolm
client = studiolm.Client(api_key="sk-...")

image = client.generate(
    "A serene mountain lake at dawn, cinematic lighting",
    style="vivid",
    size="1024x1024",
)
image.save("output.png")
curl https://api.studiolm.dev/v1/images/generations \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A serene mountain lake at dawn, cinematic lighting",
    "style": "vivid",
    "aspect_ratio": "square",
    "response_format": "url"
  }'

Parameters

Parameter Type Default Description
prompt string required Text description of the image
style string "vivid" vivid, natural, preview, upscaled
aspect_ratio string "square" square, portrait, landscape
response_format string or array "url" "url", "b64_json", "hxd", or a list
user_selected_model string auto Display name of the model to use
negative_prompt string Elements to avoid
seed integer random Set for reproducible results
disable_safety_checker boolean false Requires special account permission
force_prompt_enhancement boolean false Always enhance prompt via LLM

Image dimensions by aspect ratio

aspect_ratio Output size
square 1024 × 1024
portrait 832 × 1216
landscape 1216 × 832

Response

{
  "created": 1677858242,
  "data": [{"url": "https://api.studiolm.dev/v1/images/view/abc123"}]
}

Image-to-image parameters

Parameter Type Default Description
reference_image_url string URL of the reference image
reference_image string Base64-encoded image (data:image/png;base64,...)
denoising_strength number 0.75 How much output differs from reference (0–1)
image = client.generate(
    "Transform into oil painting style",
    reference_image_url="https://example.com/photo.jpg",
    denoising_strength=0.6,
)
image.save("painting.png")
curl https://api.studiolm.dev/v1/images/generations \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Transform into oil painting style",
    "reference_image_url": "https://example.com/photo.jpg",
    "denoising_strength": 0.6,
    "aspect_ratio": "square"
  }'

Available models

GET https://api.studiolm.dev/v1/images/available-models

Returns a list of image models with display names and descriptions. Pass the display_name as user_selected_model to pin a specific model, or omit it to let the server choose.

for m in client.images.available_models():
    print(m["display_name"], "–", m["description"])

Also visible via GET /v1/models — image models have "type": "image".