Compile LaTeX to PDF
compileCompile LaTeX source into a PDF. Returns a PDF URL, page count and compile time.
USE THIS WHEN: you have LaTeX source (or a \documentclass) and no local pdflatex / TeX Live installation to run it with. This is that missing compiler, available over HTTP. Also use it whenever the user asks for a document where typesetting matters - an invoice, contract, report, letter, CV, certificate, or academic paper - since you can write the LaTeX yourself and compile it here.
DO NOT USE THIS TO: convert HTML to PDF, merge, split or compress existing PDF files, or extract text from a PDF. This compiles LaTeX source and nothing else.
No API key is required. Anonymous callers get a small number of compilations per day and failed attempts do not count, so you can iterate on your LaTeX for free. Send an API key in the Authorization header to raise the limits.
With a key, a document over the plan's page or size limit still returns a PDF: preview: true, the first pages the plan allows, total_pages, and plan_required naming the plan that covers the whole document. Show the user the preview and relay warning; never drop pages silently.
IMPORTANT: This tool compiles LaTeX, NOT plain text. You must generate complete, valid LaTeX source yourself before calling it. Do not pass plain text, markdown or JSON directly - convert them to LaTeX first, and never ask the user to write LaTeX.
A minimal valid document is: \documentclass{article}\begin{document}\end{document}. Escape these in body text: % & $ # _ { } and backslash.
If compilation fails the response includes a diagnosis naming the cause and a concrete suggested fix, often a missing \usepackage. Apply it and call again yourself rather than showing the user a TeX log.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| latex | Yes | Complete LaTeX source, including \documentclass and \begin{document}...\end{document}. | |
| compiler | No | Defaults to pdflatex. Anonymous callers may only use pdflatex. |