Octree LogoOctree

Compile API

A high-performance LaTeX compilation service featuring intelligent caching and incremental compilation for fast PDF generation.

Base URL

https://compile.useoctree.com

Performance

Up to 49x faster on cache hits (~10ms) and 30-40% faster on text edits.

GETHealth Check

Verify the compilation service is running and accessible.

curl https://compile.useoctree.com/health

POSTCompile Multi-File Project

Recommended

Send a JSON payload with multiple files, assets, and project identifiers to take full advantage of intelligent caching and incremental compilation.

Headers

Content-Type:application/json

Payload Parameters

files
Array
Array of objects containing path and content for each file.
projectId
String
Unique identifier for the project. Essential for enabling caching across requests.
lastModifiedFile
String (Optional)
Hint for the compiler to optimize incremental rebuilds.

Example Request

curl -X POST https://compile.useoctree.com/compile \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{ 
    "files": [
      {
        "path": "main.tex",
        "content": "\\documentclass{article}\n\\begin{document}\nHello World!\n\\end{document}"
      }
    ],
    "projectId": "my-project-123",
    "lastModifiedFile": "main.tex"
  }' \
  --output output.pdf

Response Structure

// Returns binary PDF data directly.
Content-Type: application/pdf
Content-Disposition: attachment; filename="output.pdf"

Caching & Performance Strategy

When providing a projectId in the JSON payload, the API uses a robust caching strategy to optimize compilation times significantly:

Content Hashing

Entire file sets are hashed. If the hash matches a cached entry, the resulting PDF is returned instantly in approximately 10ms.

Incremental Builds

Temp directories preserve .aux and .bbl files. When only .tex files change, the compiler intelligently skips bibtex, resulting in 30-40% faster compiles.

Eviction Policy

Projects are automatically evicted from memory after 30 minutes of inactivity, with a maximum of 15 actively cached projects maintained via an LRU cache.

Interested in an API key for this endpoint? Reach out for API key at basil@useoctree.online for $20 USD / month (unlimited files).