openreader/docs-site/docs/configure/tts-rate-limiting.md
Richard R 848ee4faad feat(tasks): add document blob lease for safe orphan reaping and improve scheduled task robustness
Introduce a document blob lease mechanism to prevent race conditions between document registration and orphaned blob cleanup. The new `document_blob_leases` table ensures that only one process can claim a document blob for mutation or deletion at a time. Update the orphan reaper to acquire a lease before deleting blobs and to re-check for ownership after acquiring the lease, avoiding accidental deletion of in-flight uploads.

Enhance scheduled task infrastructure with per-task fencing tokens to prevent stale runners from overwriting newer results, enforce runtime limits with abort signals, and expose scheduler mode and minimum interval to the admin panel and API. Adjust task handlers to accept a context with abort support, and update documentation and environment variable references for the new cron secret and scheduling behavior.

BREAKING CHANGE: Scheduled tasks now require a `document_blob_leases` table and updated handler signatures. Vercel deployments must set `CRON_SECRET` for scheduled maintenance.
2026-06-07 12:08:57 -06:00

1.6 KiB

title
TTS Rate Limiting

This page explains OpenReader's TTS character rate limiting controls.

Overview

  • TTS rate limiting is disabled by default.
  • Primary control is Settings → Admin → Site features → Disable TTS daily rate limiting.
  • Limits are enforced per day in UTC.
  • Enforcement applies only when auth is enabled.

How enforcement works

When enabled, OpenReader enforces:

  • Per-user daily character limits.
  • IP backstop daily character limits.
  • Anonymous device backstop tracking (cookie-based) to reduce limit resets.

If a request exceeds the active limit, the TTS API returns 429 with reset metadata for the next UTC day.

Required auth behavior

  • Auth must be enabled (BASE_URL + AUTH_SECRET) for TTS char limits to apply.
  • If auth is disabled, TTS character limits are effectively unlimited.
  • DISABLE_AUTH_RATE_LIMIT only affects Better Auth's own request throttling.
  • DISABLE_AUTH_RATE_LIMIT does not disable TTS character limits.

Runtime config

  • disableTtsRateLimit default: true
  • Per-user and IP backstop limit values are configured in Settings → Admin → Site features and stored in DB runtime settings.
  • Optional first-boot seeding can be done via RUNTIME_SEED_JSON / RUNTIME_SEED_JSON_PATH (runtimeConfig.disableTtsRateLimit).