Polotno 4.25 adds Polotno AI: AI image tools built into the editor. Your users generate an image from a prompt, extend a photo, replace or remove an object and upscale, on the canvas. Polotno runs the models, so you set up no AI provider. The tools are optional and stay off until you turn them on.
What your users get
- The AI tab. In the side panel, a user describes an image and clicks Generate. A click on the result adds it to the page, and a drag drops it into an image or a frame. With a model that takes a reference image, the user can start from the selected image or an upload.
- Expand. The user drags the frame past the edges of a photo, and the model draws the new area. A square product photo becomes a wide banner, with the whole product still in frame.
- Generative fill. The user selects part of a photo. Replace swaps the selection for what the user describes, such as "open sky". Remove takes an object out and fills the gap from the image around it.
- Upscale. One click raises the resolution of a small photo.
Expand, Generative fill and Upscale are in the AI edit menu of the image toolbar. Each edit is one undo step, and the image keeps its filters and effects.
Built in, and optional
Our earlier post, AI image tools in your editor, showed the canvas side of these tools with your own AI provider. Polotno AI adds the model side. Your team needs no account with each model provider, and no code for uploads, polling, cancelling or each model's mask format. New images come from Seedream, Ideogram, FLUX, GPT Image or Nano Banana Pro, and each edit tool runs a model made for its job.
An upgrade changes nothing in your editor until you choose. No Polotno AI tool shows until you list it, and a tool that you connected to your own provider keeps running there. You can also mix the two: your own model for Generative fill, and Polotno AI for Upscale.
Turn it on
Create a server key on the API & Usage tab in My account and keep it on your server. Then add a route that trades the key for a short-lived token, so the key never reaches the browser:
// Express. requireLogin is your own login middleware:
// anyone who can call this route spends your balance.
app.post('/api/polotno-token', requireLogin, async (req, res) => {
const response = await fetch('https://api.polotno.com/api/tokens', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.POLOTNO_SERVER_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ user: String(req.user.id) }),
});
// Forward the API's response unchanged, so the editor sees refusals too.
res.status(response.status).type('json').send(await response.text());
});In the editor, give Polotno a way to get tokens and list the tools your users see:
import { setTokenFunc, setAiTools } from 'polotno/config';
setTokenFunc(async () => {
const response = await fetch('/api/polotno-token', { method: 'POST' });
return response.json();
});
setAiTools([
'ai.image.generate', // the AI tab
'ai.image.expand',
'ai.image.replace-object', // Generative fill: Replace
'ai.image.remove-object', // Generative fill: Remove
'ai.image.upscale',
]);Each result goes through your upload function (setUploadFunc), so the design stores your URL instead of a data URL of several megabytes. If you pass your own sections to SidePanel, add AiSection from polotno/side-panel for the AI tab. The AI tab runs Seedream 5 Lite unless you pick other models with setAiModels.
The Polotno AI guide has the same route for Next.js, Cloudflare Workers and FastAPI, and the Polotno AI API reference covers calls from your own backend.
What it costs
Each image costs the price of the tool and model that made it, paid from a prepaid balance that your whole team shares. There is no monthly fee, and the balance is separate from your SDK license. A refused or failed run costs nothing. A run that the user cancels, or abandons by closing the page, after the model has started is charged. The account owner adds funds on the Balance tab in My account, and the prices are public at api.polotno.com/api/pricing.
Your users see no prices and no Polotno name. When the API refuses a run, for example because the balance ran out, they see "This AI feature is unavailable right now. Please try again later." Your code gets the reason, such as insufficient_balance, in details.apiCode of the FETCH_FAILED error.
Upgrade
npm install polotno@4.25.0React 18 projects use polotno@3.25.0. One case needs a change: a side panel section of your own that renders AiImagesPanel from polotno/side-panel/ai-images-panel now shows the Polotno AI panel, with the same props, and needs setTokenFunc. The Stable Diffusion endpoint that the old panel called is retired.
The rest of the release, including text animation timing and warnings for text that exports shrink, is in the changelog.
