Visual-first generation · Production API · Pay-as-you-go · Updated 2026

Leonardo API - Complete Developer Guide

The Leonardo API (Leonardo.Ai Production API) lets you build image and video generation into your product: text-to-image, image-to-image, inpainting, upscaling, Realtime Canvas (LCM), text-to-video, custom model training, and - new for 2026 - access to first-party Lucid & Phoenix models alongside a hosted shelf of leading third-party models, all through one API and one token balance.

⭐ 4.7 · 860 reviews Category: Image Generation Usage-based · $5 starting credit Owned by Canva since 2024
Base endpoint
https://cloud.leonardo.ai/api/rest/v1
Auth header
Authorization: Bearer <API_KEY>
Async outputs
Poll generations or use webhook callbacks
Limits
Rate limit + concurrency (up to 10) + queue controls
What's new 2026 1) What it is 2) Quickstart 3) Authentication 4) Core endpoints 5) Uploads 6) Realtime Canvas 7) Video 8) Models 9) Webhooks 10) Limits 11) Pricing 12) SDKs 13) Architecture 14) FAQ References
Latest · 2026 snapshot

What's new with the Leonardo API in 2026

Leonardo has evolved from a single-model image generator into a creative aggregator platform: its own first-party models run alongside a rotating shelf of hosted third-party models, selectable per generation from one API and one token balance. Here's what changed and what it means for builders.

🎨 New first-party image models

Lucid Origin (Full-HD renders, strong prompt adherence, accurate in-image text) and Lucid Realism join the Phoenix 1.0 / 0.9 family - Leonardo's foundational models, with Phoenix outputting up to ~5 MP (e.g. 2048×2048) and notably high prompt fidelity.

Lucid Origin Lucid Realism Phoenix 1.0

🎬 Expanded video lineup

First-party Motion 1.0, Motion 2.0, and Motion 2.0 Fast handle text-to-video and image-to-motion, while hosted third-party video models (Veo 3.x, Kling 2.x/3.x, Sora 2, LTX-2, Hailuo, Wan) are available through the same platform for premium workloads.

Motion 2.0 Veo 3.x Kling Sora 2

🧩 Third-party model shelf

One integration now reaches 80+ models: FLUX.1/FLUX.2, Ideogram 3.0, GPT-Image, Nano Banana & Nano Banana Pro, and Seedream 4.x sit next to Leonardo's own models - no separate vendor accounts or SDKs required.

FLUX.2 Ideogram 3.0 Seedream 4.5

⚙️ Platform & workflow additions

Blueprints (pre-packaged multi-step generation workflows executable via API), 3D model generation via Rodin V2, a Universal Upscaler, background removal, outpainting (unzoom), and a Pricing Calculator endpoint for pre-flight cost estimation.

Blueprints 3D (Rodin V2) Cost calculator
Context: Canva acquired Leonardo.Ai in July 2024, with the product continuing to run independently. In practice this funded the "aggregator" strategy - hosting frontier third-party models next to Leonardo's own - while the developer API stayed pure usage-based (start with a $5 credit, pay per token, auto top-ups, up to 10 concurrent generations).

Model lineups rotate frequently. Verify current model availability in the official docs before hard-coding model IDs.

Section 1

1) What the Leonardo API is

Leonardo is a creative generation platform with a visual-first web app and a Production API. The core developer workflow is "design visually → export code": teams iterate in the web UI (prompt, style, aspect ratio, upscales, canvas edits), then export the same configuration into code via the in-app "Get API Code" feature and run it at scale through the API.

Marketing creatives

Ad images, social graphics, product lifestyle shots, and campaign variants at volume - run A/B prompt tests and generate consistent assets in batches.

Text-to-imageVariationsUpscale

Productized generator features

Embed generation in your own app: an "AI cover image" button, avatar generators, or templated content mapping user inputs to prompt scaffolds with guardrails.

TemplatesPrompt helpersSafety controls

Realtime creative tools

Use Realtime Canvas (LCM) endpoints for interactive creation where latency matters: quick iterations, refinements, and live-feeling edits.

LCMInstant refineInpainting

Game / app asset pipelines

Concept art, textures, icons, and environment variants - pair datasets and custom model training to keep a consistent style for a game or brand universe.

DatasetsCustom modelsBatch
The core idea: the Leonardo API is an asynchronous generation system. You request a generation, then either (a) poll for completion, or (b) use webhook callbacks so Leonardo pushes results to your server when done - the standard reliability pattern for high-volume media platforms.
Terminology: a generation is a job producing outputs; an init image is an uploaded image for image-to-image or editing; a mask defines the inpaint region; platform models are Leonardo-provided; custom models are trained on datasets you upload; and LCM (Latent Consistency Models) power fast Realtime Canvas generation.
Section 2

2) Quickstart: API key to first generation

The fastest path: (1) create an API key in the Leonardo web app under API Access, (2) call a generation endpoint with your prompt and settings, (3) retrieve the result by polling or via webhook callback. Name keys by environment (e.g. myapp-dev, myapp-prod) so you can rotate safely.

bash · curlPOST /generations
curl -X POST "https://cloud.leonardo.ai/api/rest/v1/generations" \
  -H "accept: application/json" \
  -H "content-type: application/json" \
  -H "authorization: Bearer YOUR_LEONARDO_API_KEY" \
  -d '{
    "prompt": "A clean product hero shot of a smart watch on a white desk, soft natural light",
    "num_images": 4
  }'
What happens next: create endpoints return a generation record (ID + metadata). You then wait for completion - poll with GET /generations/{id}, list generations by user, or configure webhook callbacks so your server receives results when ready.
"Get API Code" workflow: generate an asset visually in the web app, then export the exact request settings as code. Your production requests then match a known-good UI configuration instead of a manual translation of sliders and toggles into JSON.
Section 3

3) Authentication and key safety

The Production API uses a standard Bearer token: set Authorization: Bearer <YOUR_API_KEY> on requests against the cloud.leonardo.ai/api/rest/v1 base path.

  • Never call the API from browsers: a key exposed in client-side JavaScript can be extracted and used to spend your credits. Route all requests through your backend, where you can enforce auth, quotas, and guardrails.
  • Separate keys per environment: at minimum dev and prod, so a leak or bug in one can be revoked without impacting the other.
  • Store keys in a secrets manager (or encrypted env vars), never in source control, and redact Authorization headers from logs and error tracking.
  • Validate requests in your backend so users can't request unlimited images or extreme resolutions, and add per-user quotas plus abuse protection on public endpoints.
Operational tip: log timestamp, endpoint, HTTP status, generation ID, and your internal user ID - not full payloads. That's enough to debug failures and reconcile retries without storing sensitive prompts or user content by default.
Section 4

4) Core endpoints: generations, retrieval, and lists

The API is built around the generation - a job that produces one or more outputs. The workflow is always: create a generation → wait → retrieve results and metadata.

Capability Endpoint (typical) Purpose When you use it
Create image generation POST /generations Start a text-to-image or config-driven generation job. Most image flows (prompt → outputs).
Get a single generation GET /generations/{id} Fetch status, metadata, and outputs. Polling, status pages, debugging.
Get generations by user GET /generations/user/{userId} List a user's generations. History pages, export, auditing.
Prompt helpers POST /prompt/improve Improve prompts or generate ideas. UX features: an "Enhance prompt" button.
Model discovery GET /platformModels List platform models available for generation. Let users choose a model dynamically.
Pseudo-codePolling baseline
// Poll generation until complete (conceptual)
createGeneration() -> { generationId }

repeat every 2-5 seconds with backoff:
  gen = GET /generations/{generationId}
  if gen.status in ("COMPLETE", "FAILED"): break

if COMPLETE: store image URLs + metadata
else: log error + show message
Treat outputs as content URLs, not permanent storage: returned asset URLs are for retrieval and display. For production, download outputs into your own object storage (S3/R2/GCS) if you need durable links, caching, or long-term archival.
init_image_id vs init_generation_image_id: the former is an ID from the Upload Init Image endpoint (a user-uploaded file); the latter refers to an image produced by a prior Leonardo generation. The distinction matters for "edit this generated image" vs "edit a user upload" flows.
Section 5

5) Uploads with presigned URLs

Many workflows start from an existing image: image-to-image, inpainting, upscaling, canvas editing, motion from an upload, or training datasets. Rather than posting raw bytes to Leonardo, upload endpoints return presigned S3 upload details: call POST /init-image, receive a temporary presigned URL and form fields, upload the file directly to S3, then use the returned image ID in generation requests.

bash · curlPOST /init-image
curl -X POST "https://cloud.leonardo.ai/api/rest/v1/init-image" \
  -H "accept: application/json" \
  -H "content-type: application/json" \
  -H "authorization: Bearer YOUR_LEONARDO_API_KEY" \
  -d '{ "extension": "png" }'

Canvas editor: init + mask

Inpainting needs both an init image and a mask. A canvas upload endpoint (e.g. POST /canvas-init-image) returns presigned details for uploading both files.

Mask hygiene

Soft-edged masks blend smoothly; hard masks give sharp edits (like replacing a sign). If you see artifacts, adjust the mask boundary and tighten prompt specificity.

Dataset uploads

Custom model training uses dataset creation plus dataset-image upload endpoints. Presigned URLs can expire quickly - upload immediately after receiving them, and validate file size/type first.

Common gotcha - remove auth headers on the S3 upload: presigned URLs already encode permission. Adding Leonardo auth headers to the S3 upload can cause errors (including 403s). The correct sequence: Leonardo endpoint with Bearer auth → receive presigned details → upload to S3 without Leonardo auth → use the returned image ID in the next Leonardo call.
Section 6

6) Realtime Canvas (LCM): fast generation, refine, inpaint, upscale

Realtime Canvas is built around LCM (Latent Consistency Models) for sub-second, interactive iteration. If an image takes 20–40 seconds, users abandon - realtime workflows keep the UI alive with a quick preview, then offer a refine/upscale path for final quality.

  • Create LCM generation: produce an initial image quickly.
  • Instant refine: improve quality or steer details without starting over.
  • LCM inpainting: edit regions while keeping the rest consistent.
  • Alchemy Upscale: upscale and enhance details for the final asset.
Recommended UX flow: fast preview → select best → refine with a stronger prompt → inpaint corrections → upscale for final. Treat realtime as "draft mode" - users only upscale the image they actually want, which saves cost and improves satisfaction.
Prompting canvas edits: be explicit about what stays vs what changes - e.g. "keep the product shape and lighting consistent, replace the background with a soft gradient." Small mask → focus the prompt on the masked area; large mask → include broader composition guidance.
Section 7

7) Video generation: text-to-video and motion from images

The API includes text-to-video endpoints and recipes for generating motion from uploaded images - "turn a product still into a subtle motion clip," "animate a scene from text," or "create short promo clips for ads." In 2026 this spans first-party Motion 1.0 / 2.0 / 2.0 Fast plus hosted third-party video models for premium workloads.

bash · curlPOST /generations-text-to-video
curl -X POST "https://cloud.leonardo.ai/api/rest/v1/generations-text-to-video" \
  -H "accept: application/json" \
  -H "content-type: application/json" \
  -H "authorization: Bearer YOUR_LEONARDO_API_KEY" \
  -d '{
    "prompt": "A smooth camera pan across a minimalist workspace, soft daylight, cinematic",
    "duration": 4
  }'
  • Async like images: submit prompt + settings, wait for completion, receive a video URL plus metadata. Always implement timeouts, polling, and webhooks for longer jobs.
  • Motion from an upload: upload an init image via presigned URL → get an image ID → reference that ID in the motion/video request.
  • Budget carefully: video is far more expensive than images - a single short Motion render can consume a token volume comparable to hundreds of standard images.
Store lineage: when generating video from an image, record video generation ID → source init_image_id → original file in your storage. It makes debugging and "how did we get this clip?" questions trivial.
Section 8

8) Models: first-party, third-party shelf, and custom

You can list platform models via the API and pass a model ID in generation requests, or train custom models on your own datasets for brand-consistent style. The 2026 model landscape looks like this:

Model Type Modality Known For
Lucid OriginLeonardo first-partyFirst-partyImageFull-HD renders, strong prompt adherence, accurate in-image text - great for branded content
Lucid RealismLeonardo first-partyFirst-partyImagePhotorealistic generation for lifestyle and product imagery
Phoenix 1.0 / 0.9Leonardo first-partyFirst-partyImageFoundational model, up to ~5 MP outputs, very high prompt fidelity, coherent text rendering
Motion 1.0 / 2.0 / 2.0 FastLeonardo first-partyFirst-partyVideoText-to-video and image-to-motion clips
FLUX Dev / Schnell / FLUX.2Black Forest LabsHosted 3rd-partyImageFast, high-quality open-ecosystem image models
Ideogram 3.0IdeogramHosted 3rd-partyImageTypography-strong image generation
Nano Banana / ProGoogleHosted 3rd-partyImageFine-grained image editing and consistent characters
Seedream 4.xByteDanceHosted 3rd-partyImageHigh-aesthetic frontier image generation
Veo 3.x · Kling 2.x/3.x · Sora 2 · LTX-2VariousHosted 3rd-partyVideoPremium frontier video models on the same token balance
Custom models & elementsYoursTrainedImageLoRA-style fine-tuning on your uploaded datasets for style consistency
  • Fast experimentation: start with platform models, validate product-market fit first.
  • Consistent brand style: plan a dataset + custom model training workflow (create dataset → upload images via presigned URLs → train → generate with the returned model ID).
  • Interactive UX: use Realtime Canvas/LCM for previews, then refine/upscale.
  • Dataset quality: consistency beats quantity; cover variation deliberately; avoid mixing unrelated concepts; keep a fixed prompt suite to evaluate model versions objectively; version everything.
Model IDs in practice: treat IDs as opaque strings. Store the selected model ID with each generation so you can reproduce outputs later, and keep a friendly display name (from the platform model list) alongside it for your UI.
Section 9

9) Webhook callbacks: results without polling

Polling is simple, but webhooks win at scale: configure a webhook callback URL when creating an API key so generation results are delivered to your server. This cuts latency and polling traffic, and lets long jobs run without a waiting client. An optional webhook callback API key is sent to your endpoint as authorization: Bearer <yourWebhookCallbackApiKey> - validate it.

Pseudo-codeWebhook handler
// Conceptual webhook callback handler
raw = readRawBody(req)
auth = req.headers["authorization"]

if auth != "Bearer YOUR_WEBHOOK_CALLBACK_API_KEY": return 401

payload = JSON.parse(raw)

// Dedupe by generationId (and/or event id)
if seen(payload.generationId): return 200

enqueue("leonardo_generation_completed", payload)
markSeen(payload.generationId)
return 200
  • Fast acknowledge: respond 2xx quickly; push heavy processing into a queue/job system.
  • Idempotency: webhooks can arrive more than once - dedupe by generation ID + event type, and use upserts downstream.
  • Keep polling as a fallback: mature systems use webhooks for real-time plus a reconciliation job (e.g. nightly) that polls for any generations that never received a callback.
Section 10

10) Limits, concurrency, and queue

Design for three separate capacity constraints, all documented explicitly by Leonardo: rate limits (requests per window), concurrency (simultaneous jobs - the API supports up to 10 concurrent generations), and the queue (what happens when concurrency is maxed and jobs wait).

  • Backoff on rate-limit errors: exponential with jitter - never hammer the API.
  • Cap concurrency in your own worker pool rather than letting the platform queue grow unbounded.
  • Batch thoughtfully: spread requests across time; don't spike thousands at once.
  • Use webhooks to avoid tight polling loops that burn rate-limit budget.
  • Show user states: "Generating", "Queued", "Finalizing", "Failed" - with helpful actions.
UX matters under load: if a user clicks Generate and sees nothing for 30 seconds, they click again - doubling your load and cost. Clear status, queue messaging, and "notify me when ready" patterns reduce retries.
When you outgrow defaults: first optimize architecture (queue + batch + caching + fewer retries), then move to a higher-capacity plan or agreement when justified. Strong products do both.
Section 11 · Updated 2026

11) Pricing: pay-as-you-go API + app plans

The developer API is pure usage-based: start with a $5 credit, pay per token, enable auto top-ups, and run up to 10 concurrent generations. The self-serve app runs on seat-plus-bundled-token plans. Because every generation is metered in one shared token currency, cost planning matters - heavier models and video consume far more per output.

Leonardo.Ai plans (2026 snapshot)
Plan Price Fast Tokens Rollover Bank Notable
Free$0150 / day-Access to models incl. Phoenix, Lucid Origin, FLUX; non-exclusive commercial license
API BasicFrom ~$9/moUsage-based-Developer API entry; $5 starting credit, auto top-ups
Essential$12/mo8,500 / mo25,500 capEntry paid tier for regular creators
Premium$30/mo25,000 / mo75,000 capUnlimited relaxed image generation on first-party models (Lucid, Phoenix, FLUX Dev/Schnell)
Ultimate$60/mo60,000 / mo180,000 capAdds unlimited relaxed video on Motion models; 6 simultaneous generations
TeamFrom ~$24/seatShared poolShared3-seat minimum, shared token pool, collaboration features
The "unlimited" fine print: unlimited relaxed generation applies only to selected first-party models, runs at lower queue priority with reduced concurrency, and third-party models (Veo, Sora 2, Kling, Nano Banana Pro, Seedream, etc.) always consume Fast Tokens regardless of plan - Leonardo pays external providers for those. Also note: generations blocked by content moderation can still consume tokens.
  • Cost drivers you control: images per request, resolution, upscale usage (only upscale the winner), retries (dedupe aggressively), and prompt-experimentation loops.
  • Cost visibility patterns: show estimated credit cost before generating (a Pricing Calculator endpoint exists for pre-flight estimates), offer draft-vs-final toggles, per-user budgets, and log cost metadata per generation.
  • Reduce cost without hurting quality: two-stage LCM preview → refine/upscale on selection; cache results for repeated template prompts; hash request parameters to return the last successful output on repeated clicks.

Prices and token allowances change often and vary with annual billing (~20% off). Confirm current numbers on leonardo.ai/pricing and the official pricing FAQ before building billing logic.

Section 12

12) Official SDKs: TypeScript and Python

Leonardo provides official TypeScript and Python SDKs that wrap the REST endpoints, standardize auth and errors, and keep request shapes aligned with the reference as it evolves.

TypeScript SDK

Ideal for Next.js backends, serverless functions, and Node services - typed requests reduce integration mistakes.

Node.jsTypedServerless

Python SDK

Best for batch generation pipelines, dataset upload automation, and training workflows - pairs well with worker queues.

PipelinesAutomationBatch
  • Initialize the client with an API key from your secrets manager.
  • Wrap calls with your own retry/backoff policy for transient errors.
  • Normalize responses into your internal schema (generationId, status, asset URLs, metadata).
  • Centralize logging and error handling so secrets are redacted in one place.
When not to use an SDK: if you only need one or two endpoints and want minimal dependencies, direct HTTP is fine - just keep a single request wrapper, type responses at least loosely, and implement retries. The SDK is a productivity tool, not a requirement.
Section 13

13) Production architecture that doesn't break

The hard part isn't calling an endpoint - it's delivering a reliable product experience: controlling concurrency, handling queue states, managing costs, and supporting retries and user expectations.

Component What it does Why it matters
API Gateway (your backend)Validates inputs, enforces quotas, starts Leonardo generations.Protects your key, prevents abuse, keeps costs predictable.
Job Queue / WorkerRuns requests, polls status, downloads results, writes to storage/DB.Decouples user requests from long-running jobs.
Webhook ReceiverReceives callbacks and triggers worker processing without polling.Lower latency, fewer API calls, real-time updates.
Object StorageStores final images/videos for durable, CDN-ready delivery.Stable URLs, caching, retention control.
DatabaseStores generations, status, user mappings, costs, metadata.History, billing, support and debugging.
ObservabilityLogs, metrics, alerts, tracing for failures and latency spikes.Quick debugging and reliable SLAs.
Pseudo-codeIdempotency via request hash
// Prevent duplicate generations (a major hidden cost driver)
hash = sha256(userId + prompt + modelId + width + height + numImages + seed + options)

if existingGenerationByHash(hash) and status not FAILED:
  return existingGeneration
else:
  create new generation and store hash
  • Guardrails: parameter caps (max images, resolution, video duration), per-user quotas, prompt content policy, queue-aware UX, and backoff policies.
  • Batch workloads (e.g. 10,000 images): worker pool with strict concurrency limits and checkpointing; store generation IDs as you create them; process completion via webhooks; adaptive polling with jitter as a fallback; download outputs to your own storage as they complete; retry failures with capped attempts.
  • Creator-friendly UI ingredients: prompt templates, "improve prompt" button, preset styles, aspect-ratio controls, LCM draft mode, refine/upscale pipeline, inpainting edit step, side-by-side variant comparison, and parameter history for reproducibility.
Section 14

14) FAQ: Leonardo API

What is the base URL for the Leonardo Production API?

The reference uses https://cloud.leonardo.ai/api/rest/v1. Endpoints under this include generations, uploads, models, prompt utilities, canvas endpoints, video, datasets, and more.

How do I authenticate?

Bearer token header: Authorization: Bearer YOUR_API_KEY. Create keys in the web app under API Access and keep them on your backend only.

Which models should I use in 2026?

For general image work, start with Lucid Origin (strong prompt adherence and in-image text) or Phoenix 1.0 (high resolution and prompt fidelity). For video, first-party Motion models are the budget path, with hosted Veo/Kling/Sora 2 available for premium workloads. List platform models via the API to populate a model picker dynamically.

How do I generate images with a custom model?

Create a dataset → upload images via presigned URLs → train the custom model or element → pass the returned model ID in your generation requests.

Should I poll or use webhook callbacks?

Use webhooks for real-time results and lower API load, but keep polling as a fallback. Most production systems do both: callbacks for speed, polling for reconciliation and error recovery.

What are rate limits and concurrency limits?

Rate limits control request throughput; concurrency controls simultaneous generations (the API supports up to 10 concurrent); the queue governs what happens beyond that. Implement backoff and show queue-aware UX states.

How does API pricing work?

Pure pay-as-you-go: start with a $5 credit, pay per token, with auto top-ups available. Different models consume different token amounts - video and premium third-party models cost significantly more per output than first-party image models.

Is there an official SDK?

Yes - official TypeScript and Python SDKs. You can also call the REST endpoints directly if you prefer minimal dependencies.

References

Official Leonardo docs

For accurate, current parameter lists, request/response schemas, and feature availability, always confirm against the official documentation:

Topic Official link Why it matters
Developer API overviewhttps://leonardo.ai/api/High-level positioning, production notes, entry points
Pricinghttps://leonardo.ai/pricingCurrent plans, token allowances, relaxed-generation model list
API reference (limits)https://docs.leonardo.ai/reference/limitsConcurrency, rate limits, queue behavior
Quick starthttps://docs.leonardo.ai/docs/getting-startedGet an API key, first calls, recommended setup
Create image generationhttps://docs.leonardo.ai/reference/creategenerationStart image generations
Get generation by IDhttps://docs.leonardo.ai/reference/getgenerationbyidPoll and retrieve a generation
Upload init imagehttps://docs.leonardo.ai/reference/uploadinitimagePresigned uploads for image-to-image & edits
Webhook callback guidehttps://docs.leonardo.ai/docs/guide-to-the-webhook-callback-featureAsync results; bearer auth for callbacks
Pricing FAQhttps://docs.leonardo.ai/docs/pricing-and-plans-faqPay-as-you-go model explanation
Official SDKshttps://docs.leonardo.ai/docs/leonardoai-official-sdksTypeScript + Python SDK resources
Realtime Canvas recipehttps://docs.leonardo.ai/docs/generate-images-with-realtime-canvasLCM generation and fast workflows
Text-to-video endpointhttps://docs.leonardo.ai/reference/createtexttovideogenerationStart text-to-video jobs