# x402-gateway Mermaid Diagram Renderer

> x402-gateway Mermaid Diagram Renderer is a paid API for AI agents from x402.freeq.one, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-15).

Renders a Mermaid diagram definition string into a PNG or SVG image, returning a base64-encoded image via MCP content type.

## Facts

- Endpoint: POST https://x402.freeq.one/tools/mermaid
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-gateway-mermaid-diagram-renderer-d87495ce
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_XN7tvz41NQNAMiIDYKrMC

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-gateway-mermaid-diagram-renderer-d87495ce -d '<json body>'
```

Example prompt: Take this Mermaid flowchart definition and render it as a PNG using the dark theme at 2x scale: `graph TD; A[Start] --> B{Decision}; B -->|Yes| C[Action]; B -->|No| D[End]`

## When to prefer this

Choose this endpoint when you need to convert Mermaid diagram syntax into an actual image (PNG or SVG) programmatically within an agent workflow, especially when you want theme control and resolution scaling. Prefer it over client-side rendering when a server-rendered image artifact is needed (e.g. for embedding in documents, emails, or reports).

## Known failure modes

- Invalid Mermaid syntax causes render failure or error response
- Unsupported format or theme value returns validation error
- Scale value outside 1–4 range for PNG causes rejection
- Scale parameter ignored or rejected for SVG format
- Network timeout if diagram is very complex
- Payment failure (402) if USDC balance is insufficient

## How this service works

x402-gateway tool: mermaid — Render a Mermaid diagram to an image (PNG or SVG). Returns a base64-encoded image (MCP content type image). Options: format (png|svg), theme (default|dark|forest|neutral), scale (1-4, PNG only).

## Output

A base64-encoded image (PNG or SVG) returned as MCP content type image, ready to be decoded and displayed or saved. PNG supports scale factors 1–4 for higher resolution output; SVG is vector and resolution-independent.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "code": {
   "type": "string",
   "description": "Mermaid diagram source code, e.g. 'graph TD; A-->B'. Max 50000 chars."
  },
  "scale": {
   "type": "number",
   "description": "Raster scale 1-4, PNG only (default 2)."
  },
  "theme": {
   "enum": [
    "default",
    "dark",
    "forest",
    "neutral"
   ],
   "type": "string",
   "description": "Mermaid theme (default 'default')."
  },
  "format": {
   "enum": [
    "png",
    "svg"
   ],
   "type": "string",
   "description": "Output format (default png). SVG returns vector text."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-gateway-mermaid-diagram-renderer-d87495ce/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.freeq.one](https://www.zero.xyz/host/x402.freeq.one/llms.txt)
