Leonardo AI started as a consumer image generation app, but it has grown into a platform developers can build on, with its own models, a style control system called Elements, and a REST API. If you want to know what the Leonardo AI API does, what it costs, and how to make your first image generation call, here is the full rundown.
What Is the Leonardo AI API
The Leonardo AI API gives you the same generation engine that powers the Leonardo web app, reachable over a REST interface. It is billed separately from any consumer app subscription you might have, on a pay-as-you-go basis. It is built for developers and no-code builders who want to generate images through code rather than through the web interface.
The API comes in two versions. The original v1 is the broader of the two and supports Alchemy rendering, PhotoReal, ControlNets, custom and fine-tuned models, and Leonardo's Elements system. The newer v2 uses a simpler request format and is where Leonardo's current flagship models and several third-party models live. Both are still active, so check which version a given model needs before you build against it.
Key Features and Models
Lucid Origin, Phoenix 1.0, and Lucid Realism
Leonardo's own models include Lucid Origin, its most versatile and prompt-responsive model and the usual default for general work, Phoenix 1.0, its first foundational model, built to follow prompts closely, and Lucid Realism, tuned toward photorealistic output. Leonardo also routes requests to a number of third-party models, including Flux, Nano Banana, Seedream, GPT Image, and Ideogram, so you can reach several image generation engines through one API key instead of integrating each one separately.
Elements and style control
Elements is Leonardo's system for keeping style and characters consistent, similar in spirit to LoRA fine-tuning, which is a way of baking a specific look into a model. You can use community Elements or your own to hold a consistent style across a batch of generations. The v2 endpoint takes the same idea further with a guidance system that lets you pass separate references for style, content, character, and image-to-image. For a broader look at how this kind of consistency works across models, see our guide on keeping AI-generated characters consistent across images.
Upscaling and editing tools
Beyond plain text-to-image, the API accepts image uploads for image-to-image work, and it offers Pro Upscaler in both precise and creative modes, unzoom, which pulls the frame back to reveal more of a scene, and Canvas editing operations. If editing is the main thing you need, our AI image editing API guide compares the options side by side. Leonardo has also added video, 3D, and audio generation, though those sit outside the core image API. Our AI video API guide covers that side in more detail.
Leonardo AI API Pricing
Leonardo bills the API as you go rather than by subscription. You load an account balance in dollars, and each generation draws down an amount based on the model and the settings you choose, such as resolution, number of images, and whether Alchemy is on. Leonardo does not publish a flat per-image rate for the API, because cost varies a lot by model and settings. Instead, the dashboard includes a pricing calculator so you can estimate cost before running a batch, and every generation response comes back with a cost breakdown so you can track spend as you go. For context on what other providers charge, see our breakdown of AI image API pricing in 2026.
New API accounts start with $5 in free credit so you can test before committing a budget, and the balance does not expire. If it runs down to zero, requests stop until you top up. Pay-as-you-go also supports up to 10 concurrent generations and includes access to remove.bg background removal. Budgeting takes a bit more attention than a flat subscription, but you only pay for what you actually generate.
How to Get API Access
- Create an account or log in at app.leonardo.ai.
- Open API Access in the left menu and add credit to your API balance. This is separate from any consumer web app plan you may already have.
- Click Create New Key and give it a name. You can also set an optional webhook URL, which is an address on your server where Leonardo sends the result automatically, so you do not have to keep asking whether the job is done.
- Send an
authorization: Bearer YOUR_API_KEYheader on every request.
There is no waitlist and no approval step. Sign-up is self-serve, and you can hold up to 10 API keys on one account.
Code Example: Your First Image Generation Call
Leonardo's generation endpoint runs the job in the background. You submit a prompt, get back a generation ID, then either ask for the result on a loop or let a webhook deliver it. Here is the loop approach in Python, using the v1 endpoint.
import time
import requests
API_KEY = "YOUR_LEONARDO_API_KEY"
BASE_URL = "https://cloud.leonardo.ai/api/rest/v1"
HEADERS = {
"accept": "application/json",
"authorization": f"Bearer {API_KEY}",
"content-type": "application/json",
}
payload = {
"prompt": "A serene watercolor painting of a mountain lake at sunrise",
"modelId": "YOUR_MODEL_ID", # fetch a valid model UUID from GET /platformModels first
"width": 1024,
"height": 768,
"num_images": 4,
"alchemy": True,
}
resp = requests.post(f"{BASE_URL}/generations", json=payload, headers=HEADERS)
resp.raise_for_status()
generation_id = resp.json()["sdGenerationJob"]["generationId"]
while True:
r = requests.get(f"{BASE_URL}/generations/{generation_id}", headers=HEADERS)
data = r.json()["generations_by_pk"]
if data["status"] in ("COMPLETE", "FAILED"):
break
time.sleep(3)
if data["status"] == "COMPLETE":
for img in data["generated_images"]:
print(img["url"])
else:
print("Generation failed")A quick note on the modelId field: on v1 it has to be a real model UUID, not a name. Call GET /platformModels first to see which models are currently available and what their IDs are, since the list changes as Leonardo adds models. The v2 endpoint works differently: it takes a model name such as lucid-origin or phoenix-v1.0 in a model field, with the rest of the settings nested under parameters.
Leonardo AI API vs Alternatives
Midjourney still has no official public API, so anyone calling Midjourney from code is relying on an unofficial wrapper, which requires a paid subscription and sits outside Midjourney's terms of service. That makes Leonardo the more straightforward choice when you need a supported, documented API. Our complete Midjourney prompt guide covers the consumer app workflow if that is the route you would rather take, and our roundup of the best Midjourney API alternatives looks at what teams use instead.
Stability AI and Black Forest Labs, the team behind Flux, both publish clear credit-based per-image rates, which makes cost easier to predict than Leonardo's calculator. Our Stable Diffusion API guide walks through that pricing in detail. What Leonardo gives you in return is a wider set of models behind a single key, since it bundles its own models alongside Flux, Nano Banana, Seedream, and others, plus a more developed toolkit for style consistency through Elements. If you want Leonardo's models next to entirely different vendors such as Kling or Runway for video without wiring up separate integrations, a unified API like Apiframe is worth a look, since it puts several image and video models behind one key.
FAQ
Is there a free Leonardo AI API tier?
New API accounts get $5 in free starter credit to test with, but there is no ongoing free tier for production use. Once that credit runs out, you need to fund your balance to keep generating. Our guide to what is actually free in AI image generation APIs covers which providers give you more to work with.
How is Leonardo AI API pricing calculated?
It is pay-as-you-go, drawn from your account balance. The cost of a generation depends on the model, resolution, number of images, and features such as Alchemy. Leonardo gives you a pricing calculator and returns a cost breakdown with each generation response rather than publishing a single per-image rate.
Can I fine-tune or use custom styles via the API?
Yes. The v1 endpoint supports custom and fine-tuned models along with the Elements system for style and character consistency, and v2 extends this with its guidance system for style, content, and character references.
Is the Leonardo AI API suitable for commercial use?
Yes. The API is built for production use by developers working on top of Leonardo's models, under terms separate from the consumer app. Check Leonardo's current terms of service for specifics on usage rights before you ship. If you are putting generated images in front of customers, our guide to AI content moderation for generated images and video covers the checks worth adding. Looking to compare Leonardo against other image generation APIs? Our 9 Best AI Image Generator APIs for Developers roundup puts the main options side by side, and our Flux vs Stable Diffusion vs Midjourney API guide focuses on the three most popular alternatives. If you want a broader introduction to how AI image APIs work, the AI Image API complete guide is a good place to start.
You can also get an API key and start with free credits if you would rather reach Leonardo's models alongside Kling, Runway, and dozens of others through one integration.