[server] host = "0.0.0.0" port = 7860 # Max concurrently open client connections (each pins a thread); excess get 503. max_sessions = 256 # Idle timeout waiting for the first byte of a request (keep-alive). read_timeout_sec = 30 # Absolute deadlines from the first byte: full header / full body must arrive # within these, however slowly bytes trickle in (408 otherwise). header_timeout_sec = 10 body_timeout_sec = 30 [worker] default_model = "QuantFactory/Qwen2.5-7B-Instruct-GGUF:q4_k_m" llama_server_bin = "/usr/local/bin/llama-server" host = "127.0.0.1" # Loopback only: the worker has no auth of its own. Only bind wider if the # manager runs on a different host than the worker. bind_host = "127.0.0.1" base_port = 8080 switch_timeout_sec = 300 # Refuse /switch-model when the model cache volume has less free space (MiB). min_free_disk_mb = 512 [llama] n_ctx = 8192 # Set threads to the number of vCPUs actually available; oversubscribing # slows compute-bound generation. Batch sizes feed the BLAS prompt-eval # path — validate changes with tests/bench.py. threads = 2 ngl = 0 batch = 256 ubatch = 128 [auth] header = "Authorization" scheme = "Bearer" # Fail closed: with no usable api keys every authenticated endpoint is 401. # Set true to let unauthenticated callers in with the "user" role (never admin). allow_anonymous = false # Plaintext secrets shorter than this are refused at load time. min_secret_length = 32 [limits] default_max_tokens = 256 max_tokens_per_request = 2048 request_timeout_sec = 30 # Bodies above this get 413 before parsing. max_request_body_bytes = 1048576 [queue] max_size = 100 max_tokens = 20000 admin_quota = 3 retry_after_sec = 5 [scheduler] max_concurrent = 1 [streaming] enabled = false [rate_limit] requests_per_minute = 60 estimated_tokens_per_minute = 6000 # Pre-auth limit per client address, applied to every request (0 = off). per_ip_requests_per_minute = 120 # Use the first X-Forwarded-For hop as the client address (true behind the # HF proxy or any trusted reverse proxy; false if clients connect directly). trust_proxy_headers = true [logging] # Request bodies contain user prompts; only enable for local debugging. log_request_bodies = false [models] # Models /switch-model may load (the default model is always allowed). # Curated candidates for a 2 vCPU / 16 GB host (see docs/MODEL_CANDIDATES_FREE_SPACE.md). allowed = ["QuantFactory/Qwen2.5-7B-Instruct-GGUF:q4_k_m", "unsloth/Qwen3.5-9B-GGUF:Q4_K_M", "unsloth/Qwen3.5-4B-GGUF:Q4_K_M", "LiquidAI/LFM2.5-8B-A1B-GGUF:Q4_K_M", "unsloth/granite-4.0-h-tiny-GGUF:Q4_K_M", "unsloth/gemma-4-E4B-it-GGUF:Q4_K_M", "unsloth/gemma-4-E2B-it-GGUF:Q4_K_M", "unsloth/Qwen3.6-35B-A3B-GGUF:UD-IQ3_XXS"] # API keys. Prefer the API_KEYS environment variable (HF Space secret) in # production: "key_id:role:secret,key_id:role:secret". When API_KEYS is set # the entries below are ignored. Placeholder secrets ("change-me...", "test", # ...) and secrets shorter than min_secret_length are disabled at load time. # Generate one with: openssl rand -hex 24 # Hash one with: printf '%s' "$SECRET" | sha256sum [[api_keys]] key_id = "admin-main" # Either a plaintext secret ... secret = "REPLACE-WITH-32-PLUS-RANDOM-CHARS-admin" role = "admin" enabled = true [[api_keys]] key_id = "user-main" # ... or only its SHA-256 so the plaintext never sits in the config file. secret_sha256 = "0000000000000000000000000000000000000000000000000000000000000000" role = "user" enabled = true