# Leonardo.Ai API — card for AI agents

Leonardo.Ai image generation with a pay-as-you-go API; API credit does not expire.

Category: AI image generators · maker Leonardo.Ai (Canva) · checked 2026-10-10

## Price
- Free tier: Unverified: a search snippet mentions $5 free API credit for new accounts.
- Pricing page: https://leonardo.ai/api/

## License
Leonardo.Ai Terms of Service — https://leonardo.ai/terms-of-service/

- commercial: **conditions** (Commercial use with conditions)
  > If you are on one of our paid Subscriptions (Paid Subscriber), as between the Parties, subject to your compliance with these Terms and to the extent permitted by law, ownership of all Intellectual Property Rights in any Content you, or your Authorised Users, create while using the Platform will vest in you upon creation.
  (https://leonardo.ai/terms-of-service/)
- in app: **unclear** (Shipping inside an app unclear)
- youtube: **unclear** (Monetized YouTube unclear)

## Rules to follow
- Read the Terms of Service before commercial use; output ownership was not confirmed.

## How an agent gets files
- POST https://cloud.leonardo.ai/api/rest/v1/generations with header authorization: Bearer <API key> and a JSON body (prompt, modelId, width, height, num_images); the response gives a generationId used to fetch the images; a webhook callback can be set when creating the key. (sign-in: api-key)

## How to connect
- Public API
- API docs: https://docs.leonardo.ai (API key needed)
- Website: https://leonardo.ai

## Lines to paste into your prompt or AGENTS.md

```
- Leonardo.Ai API (AI image generators). Leonardo.Ai image generation with a pay-as-you-go API; API credit does not expire. Price: see pricing; commercial use with conditions; shipping inside an app unclear.
  Connect: API docs https://docs.leonardo.ai (API key needed).
  Get files: POST https://cloud.leonardo.ai/api/rest/v1/generations with header authorization: Bearer <API key> and a JSON body (prompt, modelId, width, height, num_images); the response gives a generationId used to fetch the images; a webhook callback can be set when creating the key.
  Rule: Read the Terms of Service before commercial use; output ownership was not confirmed.
  License: https://leonardo.ai/terms-of-service/ (checked 2026-10-10; details: https://agentgid.com/assets/leonardo/)
```

Not verified: The ToS page was not readable (403 / heading only); ownership and free credit come only from search snippets.

## Links
- AgentGid page: https://agentgid.com/assets/leonardo/
- Is it free for commercial use? https://agentgid.com/assets/leonardo/commercial-use/
- Source: https://leonardo.ai/api/
- Source: https://leonardo.ai/pricing


## Leonardo.Ai: paid image, video and sound generation from code

Leonardo.Ai is a paid service that makes images, videos, sound and 3D models from a text description. Your app sends a request with a secret key and gets the finished files back. Besides its own models it offers outside ones such as FLUX and Veo, all paid from one dollar balance.

### Where to use it
- Pictures made from a prompt in your app: Let users or your own backend create illustrations, product shots or game art from a sentence, and show the results in your app.
- Cut-out product photos: Remove the background from product or profile photos so they sit cleanly on any page color.
- Short videos for ads and social posts: Turn a prompt or a start image into a short video clip with models such as Kling, Veo or Seedance.
- Sound effects and music for a game or video: Make sound effects or a music track from a description, without searching sound libraries.
- Making images from your AI assistant: Connect Leonardo to Claude Code, Cursor or Codex and ask the assistant to create images or videos for your project.
- Sharper, larger images: Upscale small or generated images before printing them or using them as large banners.

### How to start
- Sign up or log in to the Leonardo.Ai web app and buy API credit; it is separate from web app plans.
- On the API Access page, create a key and keep it on your server only.
- Send a generation request, then fetch the result with the returned ID, or let Leonardo call your webhook when it is done.

### License
A paid service. Its terms page could not be read by us; the terms say paid subscribers own what they create, so check the terms before commercial use. Prompts are blocked when they break the content rules.

### Good to know
- You need a Leonardo account and prepaid dollar balance; the balance does not expire, and requests pause when it reaches zero.
- Automatic top-ups charge your saved payment method when the balance drops below the level you set.
- Results are not instant; you wait and check again, or receive a call to your own web address when the job is done.
- Adult content is blocked at the prompt, and images flagged as such are marked in the answer so you can hide them.
- One account may have at most 10 keys.

Checked 2026-11-19 against: https://leonardo.ai, https://leonardo.ai/api/, https://leonardo.ai/pricing, https://leonardo.ai/terms-of-service/, https://docs.leonardo.ai, https://docs.leonardo.ai/llms.txt, https://docs.leonardo.ai/docs/getting-started.md, https://docs.leonardo.ai/docs/payg-guide.md, https://docs.leonardo.ai/docs/pricing-and-plans-faq.md, https://docs.leonardo.ai/docs/plan-with-the-pricing-calculator.md, https://docs.leonardo.ai/docs/api-faq.md, https://docs.leonardo.ai/docs/api-error-messages.md, https://docs.leonardo.ai/docs/leonardoai-official-sdks.md, https://docs.leonardo.ai/docs/connect-to-leonardoai-mcp.md, https://docs.leonardo.ai/docs/remove-bg.md, https://docs.leonardo.ai/docs/lucid-origin.md, https://docs.leonardo.ai/docs/guide-to-the-webhook-callback-feature.md, https://docs.leonardo.ai/docs/guide-to-handling-not-safe-for-work-image-generation-nsfw.md, https://docs.leonardo.ai/reference/creategeneration.md, https://github.com/Leonardo-Interactive/leonardo-ts-sdk/blob/HEAD/README.md, https://github.com/Leonardo-Interactive/leonardo-python-sdk/blob/HEAD/README.md, https://registry.npmjs.org/@leonardo-ai/sdk, https://pypi.org/pypi/leonardo-ai-sdk/json

### Mistakes to avoid
- Don't: Calling the API from browser code with the key in the page → Do: Call it from your server and read the key from an environment variable there (The docs say the key must stay out of client-side code; anyone could copy it and spend your balance.)
- Don't: Reading generated_images right after creating a generation and treating an empty list as a failure → Do: Wait and check again until status is COMPLETE or FAILED, or use the webhook (The generation is still PENDING for a few seconds.)
- Don't: Leaving out "public" in v2 requests → Do: Send "public": false unless the images may appear in the community feed (The public flag decides whether results show in Leonardo's community feed.)
- Don't: Sending true or false in quotes, or a parameter in the wrong letter case → Do: Send real booleans and the exact parameter names from the docs (Quoted booleans and wrong case give validation errors.)
- Don't: Sending the API key when uploading an image to the presigned upload link → Do: Upload to the presigned link without authorization headers; a 204 answer means success (Extra auth headers cause 403 errors there.)

### Questions
- Is there a free tier for the API? The docs describe prepaid credit only; API access is separate from free or web app plans. We found no free API allowance on the pages we could read.
- Do generated images expire? No. Images made through the API do not expire and can also be opened in the web app.
- How do I know what a request cost? Generation answers include a cost object with the amount charged and its unit; the web app also has a pricing calculator.
- Are there official code libraries? Yes, for Python and TypeScript.
- Can my AI coding assistant use it directly? Yes, through the official Leonardo server for AI assistants, after you sign in with your Leonardo account in the browser.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
