LaTeX API

Limits

The limits an instance enforces, where to read them and the environment variables that set them.

Limits differ per instance. Read the effective values from the public endpoint:

curl https://latex-api.crafter.run/v1/limits
{
  "maxUploadBytes": 52428800,
  "maxUnpackedBytes": 209715200,
  "maxFiles": 500,
  "maxFileBytes": 52428800,
  "syncTimeoutMs": 60000,
  "jobTimeoutMs": 300000,
  "jobTimeoutMaxMs": 600000,
  "jobMemoryBytes": 2147483648,
  "jobCpus": 2,
  "artifactTtlHours": 24,
  "rateLimitPerKeyPerHour": 60,
  "rateLimitConcurrentPerKey": 5,
  "engines": ["pdflatex", "xelatex", "lualatex"]
}

Reference

FieldDefaultEnvironment variableApplies to
maxUploadBytes50 MBMAX_UPLOAD_BYTESRaw request body (JSON, multipart, zip, tex)
maxUnpackedBytes200 MBMAX_UNPACKED_BYTESSum of all files after decoding / unzipping
maxFiles500MAX_FILESFiles per project
maxFileBytes50 MB(same as upload)One file
syncTimeoutMs60 000SYNC_TIMEOUT_MSPOST /v1/compile, /templates/{id}/compile
jobTimeoutMs300 000JOB_TIMEOUT_MSDefault for jobs when timeoutMs is omitted
jobTimeoutMaxMs600 000JOB_TIMEOUT_MAX_MSHighest timeoutMs a job may request
jobMemoryBytes2 GBJOB_MEMORYContainer memory (and swap) limit
jobCpus2JOB_CPUSContainer CPU quota
n/a64JOB_PIDSProcesses inside the container
n/a2MAX_CONCURRENT_JOBSCompiles running at once on the instance
artifactTtlHours24ARTIFACT_TTL_HOURSHow long jobs, PDFs and logs are kept
rateLimitPerKeyPerHour60RATE_LIMIT_PER_KEY_PER_HOURCompiles per key in a rolling hour
rateLimitConcurrentPerKey5RATE_LIMIT_CONCURRENT_PER_KEYRunning compiles per key
n/a5 / 30DEMO_RATE_LIMIT_PER_MINUTE, DEMO_RATE_LIMIT_PER_DAYDemo endpoint, per IP

Sizes accept suffixes in the environment (50MB, 2GB).

The demo endpoint additionally caps projects at 20 files, 2 MB in total and 1 MB per file, with a 30 s timeout.

When you hit one

SymptomCodeWhat to do
413 payload_too_largeupload / unpacked / filesCompress images, drop build artifacts from the zip
408 timeout on /v1/compilesyncTimeoutMsUse /v1/jobs with a larger timeoutMs
Job timed_outjobTimeoutMaxMsSplit the document or ask the operator
429 rate_limitedper keyWait Retry-After seconds; batch with jobs
Container killed, empty logJOB_MEMORYLarge TikZ/pgfplots; externalise is unavailable, simplify

On this page