What it does
Converts HTML or markdown content to a PDF via headless Playwright. Returns the PDF as a base64-encoded string. Use when an agent's output should be a downloadable document — reports, invoices, formatted summaries. Not a default step in most pipelines; use it explicitly when PDF is the right output format.
When to use it
- Agent generates a markdown report → convert to PDF → email to user via NotifyRelay
- Invoice generation for an accounting agent
- Format a research summary for archival
Request schema
{
"from": "md",
"to": "pdf",
"content": "# Report\n\nThis is the body of the report."
} Response schema
{
"from": "md",
"to": "pdf",
"content": "JVBERi0xLjQKJeLjz9MKMS...",
"encoding": "base64",
"size_bytes": 14832
} Code example — TypeScript via MCP
Install the MCP server once; all 16 services become tool calls.
// Configure @melis-ai/x402-tools-mcp in your MCP client
// Then call the tool:
const result = await mcpClient.callTool("docconvert_pdf", {
"from": "md",
"to": "pdf",
"content": "# Report\n\nThis is the body of the report."
});
console.log(result);
// ["from","to","content","encoding","size_bytes"]... → MCP setup guide Code example — Python via direct HTTP
import requests
# x402 payment header must be set by your wallet client
# See x402.org for client libraries
headers = {
"Content-Type": "application/json",
"x-payment": "<signed-x402-payment-header>",
}
resp = requests.post(
"https://docconvert-pdf.melis.ai/convert",
json={
"from": "md",
"to": "pdf",
"content": "# Report\n\nThis is the body of the report."
},
headers=headers,
)
print(resp.json()) Code example — curl with internal key bypass
For testing with an issued internal key (skips x402 payment flow):
curl -X POST https://docconvert-pdf.melis.ai/convert \
-H "Content-Type: application/json" \
-H "x-internal-key: YOUR_KEY" \
-d '{"from":"md","to":"pdf","content":"# Report\n\nThis is the body of the report."}' How is this different from alternatives?
DocConvert-PDF vs pdf/render (Molt Swarm)
pdf/render is the high-fidelity Playwright PDF renderer for full URLs ($0.49). DocConvert-PDF converts raw HTML or markdown content you supply directly ($0.005). Use DocConvert-PDF when you have the content; use pdf/render when you need a pixel-accurate render of a public URL.
FAQ
Does it work without an account?
Yes. x402 is account-less. Your agent's wallet signs the payment and retries automatically. No registration, no API key, no subscription.
What happens on failure?
Returns HTTP 422 for unsupported from/to pairs.
What is the rate limit?
None published.
Is this open-source?
The service code is closed-source for security reasons. The MCP wrapper that calls it is open-source and MIT-licensed: github.com/mizukaizen/x402-tools-mcp .
Who built this?
Part of the melis.ai agent infrastructure stack. Running on a dedicated Helsinki VPS since early 2026. Contact sean@melis.ai.