Configuration

Reference

TokenPrint can be configured via backend environment variables (.env) or CLI flags. The supported launcher (python3 scripts/start.py) also exposes --model and --revision flags.


Environment Variables

VariableDefaultDescription
TOKENPRINT_MODELQwen/Qwen2.5-0.5B-InstructHugging Face model ID for the backend PyTorch model.
TOKENPRINT_REVISIONmainHF revision to pin. Defaults to the resolved commit SHA reported by AutoConfig — the backend runs the exact commit that is resolved, guaranteeing reproducibility.
TOKENPRINT_DEVICEautoInference target (cpu, mps, or cuda).
TOKENPRINT_MAX_TOKENS40Cap for generated new tokens on the backend path.
TOKENPRINT_FRONTEND_PORT3000Used to build the CORS allow-list (the dev frontend origin allowed to call the API).
PORT8000FastAPI backend HTTP and WebSocket port.
MAX_GGUF_ENGINES2Maximum resident GGUF engines in the LRU cache (min 1). See API Reference.
Tip

python3 scripts/start.py --model MODEL --revision COMMIT sets TOKENPRINT_MODEL and TOKENPRINT_REVISION, verifies prerequisites (Python 3.11/3.12, Node 20.9+), and starts both services.


Frontend Settings

Frontend configuration options (such as WebGL rendering precision, maximum FPS cap, and auto-scroll behavior) can be adjusted in the App Settings panel or persisted in localStorage.

The browser GPT-2 engine adds two per-run choices —device (WebGPU or WASM) and a token cap up to 32 — made in the Generation controls. See Browser GPT-2.