Skip to Content

Configuration

Every setting of the configuration file and the environment variables

Papyrus reads one YAML file and a few environment variables. Every key is optional and shows its default below; change only what your deployment needs. ocr is not set by default, see OCR.

workers:
  processes: auto
  max_queue: 64
  warmup: true

limits:
  max_file_size: 100MB
  deadline: 300

http:
  enabled: true
  allow_private: false
  allowed_hosts: []
  timeout: 30
  max_redirects: 5
  locale: en-US

browser:
  sandbox: false

cors:
  allow_origins: []

connectors: {}
  • Unknown keys stop the server at startup.
  • Durations are in seconds. Sizes take units such as 100MB or 2MiB.
  • ${VAR} in any value is replaced with the environment variable VAR. If it is not set, the server does not start.

Workers

KeyDefaultMeaning
processesautoWorker processes per pool. auto is one per CPU the container sees; set it to your CPU limit, see sizing
max_queue64Requests one container handles at once. Beyond it requests fail with 503 queue_full and /ready reports not_ready
warmuptrueStart every worker and the browser at startup, so the first requests do not wait. Startup fails if a component cannot start

Limits

KeyDefaultMeaning
max_file_size100MBLargest document, uploaded or downloaded. Larger ones fail with 413
deadline300Seconds a whole request may take before 504 deadline_exceeded
tmp_dirsystem temp + /papyrusFolder for files while a request runs; every request removes its own files

Fetching URLs

These settings apply to URL sources and to everything a screenshot page loads.

KeyDefaultMeaning
enabledtruefalse rejects every http(s) source with 403 source_forbidden
allow_privatefalseAllow URLs that resolve to private or internal addresses. Keep it off in production
allowed_hosts[]When set, only these hostnames can be fetched, e.g. [docs.axelered.com]
timeout30Seconds per download
max_redirects5Redirects followed per download
localeen-USLanguage asked of remote sites, as a BCP 47 tag such as it-IT or de. Downloads send it as Accept-Language, screenshots use it as the browser language, so sites that translate serve that version. It does not translate content. null lets each site decide

Browser

KeyDefaultMeaning
sandboxfalseRun Chromium in its sandbox. Needs a runtime that allows unprivileged user namespaces; see security

OCR

A vision model on a remote server reads page images. With this section, Markdown requests in the default readMode: auto send it scans, images and presentations, and readMode: ocr sends it every page. Without it OCR is off: auto reads every document as text, ocr fails with 422 ocr_not_configured, and no document leaves the server. A deployment has one backend, and requests cannot choose another. OCR compares the two.

With a Qwen VL model on any OpenAI-compatible server, such as vLLM, Ollama or OpenRouter:

ocr:
  type: qwen
  model: Qwen/Qwen3-VL-8B-Instruct
  url: http://vllm:8000/v1
  api_key: ${OCR_API_KEY}

With Mistral OCR:

ocr:
  type: mistral
  api_key: ${MISTRAL_API_KEY}
KeyDefaultMeaning
typerequiredqwen or mistral. Selects the API and the prompt, so use qwen with Qwen VL models
modelmistral-ocr-latestModel name on the server. Required for qwen
urlMistral APIBase URL of the API, private addresses included. Required for qwen, optional for mistral
api_keynoneKey of the backend. Required for mistral
concurrency8Pages read at once by one container; every replica adds its own
max_pages100Longest document read with OCR. Longer ones are read as text in auto and fail with 413 too_many_pages in ocr. Raise limits.deadline with it
extra_body{}qwen only. Extra fields sent with every call, for example chat_template_kwargs: {enable_thinking: false} to turn off reasoning on vLLM

The backend is not contacted at startup, so its outages do not affect /ready. See security for where documents go.

CORS

Browsers block web pages on other origins from calling Papyrus unless their origin is listed here. Server-side callers are not affected.

KeyDefaultMeaning
allow_origins[]Origins allowed to call the API from a browser, as scheme://host[:port] without a trailing slash, e.g. [https://app.axelered.com]. ["*"] allows any origin

Allowed origins can send GET and POST requests with the Authorization, Content-Type and X-Request-ID headers, and read the X-Request-ID, Server-Timing and Content-Disposition response headers. Cookies are never accepted. Every request still needs an API key, which a browser client holds in its own code.

Storage connectors

A connector names a storage location that requests address as <protocol>://<name>/<path>. The image includes the s3 protocol, for AWS S3 and S3-compatible storage such as MinIO or Cloudflare R2:

connectors:
  prod:
    protocol: s3
    options:
      endpoint_url: https://s3.eu-central-1.amazonaws.com
      key: ${PROD_S3_KEY}
      secret: ${PROD_S3_SECRET}

Requests then read and write s3://prod/<key>. options are passed as is to the s3fs filesystem, so any s3fs option works, such as client_kwargs: {region_name: eu-central-1}. Keep credentials in environment variables and reference them with ${VAR}; the startup log lists connector names, never their options.

An unknown protocol stops the server at startup with the reason.

Environment variables

VariableMeaning
PAPYRUS_API_KEYAccepted API keys, comma separated. Required unless auth is disabled
PAPYRUS_CONFIGPath of the configuration file, default /etc/papyrus/config.yml
PAPYRUS_LOG_LEVELdebug, info (default), warning or error
PAPYRUS_LOG_FORMATtext (default) or json
PAPYRUS_AUTH_DISABLEDtrue turns off authentication. Local development only
PAPYRUS_TIMINGtrue adds a Server-Timing header with stage durations. Profiling only: it reveals internal timings

On this page