Draw and change Mermaid diagrams with the AI assistant
Describe a system and get a Mermaid diagram with real icons, or say what to change in the open one. How the AI assistant works, what it costs, and how to write requests that work.
The AI assistant writes Mermaid for you. Describe a system and it draws a new diagram, with components and icons from the editor's own libraries. Or open a diagram and say what to change, and it edits the code the way you would by hand. This guide covers both, with tips for requests that get a good diagram the first time.
Plan: Pro and Pro Max. Each diagram the AI creates or changes uses 2 AI credits, from the 100 a month included in Pro or the 300 in Pro Max. Signed out, the panel asks you to sign in; on Free it shows what's included and a See Pro button.
Open the assistant
In the editor, click AI in the top bar. A panel opens with three choices:
- Change diagram: edit the open diagram. It's the default when a diagram is open, and it's turned off for an empty one.
- New diagram: draw a new diagram from a description.
- Animated explainer: draw a topic and explain it in captioned steps, for a GIF or video. See Animate a Mermaid diagram.

Type your request, between 3 and 2,000 characters, and click Create diagram or Change diagram. Ctrl + Enter sends it too. Under the box, the panel shows the price and your balance, such as "2 credits · 86 of 100 credits left this month".
Draw a new diagram
Describe the system or process the way you'd explain it to a colleague: the parts, how they connect, and any boundaries you want shown.
A serverless order pipeline on AWS: API Gateway, Lambda, SQS and DynamoDB, with CloudWatch monitoring. Group everything inside one AWS account.
The assistant:
- Picks the diagram type. A flowchart for architectures, pipelines and processes, a sequence diagram for interactions over time, a state diagram for lifecycles, an ER diagram for data models, a class diagram for code structure, and a Gantt chart for schedules. Name a type in your request to choose it yourself.
- Uses real icons. Components are drawn as rich nodes with icons that exist in the editor's libraries. Name the cloud provider (AWS, Google Cloud or Azure) to get its official service icons.
- Keeps it readable. Short titles and labels, one idea per box, and groups only for real boundaries such as an account, a network or a team.
The result is saved as a new diagram in the current project, named by the AI, and opens in the editor. The panel says what it drew.
Change the open diagram
With a diagram open, choose Change diagram and say what you want:
- "Add a Redis cache between the API and the database."
- "Group the services into a VPC."
- "Make the queue a dead-letter queue and add a retry arrow."
- "Turn this into a top-to-bottom flowchart."
The assistant makes that change and keeps the rest as it was: the same node ids, labels, comments and styles. Positions you set in Manual mode stay too, because they're tied to the node ids. New boxes follow the diagram's own conventions, rich nodes or plain.
The change goes into the code editor like any other edit, so Ctrl + Z undoes it. If the diagram is saved to your account, the version before the change is also kept in Version history, so you can go back to it later.
If a change can't be made in that diagram type, the assistant does the closest reasonable thing and says so in its summary.
When Mermaid can't read the answer
Every answer is checked before it reaches the canvas. If Mermaid can't read it, the app sends the error back to the AI once and asks it to fix the code. That fix is free. If the fixed answer still can't be read, it goes into the editor anyway and the status bar shows the error, so you can correct it by hand or undo it and ask again in other words.
Write requests that work
flowchart LR
ask([Your request]) --> ai[AI assistant]
ai --> check{Mermaid<br/>reads it?}
check -->|yes| canvas[Canvas]
check -->|no, once| fix[Free fix]
fix --> canvas- Name the parts. "Orders API, Postgres, Stripe" draws better than "a backend".
- Say what connects to what. Arrows are the point of most diagrams; describe them.
- Name the boundaries. "Inside the VPC", "on the customer's device", "owned by the payments team".
- Ask for one change at a time. Small changes are easier to check, and each one can be undone on its own.
- Keep it under about 30 boxes. For a large system, draw an overview and a diagram for each part, and link them.
Good to know
- Check before you share. AI can make mistakes. Read the diagram against what you know of the system.
- Your data. Your request and the open diagram's code are sent to Anthropic, our AI provider, to write the answer. They aren't used to train models.
- Short bursts are limited. If you send many requests in a few seconds, the assistant asks you to wait a minute.
- Credits. Each request uses its credits once, and they're given back if the request fails on our side. When too few are left, a Buy credits button appears. See AI credits.
For a quick reference, see AI assistant in the docs. To edit on the canvas without AI, see Edit Mermaid diagrams by dragging, typing, or asking.
More guides
- Edit Mermaid diagrams visually in VS CodeDrag, connect and restyle a Mermaid diagram on Flowgraph's canvas inside VS Code, and every change is written back into the .mmd file or Markdown block as ordinary code.
- Keep a diagram's style in its code with %% flowgraph-themeOne comment line keeps a Mermaid diagram's Flowgraph theme in the file, so it looks the same in your repository, in VS Code, from the CLI and through the render API.
- Preview Flowgraph diagrams in VS Code, with icons, layout and your themeInstall the Flowgraph Studio extension to preview Mermaid files and Markdown blocks in VS Code as Flowgraph draws them, see mistakes in plain words, and export SVG or PNG.