Spaces:
Sleeping

File size: 3,480 Bytes
d9ce859
 
 
6471a06
 
7a18d61
6471a06
7a18d61
 
 
 
d9ce859
 
 
 
 
30c6ca2
 
 
d9ce859
 
6dc320d
 
d9ce859
 
 
27c1c3c
 
 
 
d9ce859
27c1c3c
 
d9ce859
 
 
 
6471a06
 
 
 
 
d9ce859
 
 
 
 
6471a06
 
d9ce859
 
 
 
 
 
 
 
 
 
332826f
 
 
d9ce859
 
 
6471a06
 
 
 
 
d9ce859
6471a06
 
 
 
 
 
7a18d61
 
6471a06
 
 
 
 
 
 
d9ce859
 
6471a06
 
d9ce859
 
 
 
 
6471a06
 
d9ce859
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
[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