pdfpeek: render Mermaid diagram code to an SVG or PNG image
render_mermaidpdfpeek: Render Mermaid diagram code to an SVG or PNG image. Returns Mermaid diagram code drawn as an SVG or PNG file in an offline sandboxed browser: format svg | png, theme (default, dark, forest, neutral, base), scale 1-4 for PNG (default 2, sharp when zoomed). File base64 in file (output=url gives a 24 h link). A syntax error is a 422 invalid_diagram with the line number; over 8,000 x 8,000 px a 422, a PNG over 8 MB a 413 (none charged). Mermaid 11.4.1, strict security, no network. Typically 1-3 s. Price: USD 0.003. No free tier.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Mermaid diagram source (flowchart, sequence, class, state, ER, gantt, pie, git graph, mindmap, timeline and the other types of mermaid 11.4.1), 1-20,000 characters. Fenced ``` lines are not needed. A syntax error is a 422 with the line number. | |
| scale | No | PNG pixel density, 1-4 (default 2, sharp when zoomed). Lowered automatically so the longest side stays at 8,000 px. Ignored for svg. | |
| theme | No | Mermaid theme. dark gives a dark background in PNG; the others a white one. | default |
| format | No | svg (default, scalable, plain text labels) or png. | svg |
| output | No | base64 (default): the file comes back inline as base64. url: the file is stored for 24 hours and the reply carries a download link (url, expires_at, bytes, content_type, sha256) instead of the base64, which keeps the file out of your context window. | base64 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ||
| error | No | Only on an error result: an object {code, message}, or the reason string of an x402 PaymentRequired object. | |
| scale | No | ||
| theme | No | ||
| width | No | ||
| format | No | ||
| height | No | ||
| operation | No | ||
| output_bytes | No |