Skip to main content

Write prompts for diagrams in AI assistants

How your AI assistant turns a prompt into a draw.io diagram, what that costs, and how to steer it.

The two formats​

The assistant writes each diagram in one of two formats. It picks one by itself, and you can ask for the other.

Mermaiddraw.io XML
What the assistant writesA short text description: Order --> PaymentEvery shape with its position, size and style
LayoutAutomaticPlaced by the assistant, following a pattern for each diagram type
Typical time10–20 s35–60 s
Output tokensAbout 1,500About 7,500
StylesColours by roleAny draw.io style: colour themes, fonts, shadows, hand-drawn, gradients
IconsNone from the draw.io librariesMore than 10,000 draw.io shapes: AWS, Azure, Google Cloud, Cisco, Kubernetes, P&ID and more
Diagram types28, including sequence diagrams, Gantt charts and chartsAnything made of shapes and connectors
After Open in draw.ioKeeps its Mermaid text: double-click the diagram to edit the textNative draw.io shapes, each editable on its own

Which format the assistant uses​

draw.io XML: for diagrams of boxes and lines up to about 30 shapes. These are flowcharts, decision trees, swimlane processes, org charts, ER diagrams, UML class, state and use case diagrams, mind maps, timelines, and architecture, cloud and network diagrams.

Mermaid: for the diagram types only Mermaid draws, and for large flowcharts. These are sequence diagrams, Gantt charts, pie, XY, quadrant and Sankey charts, git graphs, kanban boards, user journeys and the other Mermaid types, and flowcharts with more than about 30 shapes, which get an automatic layout.

Ask for a format​

You wantAdd to your prompt
A faster result, or a diagram you edit as text later"Use Mermaid."
Your own styling, exact placement or icons"Use draw.io shapes, not Mermaid."
Official icons"Use AWS icons." · "Use Cisco shapes." · "Use Kubernetes icons."

For example, a 20-step insurance claim process placed as draw.io XML took 4–7 minutes and $0.55–0.99. The same prompt ending in "Use Mermaid." took 15 seconds and $0.07.

Time and cost​

These were measured with Claude Sonnet 5.5 on 46 runs of common prompts in October 2026. The costs are at API prices. On a Claude or ChatGPT subscription, the same work counts towards your usage limits instead.

RequestFormatTimeOutput tokensCost
A diagram with 10–25 shapesdraw.io XML49 s7,500$0.22
A diagram with 10–25 shapesMermaid17 s1,600$0.06
A 20-step processdraw.io XML4–7 min31,000–62,000$0.55–0.99
A 20-step processMermaid15 s1,900$0.07
A change to the diagram (colours, a theme, one more shape)As before30–45 s5,000–6,000$0.10–0.15
Icons for every stepdraw.io XML2–3 min15,000–25,000$0.30–0.50

Before its first diagram in a conversation, the assistant reads the drawing guide for the format once. This is about 11,000 tokens of input for draw.io XML, and 4,000 for Mermaid.

Choose a model​

ModelResult
Claude Sonnet 5.5Recommended. The numbers above are for this model.
Claude Opus 5.5The best layouts and the most complete content, at about twice the time and cost (draw.io XML: 115 s, $0.47).
Claude Haiku 5.5Not cheaper: it wrote 2–3 times as many tokens (draw.io XML: 75 s, $0.72), and chose the wrong format in 2 of 10 runs.
Other models, such as GPT and GeminiThey use the same drawing guide, but weren't measured.

Write the prompt​

  • Name the diagram type: "a swimlane process", "an ER diagram", "a sequence diagram".
  • List the content: the steps, components, tables or people. The assistant adds what is obviously missing, such as the start and end or error paths, but your list decides what appears.
  • Say what connects to what where it matters: "the API gateway calls the order and payment services".
  • Say where the diagram goes: "for a board slide" gets a corporate look, "a rough first sketch" a hand-drawn one. See colour themes.
  • Name the icon set when you want icons: AWS, Azure, Google Cloud, Cisco, Kubernetes, P&ID.
  • Write in any language: the labels will be in the same language.

When the result is off​

Ask for the change in the same chat. The assistant sees the diagram as it is shown, and changes only what you name:

Make it left to right.

Add a Redis cache between the application servers and the database.

Highlight the photo upload path in orange and label each connector with what it carries.

Specific requests work better than "try again". For many small changes, click Open in draw.io and edit the diagram in the draw.io editor.