Mermaid, Graphviz & Chart to PNG, SVG or PDF
Pricing
$3.00 / 1,000 diagram or chart rendereds
Mermaid, Graphviz & Chart to PNG, SVG or PDF
Render Mermaid, Graphviz DOT, Vega-Lite, Vega, Chart.js or SVG code to a PNG, SVG or PDF link for AI agents and MCP. Bad code returns the exact error with line number so the agent can fix and retry. $0.003 per diagram, errors free.
Pricing
$3.00 / 1,000 diagram or chart rendereds
Rating
0.0
(0)
Developer
FFS Marketing
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
2 hours ago
Last modified
Categories
Features
Share
Turn diagram or chart code into an image file your agent can share. Send Mermaid (flowchart, sequence, class, ER, gantt, pie, mindmap, timeline and more), Graphviz DOT, a Vega-Lite or Vega spec, a Chart.js config or raw SVG, and get back a PNG, SVG or PDF as a public link. When the code is wrong you get the parser's exact error, the line number and the offending line, so the agent can fix it and call again.
Works as a tool for AI agents. Add it to Claude, ChatGPT, Cursor, VS Code or any MCP client through Apify's MCP server (https://mcp.apify.com/?tools=fluidfaith/mermaid-chart-renderer), or call it with one API request. JSON in, JSON out. Setup is in Use it from an agent.
Costs $0.003 per diagram rendered. Code with errors is free, and your maximum charge per run is never exceeded.
Why use it
- Agents write diagram code all day but cannot show it. Slack, email, n8n, chat replies, Google Docs and PDFs need an image, and most agents have no headless browser to run mermaid-cli.
- Errors an LLM can act on.
Parse error on line 3, the text of line 3 and a short fix hint come back as fields, not a stack trace. Errors are not charged, so retrying is free until it renders. - Six languages in one tool. Mermaid, Graphviz (8 layout engines), Vega-Lite, Vega, Chart.js and SVG. Leave
typeempty and it is detected from the code. - PNG, SVG or PDF. PNG at 2x for sharp phone and retina screens, SVG as a file and inline markup, PDF sized to the diagram for print.
- Themes. Mermaid default, dark, neutral and forest; dark also gives charts light text on a dark background. Any background color, or transparent.
- Offline and safe. Rendering never touches the network, scripts in SVG are stripped, Mermaid runs in strict mode.
What you get
| Field | What it is |
|---|---|
status | OK (rendered and charged) or ERROR (not charged). |
fileUrl | Public link to the PNG, SVG or PDF. |
type, format | What was rendered (mermaid, graphviz, vegalite, vega, chartjs, svg) and the output format. |
width, height | Size of the diagram in CSS pixels. |
pixelWidth, pixelHeight | Size of the PNG (width x scale). |
svg | With SVG output: the SVG markup itself (under 100 KB), ready to embed. |
error | The parser's message, for example Parse error on line 3: ... Expecting 'SQE', got 'PS'. |
errorLine, errorColumn | Where the error is, when the parser says. |
errorExcerpt | The text of that line. |
hint | One line on what usually fixes this kind of error. |
warnings | For example outside images that were not loaded. |
The run summary in the OUTPUT record has status (OK, PARTIAL, ERROR), counts, and a short list of every diagram with its link or error.
Input
One diagram:
{"code": "flowchart LR\n A[Agent writes Mermaid] --> B{Valid?}\n B -- yes --> C[PNG link]\n B -- no --> D[Error with line number]","format": "png"}
Many diagrams in one run (each one billed only if it renders):
{"diagrams": [{ "name": "deploy-flow", "code": "digraph { rankdir=LR; build -> test -> deploy }" },{ "name": "weekly-runs", "type": "chartjs", "code": { "type": "bar", "data": { "labels": ["Mon", "Tue"], "datasets": [{ "label": "Runs", "data": [12, 19] }] } } },{ "name": "arch", "sourceUrl": "https://github.com/owner/repo/blob/main/docs/architecture.mmd", "format": "svg" }],"theme": "dark"}
| Field | Default | What it does |
|---|---|---|
code | The code of one diagram as text (up to 200,000 characters). Inside diagrams, Vega-Lite, Vega and Chart.js specs can also be JSON objects. | |
type | detected | mermaid, graphviz, vegalite, vega, chartjs or svg. Detection: <svg is SVG, digraph/graph is Graphviz, JSON with a vega-lite $schema is Vega-Lite, JSON with type + data.datasets is Chart.js, anything else is Mermaid. |
diagrams | Up to 100 { code, type, name, format, theme, background, engine, sourceUrl } objects. | |
sourceUrl | Fetch the code from a public link instead: a raw file, a GitHub file page or a gist (up to 1 MB). | |
format | png | png, svg or pdf. Chart.js gives PNG or PDF. |
theme | default | default, dark, neutral, forest. |
background | white | Any CSS color, or transparent. Dark theme defaults to #1e1e1e. |
scale | 2 | PNG pixel density, 1 to 4. |
width, height | 800, 500 | Chart.js canvas size. |
graphvizEngine | dot | dot, neato, fdp, sfdp, circo, twopi, osage, patchwork. |
includeSvgText | true | Put the SVG markup in the result row too. |
timeoutSecsPerDiagram | 20 | A diagram that takes longer becomes an ERROR row (free). |
maxConcurrency | 2 | Diagrams rendered at the same time (1 to 4). |
Output
{"name": "diagram-1","type": "mermaid","format": "png","status": "OK","fileUrl": "https://api.apify.com/v2/key-value-stores/.../records/diagram-1-e15b79.png","width": 636, "height": 210, "pixelWidth": 1272, "pixelHeight": 420,"bytes": 32831, "error": null, "warnings": []}
And when the code is wrong (not charged):
{"name": "diagram-1","type": "mermaid","status": "ERROR","fileUrl": null,"error": "Parse error on line 3:\n...B -->> C[[Oops\n----------------------^\nExpecting ...","errorLine": 3,"errorExcerpt": " B -->> C[[Oops","hint": "Check the diagram keyword on the first line (flowchart TD, sequenceDiagram, ...) and the arrow syntax near the line shown."}
Use it from an agent
Through Apify's MCP server (Claude, ChatGPT, Cursor, VS Code, any MCP client)
{"mcpServers": {"diagram-renderer": {"url": "https://mcp.apify.com/?tools=fluidfaith/mermaid-chart-renderer","headers": { "Authorization": "Bearer <APIFY_TOKEN>" }}}}
Claude Code: claude mcp add --transport http diagram-renderer "https://mcp.apify.com/?tools=fluidfaith/mermaid-chart-renderer" --header "Authorization: Bearer $APIFY_TOKEN". Or over stdio: npx -y @apify/actors-mcp-server --tools fluidfaith/mermaid-chart-renderer with APIFY_TOKEN set.
A good instruction for agents: "When a diagram or chart would help, write it as Mermaid (or Vega-Lite for data), call mermaid-chart-renderer, and share fileUrl. If status is ERROR, fix the line in errorLine and call again."
Through the API (one call, waits for the result)
curl -s -X POST "https://api.apify.com/v2/acts/fluidfaith~mermaid-chart-renderer/run-sync-get-dataset-items?token=$APIFY_TOKEN" \-H 'Content-Type: application/json' \-d '{"code":"sequenceDiagram\n User->>Agent: question\n Agent-->>User: diagram"}'
From JavaScript
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });const run = await client.actor('fluidfaith/mermaid-chart-renderer').call({ code: 'pie title Pets\n "Dogs" : 386\n "Cats" : 85' });const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items[0].status === 'OK' ? items[0].fileUrl : `${items[0].errorLine}: ${items[0].error}`);
Pricing
Pay per event: $0.003 per diagram rendered. That is it: no start fee, nothing for errors, refused links or diagrams that hit the time limit. 100 diagrams cost $0.30. Set a maximum charge per run and the Actor stops before it, never after; the summary then shows stoppedAtSpendingCap: true and how many were not rendered.
Safety
- Rendering is offline: the browser that draws the diagram cannot reach any network address, so code that points at outside images, data or internal addresses loads nothing. Vega-Lite specs that need outside data get a clear error instead of an empty chart.
- SVG input and every SVG output are cleaned: no scripts, no event handlers, no
javascript:links, no embedded HTML. - Mermaid runs with
securityLevel: strict(no click handlers or HTML labels). sourceUrlonly fetches public addresses: localhost, private networks, link-local and cloud metadata addresses are refused, including through redirects and DNS.
Privacy
Your code and the files it produces stay in your own Apify run storage. Nothing is sent anywhere else, and no personal data is collected.
FAQ
Which Mermaid diagrams work? Mermaid 12: flowchart, sequence, class, state, ER, gantt, pie, mindmap, timeline, journey, git graph, quadrant, sankey, XY chart, block, packet, kanban, architecture and more.
Why did my Mermaid fail with "got 'participant_actor'"? Actor is a Mermaid keyword in sequence diagrams. Rename the participant (for example Renderer). Errors like this are free; fix and retry.
Can I use data from a URL in Vega-Lite? Not inside the spec (rendering is offline). Put the rows under data.values, or fetch the whole spec with sourceUrl.
How long are the files kept? In your run's key-value store, for as long as your Apify plan keeps run storage (named storages keep them forever).
Can I get a transparent PNG? Yes: "background": "transparent".
Other Actors by Fluid Faith
- Visual Regression & Screenshot Diff for AI Agents: production vs preview, percent changed, changed regions and PASS or FAIL per viewport. $0.005 per page pair per viewport.
- Mobile Website Test on iPhone & Android (Mobile QA Gate): PASS or FAIL per page on today's phones, with screenshots. $0.01 per page per phone.
- Lighthouse & Accessibility Audit: Lighthouse scores, Core Web Vitals and axe-core issues with the top 5 fixes. $0.02 per URL per form factor.
- PDF to Markdown with Tables: PDF, Word, PowerPoint and Excel to Markdown with every table as JSON rows. $0.002 per page.
- Video Frame Extractor & Media Probe: ffprobe metadata, frames, scene cuts, a contact sheet and loudness from direct video or audio links. $0.001 per frame.
Load them together as MCP tools: https://mcp.apify.com/?tools=fluidfaith/mermaid-chart-renderer,fluidfaith/visual-diff-gate,fluidfaith/mobile-qa-gate,fluidfaith/lighthouse-gate,fluidfaith/pdf-to-markdown-tables,fluidfaith/media-probe