Configuration
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
| Variable | Default | Description |
|---|---|---|
TOKENPRINT_MODEL | Qwen/Qwen2.5-0.5B-Instruct | Hugging Face model ID for the backend PyTorch model. |
TOKENPRINT_REVISION | main | HF revision to pin. Defaults to the resolved commit SHA reported by AutoConfig — the backend runs the exact commit that is resolved, guaranteeing reproducibility. |
TOKENPRINT_DEVICE | auto | Inference target (cpu, mps, or cuda). |
TOKENPRINT_MAX_TOKENS | 40 | Cap for generated new tokens on the backend path. |
TOKENPRINT_FRONTEND_PORT | 3000 | Used to build the CORS allow-list (the dev frontend origin allowed to call the API). |
PORT | 8000 | FastAPI backend HTTP and WebSocket port. |
MAX_GGUF_ENGINES | 2 | Maximum 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.