bots-garden/razorbillpublic Fork
⑂ a6959e4
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

#53 docs EN+FR: /rzb admin routes, reload, unload; quality run #36

Reference: /rzb section of the HTTP API, error codes local_only, model_busy,
no_config_file, invalid_config, SIGHUP in rzb serve, what a reload changes.
How-to: watch and steer a running server. Explanation: routes of our own
under /rzb (amended #31 rule, loopback only, polling), unloading on demand
and reloading in the model lifecycle. test_docs_curl now runs the /rzb and
/health examples too. Quality gate PASS (0/0/0, complexity 588).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k33g committed 2026-11-26T22:40:21+01:00 Browse files
a6959e4 parent: cb5a310
modified .quality/history.jsonl +1 -0
@@ -33,3 +33,4 @@
3333 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "83271da", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 547, "cyclo": 605, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10687, "loc": 8507}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 33, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:05:13Z"}
3434 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "f95af71", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 547, "cyclo": 605, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10687, "loc": 8507}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 34, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:17:19Z"}
3535 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "caefc12", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 548, "cyclo": 606, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10692, "loc": 8510}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 35, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:42:16Z"}
36+{"branch": "feature/v0.3-tui", "breaches": [], "commit": "cb5a310", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 262, "complex": 588, "cyclo": 649, "fields": 1364, "funcs": 667, "lcom": 124, "lines": 12110, "loc": 9587}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 36, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T21:35:08Z"}
@@ -33,3 +33,4 @@
33 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "83271da", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 547, "cyclo": 605, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10687, "loc": 8507}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 33, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:05:13Z"}33 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "83271da", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 547, "cyclo": 605, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10687, "loc": 8507}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 33, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:05:13Z"}
34 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "f95af71", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 547, "cyclo": 605, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10687, "loc": 8507}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 34, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:17:19Z"}34 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "f95af71", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 547, "cyclo": 605, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10687, "loc": 8507}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 34, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:17:19Z"}
35 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "caefc12", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 548, "cyclo": 606, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10692, "loc": 8510}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 35, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:42:16Z"}35 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "caefc12", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 548, "cyclo": 606, "fields": 1210, "funcs": 583, "lcom": 115, "lines": 10692, "loc": 8510}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 35, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T14:42:16Z"}
36+{"branch": "feature/v0.3-tui", "breaches": [], "commit": "cb5a310", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 262, "complex": 588, "cyclo": 649, "fields": 1364, "funcs": 667, "lcom": 124, "lines": 12110, "loc": 9587}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 36, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T21:35:08Z"}
added .quality/report-20261126T213508Z.md +73 -0
new file mode 100644
@@ -0,0 +1,73 @@
1+# Quality report — 2026-11-26T21:35:08Z
2+
3+- **Gate**: ✅ **PASS**
4+- **Commit**: `cb5a310` on `feature/v0.3-tui`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #36 (previous: 2026-11-26T14:42:16Z)
8+
9+## Lint issues (`qlty check`)
10+
11+_none_
12+
13+### Top rules
14+
15+_none_
16+
17+### Most affected files
18+
19+_none_
20+
21+## Code smells (`qlty smells`)
22+
23+Total: **0** (vs previous: ±0)
24+
25+_none_
26+
27+## Metrics (`qlty metrics`)
28+
29+| metric | total | vs previous |
30+|---|---|---|
31+| funcs | 667 | +84 |
32+| classes | 262 | +28 |
33+| fields | 1364 | +154 |
34+| cyclo | 649 | +43 |
35+| complex | 588 | +40 |
36+| lcom | 124 | +9 |
37+| lines | 12110 | +1418 |
38+| loc | 9587 | +1077 |
39+
40+### Most complex files
41+
42+| file | complex | cyclo | loc |
43+|---|---|---|---|
44+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 242 |
45+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
46+| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
47+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
48+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |
49+| tools/host-runner/host_runner.py | 23 | 23 | 144 |
50+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
51+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
52+| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
53+| Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 |
54+| Sources/RazorbillServer/Chat/ChatCompletionChunk.swift | 16 | 11 | 137 |
55+| Sources/RazorbillCore/Config/OrderedJSONReader.swift | 15 | 24 | 140 |
56+| Sources/RazorbillCore/Config/GenerationOverrides.swift | 14 | 15 | 67 |
57+| Sources/RazorbillCLI/Commands/ModelsCommand.swift | 13 | 7 | 100 |
58+| Sources/RazorbillServer/EmbeddingsRoute.swift | 13 | 13 | 143 |
59+
60+## Trend
61+
62+| run | timestamp | error | warning | smells | complex | gate |
63+|---|---|---|---|---|---|---|
64+| 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
65+| 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
66+| 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
67+| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS |
68+| 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS |
69+| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS |
70+| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
71+| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
72+| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
73+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
new file mode 100644
@@ -0,0 +1,73 @@
1+# Quality report — 2026-11-26T21:35:08Z
2+
3+- **Gate**: ✅ **PASS**
4+- **Commit**: `cb5a310` on `feature/v0.3-tui`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #36 (previous: 2026-11-26T14:42:16Z)
8+
9+## Lint issues (`qlty check`)
10+
11+_none_
12+
13+### Top rules
14+
15+_none_
16+
17+### Most affected files
18+
19+_none_
20+
21+## Code smells (`qlty smells`)
22+
23+Total: **0** (vs previous: ±0)
24+
25+_none_
26+
27+## Metrics (`qlty metrics`)
28+
29+| metric | total | vs previous |
30+|---|---|---|
31+| funcs | 667 | +84 |
32+| classes | 262 | +28 |
33+| fields | 1364 | +154 |
34+| cyclo | 649 | +43 |
35+| complex | 588 | +40 |
36+| lcom | 124 | +9 |
37+| lines | 12110 | +1418 |
38+| loc | 9587 | +1077 |
39+
40+### Most complex files
41+
42+| file | complex | cyclo | loc |
43+|---|---|---|---|
44+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 242 |
45+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
46+| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
47+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
48+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |
49+| tools/host-runner/host_runner.py | 23 | 23 | 144 |
50+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
51+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
52+| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
53+| Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 |
54+| Sources/RazorbillServer/Chat/ChatCompletionChunk.swift | 16 | 11 | 137 |
55+| Sources/RazorbillCore/Config/OrderedJSONReader.swift | 15 | 24 | 140 |
56+| Sources/RazorbillCore/Config/GenerationOverrides.swift | 14 | 15 | 67 |
57+| Sources/RazorbillCLI/Commands/ModelsCommand.swift | 13 | 7 | 100 |
58+| Sources/RazorbillServer/EmbeddingsRoute.swift | 13 | 13 | 143 |
59+
60+## Trend
61+
62+| run | timestamp | error | warning | smells | complex | gate |
63+|---|---|---|---|---|---|---|
64+| 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
65+| 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
66+| 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
67+| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS |
68+| 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS |
69+| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS |
70+| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
71+| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
72+| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
73+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
modified .quality/report-latest.md +13 -13
@@ -1,10 +1,10 @@
1-# Quality report — 2026-11-26T14:42:16Z
1+# Quality report — 2026-11-26T21:35:08Z
22
33 - **Gate**: ✅ **PASS**
4-- **Commit**: `caefc12` on `feature/v0.2-openai-server`
4+- **Commit**: `cb5a310` on `feature/v0.3-tui`
55 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
66 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7-- **Run**: #35 (previous: 2026-11-26T14:17:19Z)
7+- **Run**: #36 (previous: 2026-11-26T14:42:16Z)
88
99 ## Lint issues (`qlty check`)
1010
@@ -28,14 +28,14 @@ _none_
2828
2929 | metric | total | vs previous |
3030 |---|---|---|
31-| funcs | 583 | ±0 |
32-| classes | 234 | ±0 |
33-| fields | 1210 | ±0 |
34-| cyclo | 606 | +1 |
35-| complex | 548 | +1 |
36-| lcom | 115 | ±0 |
37-| lines | 10692 | +5 |
38-| loc | 8510 | +3 |
31+| funcs | 667 | +84 |
32+| classes | 262 | +28 |
33+| fields | 1364 | +154 |
34+| cyclo | 649 | +43 |
35+| complex | 588 | +40 |
36+| lcom | 124 | +9 |
37+| lines | 12110 | +1418 |
38+| loc | 9587 | +1077 |
3939
4040 ### Most complex files
4141
@@ -44,6 +44,7 @@ _none_
4444 | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 242 |
4545 | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
4646 | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
47+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
4748 | Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |
4849 | tools/host-runner/host_runner.py | 23 | 23 | 144 |
4950 | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
@@ -51,7 +52,6 @@ _none_
5152 | Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
5253 | Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 |
5354 | Sources/RazorbillServer/Chat/ChatCompletionChunk.swift | 16 | 11 | 137 |
54-| Sources/RazorbillServer/ModelManager.swift | 16 | 22 | 220 |
5555 | Sources/RazorbillCore/Config/OrderedJSONReader.swift | 15 | 24 | 140 |
5656 | Sources/RazorbillCore/Config/GenerationOverrides.swift | 14 | 15 | 67 |
5757 | Sources/RazorbillCLI/Commands/ModelsCommand.swift | 13 | 7 | 100 |
@@ -61,7 +61,6 @@ _none_
6161
6262 | run | timestamp | error | warning | smells | complex | gate |
6363 |---|---|---|---|---|---|---|
64-| 26 | 2026-11-25T21:38:24Z | 0 | 0 | 0 | 544 | PASS |
6564 | 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
6665 | 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
6766 | 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
@@ -71,3 +70,4 @@ _none_
7170 | 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
7271 | 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
7372 | 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
73+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
@@ -1,10 +1,10 @@
1-# Quality report — 2026-11-26T14:42:16Z1+# Quality report — 2026-11-26T21:35:08Z
2 2
3 - **Gate**: ✅ **PASS**3 - **Gate**: ✅ **PASS**
4-- **Commit**: `caefc12` on `feature/v0.2-openai-server`4+- **Commit**: `cb5a310` on `feature/v0.3-tui`
5 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)5 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)6 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7-- **Run**: #35 (previous: 2026-11-26T14:17:19Z)7+- **Run**: #36 (previous: 2026-11-26T14:42:16Z)
8 8
9 ## Lint issues (`qlty check`)9 ## Lint issues (`qlty check`)
10 10
@@ -28,14 +28,14 @@ _none_
28 28
29 | metric | total | vs previous |29 | metric | total | vs previous |
30 |---|---|---|30 |---|---|---|
31-| funcs | 583 | ±0 |31+| funcs | 667 | +84 |
32-| classes | 234 | ±0 |32+| classes | 262 | +28 |
33-| fields | 1210 | ±0 |33+| fields | 1364 | +154 |
34-| cyclo | 606 | +1 |34+| cyclo | 649 | +43 |
35-| complex | 548 | +1 |35+| complex | 588 | +40 |
36-| lcom | 115 | ±0 |36+| lcom | 124 | +9 |
37-| lines | 10692 | +5 |37+| lines | 12110 | +1418 |
38-| loc | 8510 | +3 |38+| loc | 9587 | +1077 |
39 39
40 ### Most complex files40 ### Most complex files
41 41
@@ -44,6 +44,7 @@ _none_
44 | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 242 |44 | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 242 |
45 | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |45 | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
46 | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |46 | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
47+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
47 | Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |48 | Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |
48 | tools/host-runner/host_runner.py | 23 | 23 | 144 |49 | tools/host-runner/host_runner.py | 23 | 23 | 144 |
49 | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |50 | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
@@ -51,7 +52,6 @@ _none_
51 | Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |52 | Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
52 | Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 |53 | Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 |
53 | Sources/RazorbillServer/Chat/ChatCompletionChunk.swift | 16 | 11 | 137 |54 | Sources/RazorbillServer/Chat/ChatCompletionChunk.swift | 16 | 11 | 137 |
54-| Sources/RazorbillServer/ModelManager.swift | 16 | 22 | 220 |
55 | Sources/RazorbillCore/Config/OrderedJSONReader.swift | 15 | 24 | 140 |55 | Sources/RazorbillCore/Config/OrderedJSONReader.swift | 15 | 24 | 140 |
56 | Sources/RazorbillCore/Config/GenerationOverrides.swift | 14 | 15 | 67 |56 | Sources/RazorbillCore/Config/GenerationOverrides.swift | 14 | 15 | 67 |
57 | Sources/RazorbillCLI/Commands/ModelsCommand.swift | 13 | 7 | 100 |57 | Sources/RazorbillCLI/Commands/ModelsCommand.swift | 13 | 7 | 100 |
@@ -61,7 +61,6 @@ _none_
61 61
62 | run | timestamp | error | warning | smells | complex | gate |62 | run | timestamp | error | warning | smells | complex | gate |
63 |---|---|---|---|---|---|---|63 |---|---|---|---|---|---|---|
64-| 26 | 2026-11-25T21:38:24Z | 0 | 0 | 0 | 544 | PASS |
65 | 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |64 | 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
66 | 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |65 | 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
67 | 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |66 | 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
@@ -71,3 +70,4 @@ _none_
71 | 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |70 | 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
72 | 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |71 | 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
73 | 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |72 | 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
73+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
modified Tests/Compatibility/test_docs_curl.py +11 -7
@@ -1,9 +1,11 @@
11 """The `curl` examples of the API reference run against the server and answer without error.
22
3-Every fenced `bash` block of `docs/*/reference/*.md` that calls `http://127.0.0.1:7920/v1` is
4-run, with the address replaced by the server under test and the documentation's models by the
5-suite's (`chat`, `embed`). An example that needs a real model says so with a `# real model`
6-comment in its block.
3+Every fenced `bash` block of `docs/*/reference/*.md` that calls `http://127.0.0.1:7920` (the
4+`/v1` API, `/health` and the local `/rzb` routes) is run, with the address replaced by the server
5+under test and the documentation's models by the suite's (`chat`, `embed`), in JSON bodies and in
6+`/rzb/models/{id}/…` paths. An example that needs a real model says so with a `# real model`
7+comment in its block. `scripts/compat.sh` starts the server with `--config`, so the reload example
8+re-reads the same file.
79 """
810
911 import json
@@ -17,7 +19,8 @@ import pytest
1719 from conftest import BASE_URL
1820
1921 ROOT = Path(__file__).resolve().parents[2]
20-DOCS_ADDRESS = "http://127.0.0.1:7920/v1"
22+DOCS_ADDRESS = "http://127.0.0.1:7920"
23+SERVED_ADDRESS = BASE_URL.removesuffix("/v1")
2124 DOCS_MODELS = {
2225 "mlx-community/Qwen3-4B-4bit": "chat",
2326 "BAAI/bge-small-en-v1.5": "embed",
@@ -29,7 +32,7 @@ def examples():
2932 found = []
3033 for page in sorted(ROOT.glob("docs/*/reference/*.md")):
3134 for number, block in enumerate(BLOCK.findall(page.read_text())):
32- if "curl" in block and DOCS_ADDRESS in block:
35+ if "curl" in block and f"{DOCS_ADDRESS}/" in block:
3336 found.append(pytest.param(block, id=f"{page.relative_to(ROOT)}#{number}"))
3437 return found or [pytest.param("", marks=pytest.mark.skip("no curl example in the docs yet"))]
3538
@@ -46,9 +49,10 @@ def outputs_are_valid(output):
4649 def test_curl_example(block, fake_engine):
4750 if fake_engine and "# real model" in block:
4851 pytest.skip("needs a real model (the server runs the fake engine)")
49- script = block.replace(DOCS_ADDRESS, BASE_URL)
52+ script = block.replace(DOCS_ADDRESS, SERVED_ADDRESS)
5053 for documented, served in DOCS_MODELS.items():
5154 script = script.replace(f'"{documented}"', f'"{served}"')
55+ script = script.replace(f"/rzb/models/{documented}/", f"/rzb/models/{served}/")
5256 env = {**os.environ, "RZB_API_KEY": os.environ.get("RZB_API_KEY", "unused")}
5357 done = subprocess.run(
5458 ["bash", "-euo", "pipefail", "-c", script],
@@ -1,9 +1,11 @@
1 """The `curl` examples of the API reference run against the server and answer without error.1 """The `curl` examples of the API reference run against the server and answer without error.
2 2
3-Every fenced `bash` block of `docs/*/reference/*.md` that calls `http://127.0.0.1:7920/v1` is3+Every fenced `bash` block of `docs/*/reference/*.md` that calls `http://127.0.0.1:7920` (the
4-run, with the address replaced by the server under test and the documentation's models by the4+`/v1` API, `/health` and the local `/rzb` routes) is run, with the address replaced by the server
5-suite's (`chat`, `embed`). An example that needs a real model says so with a `# real model`5+under test and the documentation's models by the suite's (`chat`, `embed`), in JSON bodies and in
6-comment in its block.6+`/rzb/models/{id}/…` paths. An example that needs a real model says so with a `# real model`
7+comment in its block. `scripts/compat.sh` starts the server with `--config`, so the reload example
8+re-reads the same file.
7 """9 """
8 10
9 import json11 import json
@@ -17,7 +19,8 @@ import pytest
17 from conftest import BASE_URL19 from conftest import BASE_URL
18 20
19 ROOT = Path(__file__).resolve().parents[2]21 ROOT = Path(__file__).resolve().parents[2]
20-DOCS_ADDRESS = "http://127.0.0.1:7920/v1"22+DOCS_ADDRESS = "http://127.0.0.1:7920"
23+SERVED_ADDRESS = BASE_URL.removesuffix("/v1")
21 DOCS_MODELS = {24 DOCS_MODELS = {
22 "mlx-community/Qwen3-4B-4bit": "chat",25 "mlx-community/Qwen3-4B-4bit": "chat",
23 "BAAI/bge-small-en-v1.5": "embed",26 "BAAI/bge-small-en-v1.5": "embed",
@@ -29,7 +32,7 @@ def examples():
29 found = []32 found = []
30 for page in sorted(ROOT.glob("docs/*/reference/*.md")):33 for page in sorted(ROOT.glob("docs/*/reference/*.md")):
31 for number, block in enumerate(BLOCK.findall(page.read_text())):34 for number, block in enumerate(BLOCK.findall(page.read_text())):
32- if "curl" in block and DOCS_ADDRESS in block:35+ if "curl" in block and f"{DOCS_ADDRESS}/" in block:
33 found.append(pytest.param(block, id=f"{page.relative_to(ROOT)}#{number}"))36 found.append(pytest.param(block, id=f"{page.relative_to(ROOT)}#{number}"))
34 return found or [pytest.param("", marks=pytest.mark.skip("no curl example in the docs yet"))]37 return found or [pytest.param("", marks=pytest.mark.skip("no curl example in the docs yet"))]
35 38
@@ -46,9 +49,10 @@ def outputs_are_valid(output):
46 def test_curl_example(block, fake_engine):49 def test_curl_example(block, fake_engine):
47 if fake_engine and "# real model" in block:50 if fake_engine and "# real model" in block:
48 pytest.skip("needs a real model (the server runs the fake engine)")51 pytest.skip("needs a real model (the server runs the fake engine)")
49- script = block.replace(DOCS_ADDRESS, BASE_URL)52+ script = block.replace(DOCS_ADDRESS, SERVED_ADDRESS)
50 for documented, served in DOCS_MODELS.items():53 for documented, served in DOCS_MODELS.items():
51 script = script.replace(f'"{documented}"', f'"{served}"')54 script = script.replace(f'"{documented}"', f'"{served}"')
55+ script = script.replace(f"/rzb/models/{documented}/", f"/rzb/models/{served}/")
52 env = {**os.environ, "RZB_API_KEY": os.environ.get("RZB_API_KEY", "unused")}56 env = {**os.environ, "RZB_API_KEY": os.environ.get("RZB_API_KEY", "unused")}
53 done = subprocess.run(57 done = subprocess.run(
54 ["bash", "-euo", "pipefail", "-c", script],58 ["bash", "-euo", "pipefail", "-c", script],
modified docs/diagrams/packages.drawio +2 -2
@@ -22,7 +22,7 @@
2222 <mxCell id="cli" value="&lt;b&gt;RazorbillCLI&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;commands: serve, config validate, models, version; console I/O, request log&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1">
2323 <mxGeometry x="80" y="260" width="280" height="70" as="geometry" />
2424 </mxCell>
25- <mxCell id="server" value="&lt;b&gt;RazorbillServer&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;OpenAI-compatible HTTP API: routes, streaming (SSE), errors, API key, model manager. No MLX.&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1">
25+ <mxCell id="server" value="&lt;b&gt;RazorbillServer&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;OpenAI-compatible HTTP API: routes, streaming (SSE), errors, API key, model manager; local /rzb admin routes (status, unload, config reload). No MLX.&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1">
2626 <mxGeometry x="80" y="400" width="280" height="70" as="geometry" />
2727 </mxCell>
2828 <mxCell id="mlx" value="&lt;b&gt;RazorbillMLX&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;MLX engines: chat, raw completion, thinking budget, constrained decoding, embeddings (empty on Linux)&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;shadow=1;" vertex="1" parent="1">
@@ -44,7 +44,7 @@
4444 <mxCell id="tokenizers" value="&lt;b&gt;swift-transformers&lt;/b&gt; (Tokenizers)&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;tokenizers and chat templates&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
4545 <mxGeometry x="820" y="400" width="340" height="50" as="geometry" />
4646 </mxCell>
47- <mxCell id="hummingbird" value="&lt;b&gt;Hummingbird 2&lt;/b&gt;, swift-service-lifecycle, swift-log&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;HTTP server, graceful shutdown, logging&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
47+ <mxCell id="hummingbird" value="&lt;b&gt;Hummingbird 2&lt;/b&gt;, swift-nio (NIOCore), swift-service-lifecycle (UnixSignals), swift-log&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;HTTP server, client address, graceful shutdown, SIGHUP, logging&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
4848 <mxGeometry x="820" y="485" width="340" height="60" as="geometry" />
4949 </mxCell>
5050 <mxCell id="yams" value="&lt;b&gt;Yams&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;YAML parsing (with line numbers for errors)&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
@@ -22,7 +22,7 @@
22 <mxCell id="cli" value="&lt;b&gt;RazorbillCLI&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;commands: serve, config validate, models, version; console I/O, request log&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1">22 <mxCell id="cli" value="&lt;b&gt;RazorbillCLI&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;commands: serve, config validate, models, version; console I/O, request log&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1">
23 <mxGeometry x="80" y="260" width="280" height="70" as="geometry" />23 <mxGeometry x="80" y="260" width="280" height="70" as="geometry" />
24 </mxCell>24 </mxCell>
25- <mxCell id="server" value="&lt;b&gt;RazorbillServer&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;OpenAI-compatible HTTP API: routes, streaming (SSE), errors, API key, model manager. No MLX.&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1">25+ <mxCell id="server" value="&lt;b&gt;RazorbillServer&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;OpenAI-compatible HTTP API: routes, streaming (SSE), errors, API key, model manager; local /rzb admin routes (status, unload, config reload). No MLX.&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1">
26 <mxGeometry x="80" y="400" width="280" height="70" as="geometry" />26 <mxGeometry x="80" y="400" width="280" height="70" as="geometry" />
27 </mxCell>27 </mxCell>
28 <mxCell id="mlx" value="&lt;b&gt;RazorbillMLX&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;MLX engines: chat, raw completion, thinking budget, constrained decoding, embeddings (empty on Linux)&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;shadow=1;" vertex="1" parent="1">28 <mxCell id="mlx" value="&lt;b&gt;RazorbillMLX&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;MLX engines: chat, raw completion, thinking budget, constrained decoding, embeddings (empty on Linux)&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;shadow=1;" vertex="1" parent="1">
@@ -44,7 +44,7 @@
44 <mxCell id="tokenizers" value="&lt;b&gt;swift-transformers&lt;/b&gt; (Tokenizers)&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;tokenizers and chat templates&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">44 <mxCell id="tokenizers" value="&lt;b&gt;swift-transformers&lt;/b&gt; (Tokenizers)&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;tokenizers and chat templates&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
45 <mxGeometry x="820" y="400" width="340" height="50" as="geometry" />45 <mxGeometry x="820" y="400" width="340" height="50" as="geometry" />
46 </mxCell>46 </mxCell>
47- <mxCell id="hummingbird" value="&lt;b&gt;Hummingbird 2&lt;/b&gt;, swift-service-lifecycle, swift-log&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;HTTP server, graceful shutdown, logging&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">47+ <mxCell id="hummingbird" value="&lt;b&gt;Hummingbird 2&lt;/b&gt;, swift-nio (NIOCore), swift-service-lifecycle (UnixSignals), swift-log&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;HTTP server, client address, graceful shutdown, SIGHUP, logging&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
48 <mxGeometry x="820" y="485" width="340" height="60" as="geometry" />48 <mxGeometry x="820" y="485" width="340" height="60" as="geometry" />
49 </mxCell>49 </mxCell>
50 <mxCell id="yams" value="&lt;b&gt;Yams&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;YAML parsing (with line numbers for errors)&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">50 <mxCell id="yams" value="&lt;b&gt;Yams&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:11px&quot;&gt;YAML parsing (with line numbers for errors)&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
modified docs/en/README.md +2 -1
@@ -14,6 +14,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th
1414 - [Package a release](how-to/package-a-release.md): the `.tar.gz` archive and its checksum.
1515 - [Manage models](how-to/manage-models.md)
1616 - [Configure the server](how-to/configure-the-server.md): model names, defaults, locks, limits, network access.
17+- [Watch and steer a running server](how-to/watch-and-steer-a-running-server.md): status, freeing a model, reloading the configuration.
1718 - [Use razorbill from an OpenAI client](how-to/use-openai-clients.md): Python, JavaScript, LangChain, chat UIs.
1819 - [Get structured output](how-to/get-structured-output.md)
1920 - [Use function calling](how-to/use-function-calling.md)
@@ -24,7 +25,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th
2425
2526 ## Look up — reference
2627
27-- [HTTP API](reference/http-api.md): endpoints, fields supported, refused and ignored, responses, streaming.
28+- [HTTP API](reference/http-api.md): endpoints, fields supported, refused and ignored, responses, streaming, local admin routes.
2829 - [Server configuration file](reference/configuration.md): every key, its type, default and errors.
2930 - [Command line](reference/cli.md): `rzb serve`, `rzb models`, `rzb config validate`, exit codes.
3031 - [API errors](reference/errors.md): statuses, types and codes.
@@ -14,6 +14,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th
14 - [Package a release](how-to/package-a-release.md): the `.tar.gz` archive and its checksum.14 - [Package a release](how-to/package-a-release.md): the `.tar.gz` archive and its checksum.
15 - [Manage models](how-to/manage-models.md)15 - [Manage models](how-to/manage-models.md)
16 - [Configure the server](how-to/configure-the-server.md): model names, defaults, locks, limits, network access.16 - [Configure the server](how-to/configure-the-server.md): model names, defaults, locks, limits, network access.
17+- [Watch and steer a running server](how-to/watch-and-steer-a-running-server.md): status, freeing a model, reloading the configuration.
17 - [Use razorbill from an OpenAI client](how-to/use-openai-clients.md): Python, JavaScript, LangChain, chat UIs.18 - [Use razorbill from an OpenAI client](how-to/use-openai-clients.md): Python, JavaScript, LangChain, chat UIs.
18 - [Get structured output](how-to/get-structured-output.md)19 - [Get structured output](how-to/get-structured-output.md)
19 - [Use function calling](how-to/use-function-calling.md)20 - [Use function calling](how-to/use-function-calling.md)
@@ -24,7 +25,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th
24 25
25 ## Look up — reference26 ## Look up — reference
26 27
27-- [HTTP API](reference/http-api.md): endpoints, fields supported, refused and ignored, responses, streaming.28+- [HTTP API](reference/http-api.md): endpoints, fields supported, refused and ignored, responses, streaming, local admin routes.
28 - [Server configuration file](reference/configuration.md): every key, its type, default and errors.29 - [Server configuration file](reference/configuration.md): every key, its type, default and errors.
29 - [Command line](reference/cli.md): `rzb serve`, `rzb models`, `rzb config validate`, exit codes.30 - [Command line](reference/cli.md): `rzb serve`, `rzb models`, `rzb config validate`, exit codes.
30 - [API errors](reference/errors.md): statuses, types and codes.31 - [API errors](reference/errors.md): statuses, types and codes.
modified docs/en/explanation/model-lifecycle.md +7 -1
@@ -41,6 +41,12 @@ When a model must be loaded and one of the limits would be exceeded, the manager
4141
4242 A background service checks regularly (every quarter of `keep_alive`, at most every 30 seconds) and unloads models unused for `limits.keep_alive` (default 10 minutes). The next request loads the model again, which costs a few seconds for a small model. When the server stops (Ctrl-C, SIGTERM), every model is unloaded before the process exits.
4343
44+## Unloading on demand and reloading
45+
46+The operator can also free a model at once (`POST /rzb/models/{id}/unload`), to make room for something else on the Mac. A model that a request holds or waits for is not unloaded: the call answers 409 and changes nothing. Waiting for the queue to drain could block the caller for minutes behind long generations, and cancelling the requests would break answers that clients are reading; refusing leaves the choice to the operator, who can see `busy` and `queued` in the status and try again.
47+
48+A configuration reload (`POST /rzb/config/reload` or `SIGHUP`) swaps the list of declared models, the defaults, the locks and the limits in one step: the requests already running keep the settings they started with, the next ones resolve against the new file. A loaded model that no declared name points to anymore would otherwise linger until `keep_alive`; it is unloaded at once when idle, or as its last request ends. The listening address, the port, the API key variable and CORS are set up before the first request and shared by every connection, so changing them in a running process would mean rebuilding the server under its clients: they are reported as needing a restart instead.
49+
4450 ## When the client leaves
4551
4652 A generation nobody will read wastes the GPU and delays everyone in the queue. The server therefore watches the connection while it answers: when the client disconnects, the generation task is cancelled, the model's turn is released, and the next request starts. A request still waiting in the queue is simply removed from it.
@@ -57,6 +63,6 @@ During a stream, a client that vanishes is noticed only when a write fails. Whil
5763
5864 ## How it relates to the rest
5965
60-- The keys that set these limits: [configuration reference](../reference/configuration.md#limits).
66+- The keys that set these limits: [configuration reference](../reference/configuration.md#limits); what a reload changes: [reloading](../reference/configuration.md#reloading).
6167 - The errors a client sees: [errors reference](../reference/errors.md#codes).
6268 - Where the manager sits in a request: [architecture](architecture.md#the-path-of-a-chat-request).
@@ -41,6 +41,12 @@ When a model must be loaded and one of the limits would be exceeded, the manager
41 41
42 A background service checks regularly (every quarter of `keep_alive`, at most every 30 seconds) and unloads models unused for `limits.keep_alive` (default 10 minutes). The next request loads the model again, which costs a few seconds for a small model. When the server stops (Ctrl-C, SIGTERM), every model is unloaded before the process exits.42 A background service checks regularly (every quarter of `keep_alive`, at most every 30 seconds) and unloads models unused for `limits.keep_alive` (default 10 minutes). The next request loads the model again, which costs a few seconds for a small model. When the server stops (Ctrl-C, SIGTERM), every model is unloaded before the process exits.
43 43
44+## Unloading on demand and reloading
45+
46+The operator can also free a model at once (`POST /rzb/models/{id}/unload`), to make room for something else on the Mac. A model that a request holds or waits for is not unloaded: the call answers 409 and changes nothing. Waiting for the queue to drain could block the caller for minutes behind long generations, and cancelling the requests would break answers that clients are reading; refusing leaves the choice to the operator, who can see `busy` and `queued` in the status and try again.
47+
48+A configuration reload (`POST /rzb/config/reload` or `SIGHUP`) swaps the list of declared models, the defaults, the locks and the limits in one step: the requests already running keep the settings they started with, the next ones resolve against the new file. A loaded model that no declared name points to anymore would otherwise linger until `keep_alive`; it is unloaded at once when idle, or as its last request ends. The listening address, the port, the API key variable and CORS are set up before the first request and shared by every connection, so changing them in a running process would mean rebuilding the server under its clients: they are reported as needing a restart instead.
49+
44 ## When the client leaves50 ## When the client leaves
45 51
46 A generation nobody will read wastes the GPU and delays everyone in the queue. The server therefore watches the connection while it answers: when the client disconnects, the generation task is cancelled, the model's turn is released, and the next request starts. A request still waiting in the queue is simply removed from it.52 A generation nobody will read wastes the GPU and delays everyone in the queue. The server therefore watches the connection while it answers: when the client disconnects, the generation task is cancelled, the model's turn is released, and the next request starts. A request still waiting in the queue is simply removed from it.
@@ -57,6 +63,6 @@ During a stream, a client that vanishes is noticed only when a write fails. Whil
57 63
58 ## How it relates to the rest64 ## How it relates to the rest
59 65
60-- The keys that set these limits: [configuration reference](../reference/configuration.md#limits).66+- The keys that set these limits: [configuration reference](../reference/configuration.md#limits); what a reload changes: [reloading](../reference/configuration.md#reloading).
61 - The errors a client sees: [errors reference](../reference/errors.md#codes).67 - The errors a client sees: [errors reference](../reference/errors.md#codes).
62 - Where the manager sits in a request: [architecture](architecture.md#the-path-of-a-chat-request).68 - Where the manager sits in a request: [architecture](architecture.md#the-path-of-a-chat-request).
modified docs/en/explanation/openai-compatibility.md +11 -0
@@ -39,6 +39,16 @@ Only `thinking_budget` is razorbill's own, because no common convention exists f
3939 - **Penalties look at a window.** `presence_penalty` and `frequency_penalty` count the last 20 tokens, prompt included, as mlx-swift-lm does; OpenAI counts the whole answer. `repetition_penalty` works the same way, with a window set by `repetition_context_size`.
4040 - **Locked settings win.** An operator can impose `temperature` or cap `max_tokens` for every client, which OpenAI's API has no equivalent for.
4141
42+## Routes of our own, under /rzb
43+
44+razorbill started with a firm rule: the OpenAI API and nothing else, no Ollama-style `/api/*` of its own. A second API would be a second thing to keep stable, and every feature exposed through it would be one that OpenAI clients cannot use.
45+
46+The terminal interface (`rzb tui`) bent that rule. It is a second `rzb` process on the same Mac: it chats through the OpenAI API like any client, and reads the model cache and the configuration file directly, as `rzb models` and `rzb config validate` do. What only the server process knows — which models are in memory, who is waiting for them, what MLX holds, the last requests — has no OpenAI endpoint, and neither has asking the process to free a model or read its file again. Those few things got routes of their own, under `/rzb/`, a prefix that cannot be mistaken for an OpenAI path or for Ollama's.
47+
48+They answer the machine itself only, even on a server listening on `0.0.0.0`. The `/v1` routes serve whoever the operator lets in; the `/rzb` routes act on the server for everyone, and reveal what other clients are doing. The person allowed to do that is the one at the Mac, and the address of the connection is the simplest proof of it that does not need a second key. The API key still applies on top, so a shared Mac with a key set does not open these routes to every local user.
49+
50+The interface polls `GET /rzb/status` rather than following a stream of events. A refresh every second or so costs a few hundred bytes, needs no connection kept open, and works with `curl` and `watch`; an event stream would add a second way to learn the same state, to be kept consistent with the first.
51+
4252 ## How compatibility is checked
4353
4454 Unit tests check the shapes; they cannot check that the real libraries agree with our reading of the shapes. A separate suite, `Tests/Compatibility`, drives a running `rzb serve` with the official clients — the `openai` library, LangChain, and every `curl` example of the API reference — and asserts what a user would see: a parsed Pydantic object, a tool round trip, cosine similarities equal to the Python `sentence-transformers` library's, typed exceptions on errors.
@@ -48,4 +58,5 @@ It runs in two modes. On Linux, against the fake engine, it checks the protocol
4858 ## How it relates to the rest
4959
5060 - What is supported, refused and ignored, field by field: [HTTP API reference](../reference/http-api.md).
61+- Using the `/rzb` routes: [watch and steer a running server](../how-to/watch-and-steer-a-running-server.md).
5162 - Running the suite: [run the tests](../how-to/run-the-tests.md#check-compatibility-with-real-openai-clients).
@@ -39,6 +39,16 @@ Only `thinking_budget` is razorbill's own, because no common convention exists f
39 - **Penalties look at a window.** `presence_penalty` and `frequency_penalty` count the last 20 tokens, prompt included, as mlx-swift-lm does; OpenAI counts the whole answer. `repetition_penalty` works the same way, with a window set by `repetition_context_size`.39 - **Penalties look at a window.** `presence_penalty` and `frequency_penalty` count the last 20 tokens, prompt included, as mlx-swift-lm does; OpenAI counts the whole answer. `repetition_penalty` works the same way, with a window set by `repetition_context_size`.
40 - **Locked settings win.** An operator can impose `temperature` or cap `max_tokens` for every client, which OpenAI's API has no equivalent for.40 - **Locked settings win.** An operator can impose `temperature` or cap `max_tokens` for every client, which OpenAI's API has no equivalent for.
41 41
42+## Routes of our own, under /rzb
43+
44+razorbill started with a firm rule: the OpenAI API and nothing else, no Ollama-style `/api/*` of its own. A second API would be a second thing to keep stable, and every feature exposed through it would be one that OpenAI clients cannot use.
45+
46+The terminal interface (`rzb tui`) bent that rule. It is a second `rzb` process on the same Mac: it chats through the OpenAI API like any client, and reads the model cache and the configuration file directly, as `rzb models` and `rzb config validate` do. What only the server process knows — which models are in memory, who is waiting for them, what MLX holds, the last requests — has no OpenAI endpoint, and neither has asking the process to free a model or read its file again. Those few things got routes of their own, under `/rzb/`, a prefix that cannot be mistaken for an OpenAI path or for Ollama's.
47+
48+They answer the machine itself only, even on a server listening on `0.0.0.0`. The `/v1` routes serve whoever the operator lets in; the `/rzb` routes act on the server for everyone, and reveal what other clients are doing. The person allowed to do that is the one at the Mac, and the address of the connection is the simplest proof of it that does not need a second key. The API key still applies on top, so a shared Mac with a key set does not open these routes to every local user.
49+
50+The interface polls `GET /rzb/status` rather than following a stream of events. A refresh every second or so costs a few hundred bytes, needs no connection kept open, and works with `curl` and `watch`; an event stream would add a second way to learn the same state, to be kept consistent with the first.
51+
42 ## How compatibility is checked52 ## How compatibility is checked
43 53
44 Unit tests check the shapes; they cannot check that the real libraries agree with our reading of the shapes. A separate suite, `Tests/Compatibility`, drives a running `rzb serve` with the official clients — the `openai` library, LangChain, and every `curl` example of the API reference — and asserts what a user would see: a parsed Pydantic object, a tool round trip, cosine similarities equal to the Python `sentence-transformers` library's, typed exceptions on errors.54 Unit tests check the shapes; they cannot check that the real libraries agree with our reading of the shapes. A separate suite, `Tests/Compatibility`, drives a running `rzb serve` with the official clients — the `openai` library, LangChain, and every `curl` example of the API reference — and asserts what a user would see: a parsed Pydantic object, a tool round trip, cosine similarities equal to the Python `sentence-transformers` library's, typed exceptions on errors.
@@ -48,4 +58,5 @@ It runs in two modes. On Linux, against the fake engine, it checks the protocol
48 ## How it relates to the rest58 ## How it relates to the rest
49 59
50 - What is supported, refused and ignored, field by field: [HTTP API reference](../reference/http-api.md).60 - What is supported, refused and ignored, field by field: [HTTP API reference](../reference/http-api.md).
61+- Using the `/rzb` routes: [watch and steer a running server](../how-to/watch-and-steer-a-running-server.md).
51 - Running the suite: [run the tests](../how-to/run-the-tests.md#check-compatibility-with-real-openai-clients).62 - Running the suite: [run the tests](../how-to/run-the-tests.md#check-compatibility-with-real-openai-clients).
modified docs/en/how-to/configure-the-server.md +1 -0
@@ -116,3 +116,4 @@ Use `*` for any origin only with an API key: otherwise any page you open can use
116116
117117 - Every key, type and default: [configuration reference](../reference/configuration.md).
118118 - How models are loaded, queued and unloaded: [model lifecycle](../explanation/model-lifecycle.md).
119+- Apply a change to a running server without restarting it: [watch and steer a running server](watch-and-steer-a-running-server.md#apply-a-configuration-change-without-restarting).
@@ -116,3 +116,4 @@ Use `*` for any origin only with an API key: otherwise any page you open can use
116 116
117 - Every key, type and default: [configuration reference](../reference/configuration.md).117 - Every key, type and default: [configuration reference](../reference/configuration.md).
118 - How models are loaded, queued and unloaded: [model lifecycle](../explanation/model-lifecycle.md).118 - How models are loaded, queued and unloaded: [model lifecycle](../explanation/model-lifecycle.md).
119+- Apply a change to a running server without restarting it: [watch and steer a running server](watch-and-steer-a-running-server.md#apply-a-configuration-change-without-restarting).
added docs/en/how-to/watch-and-steer-a-running-server.md +55 -0
new file mode 100644
@@ -0,0 +1,55 @@
1+# How to watch and steer a running server
2+
3+This guide shows how to see what a running `rzb serve` holds, free a model's memory, and apply a configuration change without restarting. It assumes the server runs on your Mac and you have a shell on that Mac: these routes answer the machine itself only.
4+
5+## See what the server holds
6+
7+```bash
8+curl -s http://127.0.0.1:7920/rzb/status | python3 -m json.tool
9+```
10+
11+`models` lists what is loaded, whether a request holds it (`busy`), how many wait (`queued`) and how long before `keep_alive` unloads it. `recent_requests` shows the last 50 requests with their model, tokens and duration. `memory` shows what MLX holds now and at its peak. To watch it change, repeat the call: `watch -n 1 'curl -s http://127.0.0.1:7920/rzb/status'`.
12+
13+## Free a model's memory now
14+
15+```bash
16+curl -s -X POST http://127.0.0.1:7920/rzb/models/qwen3/unload
17+```
18+
19+Use the name clients use: a declared `id`, or a Hugging Face id such as `mlx-community/Qwen3-4B-4bit` (the `/` stays as is in the path). The answer says `unloaded`, or `not_loaded` when there was nothing to free.
20+
21+If the answer is a 409 `model_busy`, a request is generating with the model or waiting for it. Nothing was unloaded: retry once `busy` is `false` and `queued` is `0` in the status. The next request for the model loads it again.
22+
23+## Apply a configuration change without restarting
24+
25+1. Edit the file the server was started with (`rzb serve --config server.yaml`).
26+2. Check it: `rzb config validate server.yaml`.
27+3. Tell the server to read it again, with either:
28+
29+ ```bash
30+ curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
31+ ```
32+
33+ or, which writes the outcome to the server's log instead:
34+
35+ ```bash
36+ kill -HUP "$(pgrep -f 'rzb serve')"
37+ ```
38+
39+4. Read the answer (or the log line `configuration reloaded from …`):
40+ - `unloaded` and `unload_when_idle` name the loaded models you removed or moved to another source; they are freed now, or once their requests end.
41+ - `restart_required` names the `server:` keys you changed that only apply after a restart (`host`, `port`, `api_key_env`, `cors_origin`): stop the server and start it again for those.
42+
43+If the file has a problem, the answer is a 400 `invalid_config` listing it, and the server keeps the configuration it had: fix the file and reload again. A server started without `--config` answers 409 `no_config_file`: there is no file to read, so restart it with one.
44+
45+## Variants
46+
47+- **The server has an API key**: add `-H "Authorization: Bearer $RZB_API_KEY"` to each `curl`; these routes need it like `/v1`.
48+- **The server listens on another port**: change `7920` in the URLs.
49+- **You are on another machine**: the routes answer 403 `local_only`. Run the commands on the Mac itself, for instance over `ssh`, or forward the port (`ssh -L 7920:127.0.0.1:7920 mac`) and call `http://127.0.0.1:7920` locally: the server then sees a connection from itself.
50+
51+## See also
52+
53+- Every field and status of these routes: [HTTP API reference](../reference/http-api.md#local-admin-routes-rzb).
54+- What each key does on reload: [configuration reference](../reference/configuration.md#reloading).
55+- Why these routes exist and stay local: [OpenAI compatibility](../explanation/openai-compatibility.md#routes-of-our-own-under-rzb); how unloading fits the model lifecycle: [model lifecycle](../explanation/model-lifecycle.md#unloading-on-demand-and-reloading).
new file mode 100644
@@ -0,0 +1,55 @@
1+# How to watch and steer a running server
2+
3+This guide shows how to see what a running `rzb serve` holds, free a model's memory, and apply a configuration change without restarting. It assumes the server runs on your Mac and you have a shell on that Mac: these routes answer the machine itself only.
4+
5+## See what the server holds
6+
7+```bash
8+curl -s http://127.0.0.1:7920/rzb/status | python3 -m json.tool
9+```
10+
11+`models` lists what is loaded, whether a request holds it (`busy`), how many wait (`queued`) and how long before `keep_alive` unloads it. `recent_requests` shows the last 50 requests with their model, tokens and duration. `memory` shows what MLX holds now and at its peak. To watch it change, repeat the call: `watch -n 1 'curl -s http://127.0.0.1:7920/rzb/status'`.
12+
13+## Free a model's memory now
14+
15+```bash
16+curl -s -X POST http://127.0.0.1:7920/rzb/models/qwen3/unload
17+```
18+
19+Use the name clients use: a declared `id`, or a Hugging Face id such as `mlx-community/Qwen3-4B-4bit` (the `/` stays as is in the path). The answer says `unloaded`, or `not_loaded` when there was nothing to free.
20+
21+If the answer is a 409 `model_busy`, a request is generating with the model or waiting for it. Nothing was unloaded: retry once `busy` is `false` and `queued` is `0` in the status. The next request for the model loads it again.
22+
23+## Apply a configuration change without restarting
24+
25+1. Edit the file the server was started with (`rzb serve --config server.yaml`).
26+2. Check it: `rzb config validate server.yaml`.
27+3. Tell the server to read it again, with either:
28+
29+ ```bash
30+ curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
31+ ```
32+
33+ or, which writes the outcome to the server's log instead:
34+
35+ ```bash
36+ kill -HUP "$(pgrep -f 'rzb serve')"
37+ ```
38+
39+4. Read the answer (or the log line `configuration reloaded from …`):
40+ - `unloaded` and `unload_when_idle` name the loaded models you removed or moved to another source; they are freed now, or once their requests end.
41+ - `restart_required` names the `server:` keys you changed that only apply after a restart (`host`, `port`, `api_key_env`, `cors_origin`): stop the server and start it again for those.
42+
43+If the file has a problem, the answer is a 400 `invalid_config` listing it, and the server keeps the configuration it had: fix the file and reload again. A server started without `--config` answers 409 `no_config_file`: there is no file to read, so restart it with one.
44+
45+## Variants
46+
47+- **The server has an API key**: add `-H "Authorization: Bearer $RZB_API_KEY"` to each `curl`; these routes need it like `/v1`.
48+- **The server listens on another port**: change `7920` in the URLs.
49+- **You are on another machine**: the routes answer 403 `local_only`. Run the commands on the Mac itself, for instance over `ssh`, or forward the port (`ssh -L 7920:127.0.0.1:7920 mac`) and call `http://127.0.0.1:7920` locally: the server then sees a connection from itself.
50+
51+## See also
52+
53+- Every field and status of these routes: [HTTP API reference](../reference/http-api.md#local-admin-routes-rzb).
54+- What each key does on reload: [configuration reference](../reference/configuration.md#reloading).
55+- Why these routes exist and stay local: [OpenAI compatibility](../explanation/openai-compatibility.md#routes-of-our-own-under-rzb); how unloading fits the model lifecycle: [model lifecycle](../explanation/model-lifecycle.md#unloading-on-demand-and-reloading).
modified docs/en/reference/cli.md +1 -1
@@ -21,7 +21,7 @@ rzb help <command>
2121 rzb serve [--config <file>] [--host <address>] [--port <n>] [--api-key-env <name>] [--cors-origin <origin>]
2222 ```
2323
24-Starts the server and runs until Ctrl-C or SIGTERM; then it stops accepting requests, unloads the models and exits with code 0.
24+Starts the server and runs until Ctrl-C or SIGTERM; then it stops accepting requests, unloads the models and exits with code 0. `SIGHUP` reads the `--config` file again ([what changes](configuration.md#reloading)) and writes the outcome to the log; without `--config` there is nothing to reload.
2525
2626 | Option | Type | Default | Description |
2727 | --- | --- | --- | --- |
@@ -21,7 +21,7 @@ rzb help <command>
21 rzb serve [--config <file>] [--host <address>] [--port <n>] [--api-key-env <name>] [--cors-origin <origin>]21 rzb serve [--config <file>] [--host <address>] [--port <n>] [--api-key-env <name>] [--cors-origin <origin>]
22 ```22 ```
23 23
24-Starts the server and runs until Ctrl-C or SIGTERM; then it stops accepting requests, unloads the models and exits with code 0.24+Starts the server and runs until Ctrl-C or SIGTERM; then it stops accepting requests, unloads the models and exits with code 0. `SIGHUP` reads the `--config` file again ([what changes](configuration.md#reloading)) and writes the outcome to the log; without `--config` there is nothing to reload.
25 25
26 | Option | Type | Default | Description |26 | Option | Type | Default | Description |
27 | --- | --- | --- | --- |27 | --- | --- | --- | --- |
modified docs/en/reference/configuration.md +13 -0
@@ -100,6 +100,19 @@ A list of entries. Clients may also use any Hugging Face id in MLX format withou
100100
101101 Besides these limits, the weights loaded at once may not exceed 75 % of the Mac's memory: a model that cannot fit after unloading idle models gets a 503.
102102
103+## Reloading
104+
105+A running server reads its file again on [`POST /rzb/config/reload`](http-api.md#post-rzbconfigreload) or `SIGHUP`. A file with problems changes nothing.
106+
107+| Key | On reload |
108+| --- | --- |
109+| `models` | Applies to the next request. A loaded model no declared `id` points to anymore is unloaded at once, or when its last request ends; a newly declared `preload` model starts loading |
110+| `defaults`, `locked` | Apply to the next request, for every model |
111+| `limits.max_queue` | Applies to the next request that has to wait |
112+| `limits.max_loaded_models` | Applies to the next load; loaded models stay until then |
113+| `limits.keep_alive` | Applies from the next idle sweep |
114+| `server.host`, `server.port`, `server.api_key_env`, `server.cors_origin` | Ignored until the server restarts; listed in `restart_required` when changed, unless the matching command-line option is set |
115+
103116 ## Errors
104117
105118 Problems are printed together, then `rzb` exits with code 2:
@@ -100,6 +100,19 @@ A list of entries. Clients may also use any Hugging Face id in MLX format withou
100 100
101 Besides these limits, the weights loaded at once may not exceed 75 % of the Mac's memory: a model that cannot fit after unloading idle models gets a 503.101 Besides these limits, the weights loaded at once may not exceed 75 % of the Mac's memory: a model that cannot fit after unloading idle models gets a 503.
102 102
103+## Reloading
104+
105+A running server reads its file again on [`POST /rzb/config/reload`](http-api.md#post-rzbconfigreload) or `SIGHUP`. A file with problems changes nothing.
106+
107+| Key | On reload |
108+| --- | --- |
109+| `models` | Applies to the next request. A loaded model no declared `id` points to anymore is unloaded at once, or when its last request ends; a newly declared `preload` model starts loading |
110+| `defaults`, `locked` | Apply to the next request, for every model |
111+| `limits.max_queue` | Applies to the next request that has to wait |
112+| `limits.max_loaded_models` | Applies to the next load; loaded models stay until then |
113+| `limits.keep_alive` | Applies from the next idle sweep |
114+| `server.host`, `server.port`, `server.api_key_env`, `server.cors_origin` | Ignored until the server restarts; listed in `restart_required` when changed, unless the matching command-line option is set |
115+
103 ## Errors116 ## Errors
104 117
105 Problems are printed together, then `rzb` exits with code 2:118 Problems are printed together, then `rzb` exits with code 2:
modified docs/en/reference/errors.md +6 -0
@@ -23,7 +23,9 @@ During a stream, an error after the first chunk is sent as a last event, `data:
2323 | --- | --- | --- |
2424 | 400 | `invalid_request_error` | Malformed JSON, wrong type, value out of range, refused field, unsupported constraint, wrong model kind, input too long |
2525 | 401 | `invalid_request_error` | Missing or wrong API key |
26+| 403 | `permission_error` | A `/rzb/` route called from another machine |
2627 | 404 | `invalid_request_error` | Unknown model or unknown URL |
28+| 409 | `invalid_request_error` | A `/rzb/` action that conflicts with the server's state: model in use, no configuration file |
2729 | 413 | `invalid_request_error` | Body larger than 16 MiB |
2830 | 429 | `rate_limit_error` | Too many requests waiting for one model |
2931 | 499 | — | The client closed the connection (written in the log only; the client is gone) |
@@ -42,6 +44,10 @@ During a stream, an error after the first chunk is sent as a last event, `data:
4244 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Every loaded model is answering and `max_loaded_models` is reached |
4345 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | The weights exceed what can be freed within 75 % of the memory |
4446 | `model_load_failed` | 500 | `cannot load 'qwen3': …` | Download or load failure |
47+| `local_only` | 403 | `/rzb/status only answers requests from the machine running the server.` | A `/rzb/` route called from another address than loopback |
48+| `model_busy` | 409 | `'qwen3' is in use (1 request(s) running, 2 waiting); retry once it is idle.` | `POST /rzb/models/{id}/unload` while a request holds the model or waits for it |
49+| `no_config_file` | 409 | `The server was started without --config: there is no file to reload.` | `POST /rzb/config/reload` on a server started without `--config` |
50+| `invalid_config` | 400 | `The configuration was not reloaded, the previous one stays in force. invalid configuration server.yaml …` | `POST /rzb/config/reload` with an invalid or unreadable file; the message lists its problems as `rzb config validate` does |
4551
4652 ## Common 400 messages
4753
@@ -23,7 +23,9 @@ During a stream, an error after the first chunk is sent as a last event, `data:
23 | --- | --- | --- |23 | --- | --- | --- |
24 | 400 | `invalid_request_error` | Malformed JSON, wrong type, value out of range, refused field, unsupported constraint, wrong model kind, input too long |24 | 400 | `invalid_request_error` | Malformed JSON, wrong type, value out of range, refused field, unsupported constraint, wrong model kind, input too long |
25 | 401 | `invalid_request_error` | Missing or wrong API key |25 | 401 | `invalid_request_error` | Missing or wrong API key |
26+| 403 | `permission_error` | A `/rzb/` route called from another machine |
26 | 404 | `invalid_request_error` | Unknown model or unknown URL |27 | 404 | `invalid_request_error` | Unknown model or unknown URL |
28+| 409 | `invalid_request_error` | A `/rzb/` action that conflicts with the server's state: model in use, no configuration file |
27 | 413 | `invalid_request_error` | Body larger than 16 MiB |29 | 413 | `invalid_request_error` | Body larger than 16 MiB |
28 | 429 | `rate_limit_error` | Too many requests waiting for one model |30 | 429 | `rate_limit_error` | Too many requests waiting for one model |
29 | 499 | — | The client closed the connection (written in the log only; the client is gone) |31 | 499 | — | The client closed the connection (written in the log only; the client is gone) |
@@ -42,6 +44,10 @@ During a stream, an error after the first chunk is sent as a last event, `data:
42 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Every loaded model is answering and `max_loaded_models` is reached |44 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Every loaded model is answering and `max_loaded_models` is reached |
43 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | The weights exceed what can be freed within 75 % of the memory |45 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | The weights exceed what can be freed within 75 % of the memory |
44 | `model_load_failed` | 500 | `cannot load 'qwen3': …` | Download or load failure |46 | `model_load_failed` | 500 | `cannot load 'qwen3': …` | Download or load failure |
47+| `local_only` | 403 | `/rzb/status only answers requests from the machine running the server.` | A `/rzb/` route called from another address than loopback |
48+| `model_busy` | 409 | `'qwen3' is in use (1 request(s) running, 2 waiting); retry once it is idle.` | `POST /rzb/models/{id}/unload` while a request holds the model or waits for it |
49+| `no_config_file` | 409 | `The server was started without --config: there is no file to reload.` | `POST /rzb/config/reload` on a server started without `--config` |
50+| `invalid_config` | 400 | `The configuration was not reloaded, the previous one stays in force. invalid configuration server.yaml …` | `POST /rzb/config/reload` with an invalid or unreadable file; the message lists its problems as `rzb config validate` does |
45 51
46 ## Common 400 messages52 ## Common 400 messages
47 53
modified docs/en/reference/http-api.md +109 -0
@@ -27,6 +27,7 @@ The examples use `mlx-community/Qwen3-4B-4bit` as chat model and `BAAI/bge-small
2727 | `POST /v1/chat/completions` | Chat answer, plain or streamed, with structured output, tools and reasoning |
2828 | `POST /v1/completions` | Legacy text completion: the prompt is continued as raw text |
2929 | `POST /v1/embeddings` | Embedding vectors |
30+| `GET /rzb/status`, `POST /rzb/…` | razorbill's own admin routes, from this machine only: see [local admin routes](#local-admin-routes-rzb) |
3031
3132 Any other path answers 404 with code `unknown_url`.
3233
@@ -298,3 +299,111 @@ curl -sN http://127.0.0.1:7920/v1/chat/completions \
298299 -d '{"model": "mlx-community/Qwen3-4B-4bit", "messages": [{"role": "user", "content": "Count to 5."}],
299300 "stream": true, "stream_options": {"include_usage": true}, "reasoning_effort": "none"}'
300301 ```
302+
303+## Local admin routes (/rzb)
304+
305+razorbill's own routes, for `rzb tui` and the operator of the server. They are not part of OpenAI's API and OpenAI clients never call them.
306+
307+| Rule | Value |
308+| --- | --- |
309+| Access | Only connections from the machine running the server (loopback: `127.0.0.0/8`, `::1`, `::ffff:127.x`), even when it listens on `0.0.0.0`; any other client gets 403 `local_only` |
310+| Authentication | As on `/v1`: `Authorization: Bearer <key>` when the server has an API key |
311+| Request log | Logged like every request, but left out of `recent_requests` |
312+
313+| Method and path | Purpose |
314+| --- | --- |
315+| `GET /rzb/status` | What the server process holds right now |
316+| `POST /rzb/models/{id}/unload` | Free a model now (`{id}` may contain `/`) |
317+| `POST /rzb/config/reload` | Read the configuration file again |
318+
319+### GET /rzb/status
320+
321+```bash
322+curl -s http://127.0.0.1:7920/rzb/status
323+```
324+
325+| Field | Type | Value |
326+| --- | --- | --- |
327+| `version` | string | razorbill's version |
328+| `uptime_seconds` | integer | Seconds since the server started |
329+| `host`, `port` | string, integer | The configured address (`port` is `0` when the server picked a free port) |
330+| `models` | array | The models loaded or being loaded, sorted by `key` (table below); `[]` when none |
331+| `recent_requests` | array | The last 50 requests answered, newest first (table below) |
332+| `memory` | object or `null` | The engine's memory (table below); `null` when the engine cannot measure it (the Linux build) |
333+
334+| Field of a model | Type | Value |
335+| --- | --- | --- |
336+| `key` | string | The loaded model: `org/name`, or `org/name#embedding` for an embedding load |
337+| `name` | string | The name of the request that loaded it (a declared `id` or a Hugging Face id) |
338+| `kind` | string | `chat` or `embedding` |
339+| `state` | string | `loading` until its first request has loaded it, then `loaded` |
340+| `size_bytes` | integer | Bytes of weights on disk; `0` when unknown |
341+| `busy` | boolean | A request holds it (loading it or generating) |
342+| `queued` | integer | Requests waiting for it |
343+| `idle_seconds` | number | Seconds since its last request ended (tenths); `0` while `busy` or `queued` |
344+| `keep_alive_left_seconds` | number or `null` | Seconds before [`keep_alive`](configuration.md#limits) unloads it; `null` while `busy` or `queued` |
345+
346+| Field of a request | Type | Value |
347+| --- | --- | --- |
348+| `method`, `path`, `status` | string, string, integer | The request and its answer's status |
349+| `model` | string or `null` | The model it used |
350+| `prompt_tokens`, `completion_tokens` | integer or `null` | Its token counts, when it generated |
351+| `cached_tokens` | integer | Prompt tokens reused from the previous request |
352+| `duration_ms` | integer | Time to the response head (to the first byte, for a stream) |
353+| `finished_at` | integer | Unix seconds |
354+
355+| Field of `memory` | Type | Value |
356+| --- | --- | --- |
357+| `active_bytes` | integer | Held by live arrays: weights, KV caches, activations |
358+| `cache_bytes` | integer | Freed by MLX but kept for reuse |
359+| `peak_bytes` | integer | Highest `active_bytes` since the process started |
360+| `limit_bytes` | integer | What MLX may allocate |
361+
362+Example, after one chat request:
363+
364+```json
365+{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0",
366+ "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564},
367+ "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit",
368+ "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}],
369+ "recent_requests": [{"cached_tokens": 0, "completion_tokens": 9, "duration_ms": 529, "finished_at": 1795728740,
370+ "method": "POST", "model": "qwen", "path": "/v1/chat/completions", "prompt_tokens": 14, "status": 200}]}
371+```
372+
373+### POST /rzb/models/{id}/unload
374+
375+```bash
376+curl -s -X POST http://127.0.0.1:7920/rzb/models/mlx-community/Qwen3-4B-4bit/unload
377+```
378+
379+`{id}` is a [model name](#model-names). A declared `id` frees the load of its own kind; a Hugging Face id frees both its chat and its embedding loads. The next request for the model loads it again.
380+
381+| Case | Status | Body |
382+| --- | --- | --- |
383+| The model was loaded and idle | 200 | `{"model": "<id>", "status": "unloaded", "unloaded": ["<key>", …]}` |
384+| The model was not loaded | 200 | `{"model": "<id>", "status": "not_loaded", "unloaded": []}` |
385+| A request holds the model or waits for it | 409 | Error `model_busy`; nothing is unloaded |
386+| Not a model name | 404 | Error `model_not_found` |
387+| The path does not end with `/unload` | 404 | Error `unknown_url` |
388+
389+### POST /rzb/config/reload
390+
391+```bash
392+curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
393+```
394+
395+Reads the `--config` file again and applies it; what changes at once and what needs a restart is listed in the [configuration reference](configuration.md#reloading). Sending `SIGHUP` to the server does the same, with the outcome written to its log.
396+
397+| Field of the answer | Type | Value |
398+| --- | --- | --- |
399+| `file` | string | The file read |
400+| `declared_models` | integer | Models it declares |
401+| `unloaded` | array of strings | Loaded models no declared `id` points to anymore, unloaded now |
402+| `unload_when_idle` | array of strings | Such models still in use, unloaded when their last request ends |
403+| `restart_required` | array of strings | `server` keys changed in the file that only apply after a restart: `host`, `port`, `api_key_env`, `cors_origin`. A key set by a command-line option is never listed |
404+
405+| Case | Status | Body |
406+| --- | --- | --- |
407+| The file is valid | 200 | The fields above |
408+| The file is invalid or unreadable | 400 | Error `invalid_config` listing the problems; the configuration in force stays |
409+| The server was started without `--config` | 409 | Error `no_config_file` |
@@ -27,6 +27,7 @@ The examples use `mlx-community/Qwen3-4B-4bit` as chat model and `BAAI/bge-small
27 | `POST /v1/chat/completions` | Chat answer, plain or streamed, with structured output, tools and reasoning |27 | `POST /v1/chat/completions` | Chat answer, plain or streamed, with structured output, tools and reasoning |
28 | `POST /v1/completions` | Legacy text completion: the prompt is continued as raw text |28 | `POST /v1/completions` | Legacy text completion: the prompt is continued as raw text |
29 | `POST /v1/embeddings` | Embedding vectors |29 | `POST /v1/embeddings` | Embedding vectors |
30+| `GET /rzb/status`, `POST /rzb/…` | razorbill's own admin routes, from this machine only: see [local admin routes](#local-admin-routes-rzb) |
30 31
31 Any other path answers 404 with code `unknown_url`.32 Any other path answers 404 with code `unknown_url`.
32 33
@@ -298,3 +299,111 @@ curl -sN http://127.0.0.1:7920/v1/chat/completions \
298 -d '{"model": "mlx-community/Qwen3-4B-4bit", "messages": [{"role": "user", "content": "Count to 5."}],299 -d '{"model": "mlx-community/Qwen3-4B-4bit", "messages": [{"role": "user", "content": "Count to 5."}],
299 "stream": true, "stream_options": {"include_usage": true}, "reasoning_effort": "none"}'300 "stream": true, "stream_options": {"include_usage": true}, "reasoning_effort": "none"}'
300 ```301 ```
302+
303+## Local admin routes (/rzb)
304+
305+razorbill's own routes, for `rzb tui` and the operator of the server. They are not part of OpenAI's API and OpenAI clients never call them.
306+
307+| Rule | Value |
308+| --- | --- |
309+| Access | Only connections from the machine running the server (loopback: `127.0.0.0/8`, `::1`, `::ffff:127.x`), even when it listens on `0.0.0.0`; any other client gets 403 `local_only` |
310+| Authentication | As on `/v1`: `Authorization: Bearer <key>` when the server has an API key |
311+| Request log | Logged like every request, but left out of `recent_requests` |
312+
313+| Method and path | Purpose |
314+| --- | --- |
315+| `GET /rzb/status` | What the server process holds right now |
316+| `POST /rzb/models/{id}/unload` | Free a model now (`{id}` may contain `/`) |
317+| `POST /rzb/config/reload` | Read the configuration file again |
318+
319+### GET /rzb/status
320+
321+```bash
322+curl -s http://127.0.0.1:7920/rzb/status
323+```
324+
325+| Field | Type | Value |
326+| --- | --- | --- |
327+| `version` | string | razorbill's version |
328+| `uptime_seconds` | integer | Seconds since the server started |
329+| `host`, `port` | string, integer | The configured address (`port` is `0` when the server picked a free port) |
330+| `models` | array | The models loaded or being loaded, sorted by `key` (table below); `[]` when none |
331+| `recent_requests` | array | The last 50 requests answered, newest first (table below) |
332+| `memory` | object or `null` | The engine's memory (table below); `null` when the engine cannot measure it (the Linux build) |
333+
334+| Field of a model | Type | Value |
335+| --- | --- | --- |
336+| `key` | string | The loaded model: `org/name`, or `org/name#embedding` for an embedding load |
337+| `name` | string | The name of the request that loaded it (a declared `id` or a Hugging Face id) |
338+| `kind` | string | `chat` or `embedding` |
339+| `state` | string | `loading` until its first request has loaded it, then `loaded` |
340+| `size_bytes` | integer | Bytes of weights on disk; `0` when unknown |
341+| `busy` | boolean | A request holds it (loading it or generating) |
342+| `queued` | integer | Requests waiting for it |
343+| `idle_seconds` | number | Seconds since its last request ended (tenths); `0` while `busy` or `queued` |
344+| `keep_alive_left_seconds` | number or `null` | Seconds before [`keep_alive`](configuration.md#limits) unloads it; `null` while `busy` or `queued` |
345+
346+| Field of a request | Type | Value |
347+| --- | --- | --- |
348+| `method`, `path`, `status` | string, string, integer | The request and its answer's status |
349+| `model` | string or `null` | The model it used |
350+| `prompt_tokens`, `completion_tokens` | integer or `null` | Its token counts, when it generated |
351+| `cached_tokens` | integer | Prompt tokens reused from the previous request |
352+| `duration_ms` | integer | Time to the response head (to the first byte, for a stream) |
353+| `finished_at` | integer | Unix seconds |
354+
355+| Field of `memory` | Type | Value |
356+| --- | --- | --- |
357+| `active_bytes` | integer | Held by live arrays: weights, KV caches, activations |
358+| `cache_bytes` | integer | Freed by MLX but kept for reuse |
359+| `peak_bytes` | integer | Highest `active_bytes` since the process started |
360+| `limit_bytes` | integer | What MLX may allocate |
361+
362+Example, after one chat request:
363+
364+```json
365+{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0",
366+ "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564},
367+ "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit",
368+ "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}],
369+ "recent_requests": [{"cached_tokens": 0, "completion_tokens": 9, "duration_ms": 529, "finished_at": 1795728740,
370+ "method": "POST", "model": "qwen", "path": "/v1/chat/completions", "prompt_tokens": 14, "status": 200}]}
371+```
372+
373+### POST /rzb/models/{id}/unload
374+
375+```bash
376+curl -s -X POST http://127.0.0.1:7920/rzb/models/mlx-community/Qwen3-4B-4bit/unload
377+```
378+
379+`{id}` is a [model name](#model-names). A declared `id` frees the load of its own kind; a Hugging Face id frees both its chat and its embedding loads. The next request for the model loads it again.
380+
381+| Case | Status | Body |
382+| --- | --- | --- |
383+| The model was loaded and idle | 200 | `{"model": "<id>", "status": "unloaded", "unloaded": ["<key>", …]}` |
384+| The model was not loaded | 200 | `{"model": "<id>", "status": "not_loaded", "unloaded": []}` |
385+| A request holds the model or waits for it | 409 | Error `model_busy`; nothing is unloaded |
386+| Not a model name | 404 | Error `model_not_found` |
387+| The path does not end with `/unload` | 404 | Error `unknown_url` |
388+
389+### POST /rzb/config/reload
390+
391+```bash
392+curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
393+```
394+
395+Reads the `--config` file again and applies it; what changes at once and what needs a restart is listed in the [configuration reference](configuration.md#reloading). Sending `SIGHUP` to the server does the same, with the outcome written to its log.
396+
397+| Field of the answer | Type | Value |
398+| --- | --- | --- |
399+| `file` | string | The file read |
400+| `declared_models` | integer | Models it declares |
401+| `unloaded` | array of strings | Loaded models no declared `id` points to anymore, unloaded now |
402+| `unload_when_idle` | array of strings | Such models still in use, unloaded when their last request ends |
403+| `restart_required` | array of strings | `server` keys changed in the file that only apply after a restart: `host`, `port`, `api_key_env`, `cors_origin`. A key set by a command-line option is never listed |
404+
405+| Case | Status | Body |
406+| --- | --- | --- |
407+| The file is valid | 200 | The fields above |
408+| The file is invalid or unreadable | 400 | Error `invalid_config` listing the problems; the configuration in force stays |
409+| The server was started without `--config` | 409 | Error `no_config_file` |
modified docs/fr/README.md +2 -1
@@ -14,6 +14,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio
1414 - [Préparer une archive de release](how-to/preparer-une-release.md) : l'archive `.tar.gz` et son empreinte.
1515 - [Gérer les modèles](how-to/gerer-les-modeles.md)
1616 - [Configurer le serveur](how-to/configurer-le-serveur.md) : noms de modèles, valeurs par défaut, verrous, limites, accès réseau.
17+- [Surveiller et piloter un serveur en marche](how-to/surveiller-et-piloter-le-serveur.md) : état, libération d'un modèle, rechargement de la configuration.
1718 - [Utiliser razorbill depuis un client OpenAI](how-to/utiliser-des-clients-openai.md) : Python, JavaScript, LangChain, interfaces de chat.
1819 - [Obtenir une sortie structurée](how-to/obtenir-une-sortie-structuree.md)
1920 - [Utiliser l'appel de fonctions](how-to/utiliser-l-appel-de-fonctions.md)
@@ -24,7 +25,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio
2425
2526 ## Consulter — référence
2627
27-- [API HTTP](reference/api-http.md) : endpoints, champs pris en charge, refusés et ignorés, réponses, streaming.
28+- [API HTTP](reference/api-http.md) : endpoints, champs pris en charge, refusés et ignorés, réponses, streaming, routes d'administration locales.
2829 - [Fichier de configuration du serveur](reference/configuration.md) : chaque clé, son type, sa valeur par défaut et ses erreurs.
2930 - [Ligne de commande](reference/ligne-de-commande.md) : `rzb serve`, `rzb models`, `rzb config validate`, codes de sortie.
3031 - [Erreurs de l'API](reference/erreurs.md) : statuts, types et codes.
@@ -14,6 +14,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio
14 - [Préparer une archive de release](how-to/preparer-une-release.md) : l'archive `.tar.gz` et son empreinte.14 - [Préparer une archive de release](how-to/preparer-une-release.md) : l'archive `.tar.gz` et son empreinte.
15 - [Gérer les modèles](how-to/gerer-les-modeles.md)15 - [Gérer les modèles](how-to/gerer-les-modeles.md)
16 - [Configurer le serveur](how-to/configurer-le-serveur.md) : noms de modèles, valeurs par défaut, verrous, limites, accès réseau.16 - [Configurer le serveur](how-to/configurer-le-serveur.md) : noms de modèles, valeurs par défaut, verrous, limites, accès réseau.
17+- [Surveiller et piloter un serveur en marche](how-to/surveiller-et-piloter-le-serveur.md) : état, libération d'un modèle, rechargement de la configuration.
17 - [Utiliser razorbill depuis un client OpenAI](how-to/utiliser-des-clients-openai.md) : Python, JavaScript, LangChain, interfaces de chat.18 - [Utiliser razorbill depuis un client OpenAI](how-to/utiliser-des-clients-openai.md) : Python, JavaScript, LangChain, interfaces de chat.
18 - [Obtenir une sortie structurée](how-to/obtenir-une-sortie-structuree.md)19 - [Obtenir une sortie structurée](how-to/obtenir-une-sortie-structuree.md)
19 - [Utiliser l'appel de fonctions](how-to/utiliser-l-appel-de-fonctions.md)20 - [Utiliser l'appel de fonctions](how-to/utiliser-l-appel-de-fonctions.md)
@@ -24,7 +25,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio
24 25
25 ## Consulter — référence26 ## Consulter — référence
26 27
27-- [API HTTP](reference/api-http.md) : endpoints, champs pris en charge, refusés et ignorés, réponses, streaming.28+- [API HTTP](reference/api-http.md) : endpoints, champs pris en charge, refusés et ignorés, réponses, streaming, routes d'administration locales.
28 - [Fichier de configuration du serveur](reference/configuration.md) : chaque clé, son type, sa valeur par défaut et ses erreurs.29 - [Fichier de configuration du serveur](reference/configuration.md) : chaque clé, son type, sa valeur par défaut et ses erreurs.
29 - [Ligne de commande](reference/ligne-de-commande.md) : `rzb serve`, `rzb models`, `rzb config validate`, codes de sortie.30 - [Ligne de commande](reference/ligne-de-commande.md) : `rzb serve`, `rzb models`, `rzb config validate`, codes de sortie.
30 - [Erreurs de l'API](reference/erreurs.md) : statuts, types et codes.31 - [Erreurs de l'API](reference/erreurs.md) : statuts, types et codes.
modified docs/fr/explanation/compatibilite-openai.md +11 -0
@@ -39,6 +39,16 @@ Seul `thinking_budget` est propre à razorbill, faute de convention commune pour
3939 - **Les pénalités regardent une fenêtre.** `presence_penalty` et `frequency_penalty` comptent les 20 derniers tokens, prompt compris, comme le fait mlx-swift-lm ; OpenAI compte toute la réponse. `repetition_penalty` fonctionne de la même façon, avec une fenêtre réglée par `repetition_context_size`.
4040 - **Les réglages verrouillés l'emportent.** Un opérateur peut imposer `temperature` ou plafonner `max_tokens` pour tous les clients, ce qui n'a pas d'équivalent dans l'API d'OpenAI.
4141
42+## Des routes à nous, sous /rzb
43+
44+razorbill est parti d'une règle ferme : l'API d'OpenAI et rien d'autre, pas d'`/api/*` maison à la manière d'Ollama. Une deuxième API serait une deuxième chose à garder stable, et chaque fonction exposée par elle serait une fonction que les clients OpenAI ne peuvent pas utiliser.
45+
46+L'interface en terminal (`rzb tui`) a assoupli cette règle. C'est un deuxième processus `rzb` sur le même Mac : il discute par l'API d'OpenAI comme n'importe quel client, et lit directement le cache des modèles et le fichier de configuration, comme `rzb models` et `rzb config validate`. Ce que seul le processus du serveur sait — quels modèles sont en mémoire, qui les attend, ce que tient MLX, les dernières requêtes — n'a pas d'endpoint OpenAI, pas plus que demander au processus de libérer un modèle ou de relire son fichier. Ces quelques besoins ont reçu des routes à eux, sous `/rzb/`, un préfixe qu'on ne peut confondre ni avec un chemin OpenAI ni avec ceux d'Ollama.
47+
48+Elles ne répondent qu'à la machine elle-même, même sur un serveur qui écoute sur `0.0.0.0`. Les routes `/v1` servent qui l'opérateur laisse entrer ; les routes `/rzb` agissent sur le serveur pour tout le monde et montrent ce que font les autres clients. La personne autorisée à le faire est celle qui est devant le Mac, et l'adresse de la connexion en est la preuve la plus simple qui ne demande pas une deuxième clé. La clé d'API s'applique en plus, si bien qu'un Mac partagé avec une clé définie n'ouvre pas ces routes à chaque utilisateur local.
49+
50+L'interface interroge `GET /rzb/status` à intervalles réguliers plutôt que de suivre un flux d'événements. Un rafraîchissement par seconde environ coûte quelques centaines d'octets, ne garde aucune connexion ouverte et fonctionne avec `curl` et `watch` ; un flux d'événements ajouterait une deuxième façon d'apprendre le même état, à garder cohérente avec la première.
51+
4252 ## Comment la compatibilité est vérifiée
4353
4454 Les tests unitaires vérifient les formes ; ils ne peuvent pas vérifier que les vraies bibliothèques font la même lecture de ces formes que nous. Une suite à part, `Tests/Compatibility`, pilote un `rzb serve` en marche avec les clients officiels — la bibliothèque `openai`, LangChain, et chaque exemple `curl` de la référence de l'API — et vérifie ce que verrait un utilisateur : un objet Pydantic analysé, un aller-retour d'appel d'outil, des similarités cosinus égales à celles de la bibliothèque Python `sentence-transformers`, des exceptions typées sur les erreurs.
@@ -48,4 +58,5 @@ Elle tourne en deux modes. Sous Linux, contre le moteur factice, elle vérifie l
4858 ## Lien avec le reste
4959
5060 - Ce qui est pris en charge, refusé et ignoré, champ par champ : [référence de l'API HTTP](../reference/api-http.md).
61+- Utiliser les routes `/rzb` : [surveiller et piloter un serveur en marche](../how-to/surveiller-et-piloter-le-serveur.md).
5162 - Lancer la suite : [lancer les tests](../how-to/lancer-les-tests.md#vérifier-la-compatibilité-avec-de-vrais-clients-openai).
@@ -39,6 +39,16 @@ Seul `thinking_budget` est propre à razorbill, faute de convention commune pour
39 - **Les pénalités regardent une fenêtre.** `presence_penalty` et `frequency_penalty` comptent les 20 derniers tokens, prompt compris, comme le fait mlx-swift-lm ; OpenAI compte toute la réponse. `repetition_penalty` fonctionne de la même façon, avec une fenêtre réglée par `repetition_context_size`.39 - **Les pénalités regardent une fenêtre.** `presence_penalty` et `frequency_penalty` comptent les 20 derniers tokens, prompt compris, comme le fait mlx-swift-lm ; OpenAI compte toute la réponse. `repetition_penalty` fonctionne de la même façon, avec une fenêtre réglée par `repetition_context_size`.
40 - **Les réglages verrouillés l'emportent.** Un opérateur peut imposer `temperature` ou plafonner `max_tokens` pour tous les clients, ce qui n'a pas d'équivalent dans l'API d'OpenAI.40 - **Les réglages verrouillés l'emportent.** Un opérateur peut imposer `temperature` ou plafonner `max_tokens` pour tous les clients, ce qui n'a pas d'équivalent dans l'API d'OpenAI.
41 41
42+## Des routes à nous, sous /rzb
43+
44+razorbill est parti d'une règle ferme : l'API d'OpenAI et rien d'autre, pas d'`/api/*` maison à la manière d'Ollama. Une deuxième API serait une deuxième chose à garder stable, et chaque fonction exposée par elle serait une fonction que les clients OpenAI ne peuvent pas utiliser.
45+
46+L'interface en terminal (`rzb tui`) a assoupli cette règle. C'est un deuxième processus `rzb` sur le même Mac : il discute par l'API d'OpenAI comme n'importe quel client, et lit directement le cache des modèles et le fichier de configuration, comme `rzb models` et `rzb config validate`. Ce que seul le processus du serveur sait — quels modèles sont en mémoire, qui les attend, ce que tient MLX, les dernières requêtes — n'a pas d'endpoint OpenAI, pas plus que demander au processus de libérer un modèle ou de relire son fichier. Ces quelques besoins ont reçu des routes à eux, sous `/rzb/`, un préfixe qu'on ne peut confondre ni avec un chemin OpenAI ni avec ceux d'Ollama.
47+
48+Elles ne répondent qu'à la machine elle-même, même sur un serveur qui écoute sur `0.0.0.0`. Les routes `/v1` servent qui l'opérateur laisse entrer ; les routes `/rzb` agissent sur le serveur pour tout le monde et montrent ce que font les autres clients. La personne autorisée à le faire est celle qui est devant le Mac, et l'adresse de la connexion en est la preuve la plus simple qui ne demande pas une deuxième clé. La clé d'API s'applique en plus, si bien qu'un Mac partagé avec une clé définie n'ouvre pas ces routes à chaque utilisateur local.
49+
50+L'interface interroge `GET /rzb/status` à intervalles réguliers plutôt que de suivre un flux d'événements. Un rafraîchissement par seconde environ coûte quelques centaines d'octets, ne garde aucune connexion ouverte et fonctionne avec `curl` et `watch` ; un flux d'événements ajouterait une deuxième façon d'apprendre le même état, à garder cohérente avec la première.
51+
42 ## Comment la compatibilité est vérifiée52 ## Comment la compatibilité est vérifiée
43 53
44 Les tests unitaires vérifient les formes ; ils ne peuvent pas vérifier que les vraies bibliothèques font la même lecture de ces formes que nous. Une suite à part, `Tests/Compatibility`, pilote un `rzb serve` en marche avec les clients officiels — la bibliothèque `openai`, LangChain, et chaque exemple `curl` de la référence de l'API — et vérifie ce que verrait un utilisateur : un objet Pydantic analysé, un aller-retour d'appel d'outil, des similarités cosinus égales à celles de la bibliothèque Python `sentence-transformers`, des exceptions typées sur les erreurs.54 Les tests unitaires vérifient les formes ; ils ne peuvent pas vérifier que les vraies bibliothèques font la même lecture de ces formes que nous. Une suite à part, `Tests/Compatibility`, pilote un `rzb serve` en marche avec les clients officiels — la bibliothèque `openai`, LangChain, et chaque exemple `curl` de la référence de l'API — et vérifie ce que verrait un utilisateur : un objet Pydantic analysé, un aller-retour d'appel d'outil, des similarités cosinus égales à celles de la bibliothèque Python `sentence-transformers`, des exceptions typées sur les erreurs.
@@ -48,4 +58,5 @@ Elle tourne en deux modes. Sous Linux, contre le moteur factice, elle vérifie l
48 ## Lien avec le reste58 ## Lien avec le reste
49 59
50 - Ce qui est pris en charge, refusé et ignoré, champ par champ : [référence de l'API HTTP](../reference/api-http.md).60 - Ce qui est pris en charge, refusé et ignoré, champ par champ : [référence de l'API HTTP](../reference/api-http.md).
61+- Utiliser les routes `/rzb` : [surveiller et piloter un serveur en marche](../how-to/surveiller-et-piloter-le-serveur.md).
51 - Lancer la suite : [lancer les tests](../how-to/lancer-les-tests.md#vérifier-la-compatibilité-avec-de-vrais-clients-openai).62 - Lancer la suite : [lancer les tests](../how-to/lancer-les-tests.md#vérifier-la-compatibilité-avec-de-vrais-clients-openai).
modified docs/fr/explanation/cycle-de-vie-des-modeles.md +7 -1
@@ -41,6 +41,12 @@ Quand un modèle doit être chargé et qu'une des limites serait dépassée, le
4141
4242 Un service en arrière-plan vérifie régulièrement (tous les quarts de `keep_alive`, au plus toutes les 30 secondes) et décharge les modèles inutilisés depuis `limits.keep_alive` (10 minutes par défaut). La requête suivante recharge le modèle, ce qui coûte quelques secondes pour un petit modèle. Quand le serveur s'arrête (Ctrl-C, SIGTERM), tous les modèles sont déchargés avant la fin du processus.
4343
44+## Décharger à la demande et recharger
45+
46+L'opérateur peut aussi libérer un modèle tout de suite (`POST /rzb/models/{id}/unload`), pour faire de la place à autre chose sur le Mac. Un modèle qu'une requête tient ou attend n'est pas déchargé : l'appel répond 409 et ne change rien. Attendre que la file se vide pourrait bloquer l'appelant des minutes derrière de longues générations, et annuler les requêtes casserait des réponses que des clients sont en train de lire ; refuser laisse le choix à l'opérateur, qui voit `busy` et `queued` dans l'état et peut réessayer.
47+
48+Un rechargement de la configuration (`POST /rzb/config/reload` ou `SIGHUP`) remplace d'un coup la liste des modèles déclarés, les valeurs par défaut, les verrous et les limites : les requêtes déjà en cours gardent les réglages avec lesquels elles ont commencé, les suivantes sont résolues avec le nouveau fichier. Un modèle chargé vers lequel plus aucun nom déclaré ne pointe resterait sinon en mémoire jusqu'à `keep_alive` ; il est déchargé tout de suite s'il est au repos, sinon à la fin de sa dernière requête. L'adresse d'écoute, le port, la variable de la clé d'API et CORS sont mis en place avant la première requête et partagés par toutes les connexions ; les changer dans un processus en marche reviendrait à reconstruire le serveur sous ses clients : ils sont plutôt signalés comme demandant un redémarrage.
49+
4450 ## Quand le client s'en va
4551
4652 Une génération que personne ne lira gaspille le GPU et retarde toute la file. Le serveur surveille donc la connexion pendant qu'il répond : quand le client se déconnecte, la tâche de génération est annulée, le tour du modèle est libéré et la requête suivante démarre. Une requête encore en attente est simplement retirée de la file.
@@ -57,6 +63,6 @@ Pendant un flux, un client disparu n'est remarqué que lorsqu'une écriture éch
5763
5864 ## Lien avec le reste
5965
60-- Les clés qui règlent ces limites : [référence de la configuration](../reference/configuration.md#limits).
66+- Les clés qui règlent ces limites : [référence de la configuration](../reference/configuration.md#limits) ; ce que change un rechargement : [rechargement](../reference/configuration.md#rechargement).
6167 - Les erreurs que voit un client : [référence des erreurs](../reference/erreurs.md#codes).
6268 - La place du gestionnaire dans une requête : [architecture](architecture.md#le-trajet-dune-requête-de-chat).
@@ -41,6 +41,12 @@ Quand un modèle doit être chargé et qu'une des limites serait dépassée, le
41 41
42 Un service en arrière-plan vérifie régulièrement (tous les quarts de `keep_alive`, au plus toutes les 30 secondes) et décharge les modèles inutilisés depuis `limits.keep_alive` (10 minutes par défaut). La requête suivante recharge le modèle, ce qui coûte quelques secondes pour un petit modèle. Quand le serveur s'arrête (Ctrl-C, SIGTERM), tous les modèles sont déchargés avant la fin du processus.42 Un service en arrière-plan vérifie régulièrement (tous les quarts de `keep_alive`, au plus toutes les 30 secondes) et décharge les modèles inutilisés depuis `limits.keep_alive` (10 minutes par défaut). La requête suivante recharge le modèle, ce qui coûte quelques secondes pour un petit modèle. Quand le serveur s'arrête (Ctrl-C, SIGTERM), tous les modèles sont déchargés avant la fin du processus.
43 43
44+## Décharger à la demande et recharger
45+
46+L'opérateur peut aussi libérer un modèle tout de suite (`POST /rzb/models/{id}/unload`), pour faire de la place à autre chose sur le Mac. Un modèle qu'une requête tient ou attend n'est pas déchargé : l'appel répond 409 et ne change rien. Attendre que la file se vide pourrait bloquer l'appelant des minutes derrière de longues générations, et annuler les requêtes casserait des réponses que des clients sont en train de lire ; refuser laisse le choix à l'opérateur, qui voit `busy` et `queued` dans l'état et peut réessayer.
47+
48+Un rechargement de la configuration (`POST /rzb/config/reload` ou `SIGHUP`) remplace d'un coup la liste des modèles déclarés, les valeurs par défaut, les verrous et les limites : les requêtes déjà en cours gardent les réglages avec lesquels elles ont commencé, les suivantes sont résolues avec le nouveau fichier. Un modèle chargé vers lequel plus aucun nom déclaré ne pointe resterait sinon en mémoire jusqu'à `keep_alive` ; il est déchargé tout de suite s'il est au repos, sinon à la fin de sa dernière requête. L'adresse d'écoute, le port, la variable de la clé d'API et CORS sont mis en place avant la première requête et partagés par toutes les connexions ; les changer dans un processus en marche reviendrait à reconstruire le serveur sous ses clients : ils sont plutôt signalés comme demandant un redémarrage.
49+
44 ## Quand le client s'en va50 ## Quand le client s'en va
45 51
46 Une génération que personne ne lira gaspille le GPU et retarde toute la file. Le serveur surveille donc la connexion pendant qu'il répond : quand le client se déconnecte, la tâche de génération est annulée, le tour du modèle est libéré et la requête suivante démarre. Une requête encore en attente est simplement retirée de la file.52 Une génération que personne ne lira gaspille le GPU et retarde toute la file. Le serveur surveille donc la connexion pendant qu'il répond : quand le client se déconnecte, la tâche de génération est annulée, le tour du modèle est libéré et la requête suivante démarre. Une requête encore en attente est simplement retirée de la file.
@@ -57,6 +63,6 @@ Pendant un flux, un client disparu n'est remarqué que lorsqu'une écriture éch
57 63
58 ## Lien avec le reste64 ## Lien avec le reste
59 65
60-- Les clés qui règlent ces limites : [référence de la configuration](../reference/configuration.md#limits).66+- Les clés qui règlent ces limites : [référence de la configuration](../reference/configuration.md#limits) ; ce que change un rechargement : [rechargement](../reference/configuration.md#rechargement).
61 - Les erreurs que voit un client : [référence des erreurs](../reference/erreurs.md#codes).67 - Les erreurs que voit un client : [référence des erreurs](../reference/erreurs.md#codes).
62 - La place du gestionnaire dans une requête : [architecture](architecture.md#le-trajet-dune-requête-de-chat).68 - La place du gestionnaire dans une requête : [architecture](architecture.md#le-trajet-dune-requête-de-chat).
modified docs/fr/how-to/configurer-le-serveur.md +1 -0
@@ -116,3 +116,4 @@ N'utilisez `*` (toutes les origines) qu'avec une clé d'API : sinon n'importe qu
116116
117117 - Chaque clé, type et valeur par défaut : [référence de la configuration](../reference/configuration.md).
118118 - Comment les modèles sont chargés, mis en file d'attente et déchargés : [cycle de vie des modèles](../explanation/cycle-de-vie-des-modeles.md).
119+- Appliquer un changement à un serveur en marche sans le redémarrer : [surveiller et piloter un serveur en marche](surveiller-et-piloter-le-serveur.md#appliquer-un-changement-de-configuration-sans-redémarrer).
@@ -116,3 +116,4 @@ N'utilisez `*` (toutes les origines) qu'avec une clé d'API : sinon n'importe qu
116 116
117 - Chaque clé, type et valeur par défaut : [référence de la configuration](../reference/configuration.md).117 - Chaque clé, type et valeur par défaut : [référence de la configuration](../reference/configuration.md).
118 - Comment les modèles sont chargés, mis en file d'attente et déchargés : [cycle de vie des modèles](../explanation/cycle-de-vie-des-modeles.md).118 - Comment les modèles sont chargés, mis en file d'attente et déchargés : [cycle de vie des modèles](../explanation/cycle-de-vie-des-modeles.md).
119+- Appliquer un changement à un serveur en marche sans le redémarrer : [surveiller et piloter un serveur en marche](surveiller-et-piloter-le-serveur.md#appliquer-un-changement-de-configuration-sans-redémarrer).
added docs/fr/how-to/surveiller-et-piloter-le-serveur.md +55 -0
new file mode 100644
@@ -0,0 +1,55 @@
1+# Surveiller et piloter un serveur en marche
2+
3+Ce guide montre comment voir ce que détient un `rzb serve` en marche, libérer la mémoire d'un modèle et appliquer un changement de configuration sans redémarrer. Il suppose que le serveur tourne sur ton Mac et que tu as un shell sur ce Mac : ces routes ne répondent qu'à la machine elle-même.
4+
5+## Voir ce que détient le serveur
6+
7+```bash
8+curl -s http://127.0.0.1:7920/rzb/status | python3 -m json.tool
9+```
10+
11+`models` liste ce qui est chargé, si une requête le tient (`busy`), combien attendent (`queued`) et dans combien de temps `keep_alive` le déchargera. `recent_requests` montre les 50 dernières requêtes avec leur modèle, leurs tokens et leur durée. `memory` montre ce que MLX tient en ce moment et à son maximum. Pour le voir évoluer, répète l'appel : `watch -n 1 'curl -s http://127.0.0.1:7920/rzb/status'`.
12+
13+## Libérer tout de suite la mémoire d'un modèle
14+
15+```bash
16+curl -s -X POST http://127.0.0.1:7920/rzb/models/qwen3/unload
17+```
18+
19+Utilise le nom qu'utilisent les clients : un `id` déclaré, ou un id Hugging Face comme `mlx-community/Qwen3-4B-4bit` (le `/` reste tel quel dans le chemin). La réponse dit `unloaded`, ou `not_loaded` quand il n'y avait rien à libérer.
20+
21+Si la réponse est un 409 `model_busy`, une requête génère avec le modèle ou l'attend. Rien n'a été déchargé : réessaie quand l'état montre `busy` à `false` et `queued` à `0`. La requête suivante pour le modèle le recharge.
22+
23+## Appliquer un changement de configuration sans redémarrer
24+
25+1. Modifie le fichier avec lequel le serveur a démarré (`rzb serve --config server.yaml`).
26+2. Vérifie-le : `rzb config validate server.yaml`.
27+3. Demande au serveur de le relire, au choix :
28+
29+ ```bash
30+ curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
31+ ```
32+
33+ ou, ce qui écrit le résultat dans le journal du serveur plutôt que dans la réponse :
34+
35+ ```bash
36+ kill -HUP "$(pgrep -f 'rzb serve')"
37+ ```
38+
39+4. Lis la réponse (ou la ligne de journal `configuration reloaded from …`) :
40+ - `unloaded` et `unload_when_idle` nomment les modèles chargés que tu as retirés ou déplacés vers une autre source ; ils sont libérés tout de suite, ou à la fin de leurs requêtes.
41+ - `restart_required` nomme les clés `server:` modifiées qui ne s'appliquent qu'après un redémarrage (`host`, `port`, `api_key_env`, `cors_origin`) : arrête le serveur et relance-le pour celles-là.
42+
43+Si le fichier a un problème, la réponse est un 400 `invalid_config` qui le décrit, et le serveur garde la configuration qu'il avait : corrige le fichier et recharge à nouveau. Un serveur démarré sans `--config` répond 409 `no_config_file` : il n'y a pas de fichier à relire, relance-le avec un fichier.
44+
45+## Variantes
46+
47+- **Le serveur a une clé d'API** : ajoute `-H "Authorization: Bearer $RZB_API_KEY"` à chaque `curl` ; ces routes l'exigent comme `/v1`.
48+- **Le serveur écoute sur un autre port** : remplace `7920` dans les URL.
49+- **Tu es sur une autre machine** : les routes répondent 403 `local_only`. Lance les commandes sur le Mac lui-même, par exemple via `ssh`, ou redirige le port (`ssh -L 7920:127.0.0.1:7920 mac`) et appelle `http://127.0.0.1:7920` en local : le serveur voit alors une connexion venant de lui-même.
50+
51+## Voir aussi
52+
53+- Chaque champ et statut de ces routes : [référence de l'API HTTP](../reference/api-http.md#routes-dadministration-locales-rzb).
54+- L'effet de chaque clé au rechargement : [référence de la configuration](../reference/configuration.md#rechargement).
55+- Pourquoi ces routes existent et restent locales : [compatibilité OpenAI](../explanation/compatibilite-openai.md#des-routes-à-nous-sous-rzb) ; comment le déchargement s'inscrit dans le cycle de vie des modèles : [cycle de vie des modèles](../explanation/cycle-de-vie-des-modeles.md#décharger-à-la-demande-et-recharger).
new file mode 100644
@@ -0,0 +1,55 @@
1+# Surveiller et piloter un serveur en marche
2+
3+Ce guide montre comment voir ce que détient un `rzb serve` en marche, libérer la mémoire d'un modèle et appliquer un changement de configuration sans redémarrer. Il suppose que le serveur tourne sur ton Mac et que tu as un shell sur ce Mac : ces routes ne répondent qu'à la machine elle-même.
4+
5+## Voir ce que détient le serveur
6+
7+```bash
8+curl -s http://127.0.0.1:7920/rzb/status | python3 -m json.tool
9+```
10+
11+`models` liste ce qui est chargé, si une requête le tient (`busy`), combien attendent (`queued`) et dans combien de temps `keep_alive` le déchargera. `recent_requests` montre les 50 dernières requêtes avec leur modèle, leurs tokens et leur durée. `memory` montre ce que MLX tient en ce moment et à son maximum. Pour le voir évoluer, répète l'appel : `watch -n 1 'curl -s http://127.0.0.1:7920/rzb/status'`.
12+
13+## Libérer tout de suite la mémoire d'un modèle
14+
15+```bash
16+curl -s -X POST http://127.0.0.1:7920/rzb/models/qwen3/unload
17+```
18+
19+Utilise le nom qu'utilisent les clients : un `id` déclaré, ou un id Hugging Face comme `mlx-community/Qwen3-4B-4bit` (le `/` reste tel quel dans le chemin). La réponse dit `unloaded`, ou `not_loaded` quand il n'y avait rien à libérer.
20+
21+Si la réponse est un 409 `model_busy`, une requête génère avec le modèle ou l'attend. Rien n'a été déchargé : réessaie quand l'état montre `busy` à `false` et `queued` à `0`. La requête suivante pour le modèle le recharge.
22+
23+## Appliquer un changement de configuration sans redémarrer
24+
25+1. Modifie le fichier avec lequel le serveur a démarré (`rzb serve --config server.yaml`).
26+2. Vérifie-le : `rzb config validate server.yaml`.
27+3. Demande au serveur de le relire, au choix :
28+
29+ ```bash
30+ curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
31+ ```
32+
33+ ou, ce qui écrit le résultat dans le journal du serveur plutôt que dans la réponse :
34+
35+ ```bash
36+ kill -HUP "$(pgrep -f 'rzb serve')"
37+ ```
38+
39+4. Lis la réponse (ou la ligne de journal `configuration reloaded from …`) :
40+ - `unloaded` et `unload_when_idle` nomment les modèles chargés que tu as retirés ou déplacés vers une autre source ; ils sont libérés tout de suite, ou à la fin de leurs requêtes.
41+ - `restart_required` nomme les clés `server:` modifiées qui ne s'appliquent qu'après un redémarrage (`host`, `port`, `api_key_env`, `cors_origin`) : arrête le serveur et relance-le pour celles-là.
42+
43+Si le fichier a un problème, la réponse est un 400 `invalid_config` qui le décrit, et le serveur garde la configuration qu'il avait : corrige le fichier et recharge à nouveau. Un serveur démarré sans `--config` répond 409 `no_config_file` : il n'y a pas de fichier à relire, relance-le avec un fichier.
44+
45+## Variantes
46+
47+- **Le serveur a une clé d'API** : ajoute `-H "Authorization: Bearer $RZB_API_KEY"` à chaque `curl` ; ces routes l'exigent comme `/v1`.
48+- **Le serveur écoute sur un autre port** : remplace `7920` dans les URL.
49+- **Tu es sur une autre machine** : les routes répondent 403 `local_only`. Lance les commandes sur le Mac lui-même, par exemple via `ssh`, ou redirige le port (`ssh -L 7920:127.0.0.1:7920 mac`) et appelle `http://127.0.0.1:7920` en local : le serveur voit alors une connexion venant de lui-même.
50+
51+## Voir aussi
52+
53+- Chaque champ et statut de ces routes : [référence de l'API HTTP](../reference/api-http.md#routes-dadministration-locales-rzb).
54+- L'effet de chaque clé au rechargement : [référence de la configuration](../reference/configuration.md#rechargement).
55+- Pourquoi ces routes existent et restent locales : [compatibilité OpenAI](../explanation/compatibilite-openai.md#des-routes-à-nous-sous-rzb) ; comment le déchargement s'inscrit dans le cycle de vie des modèles : [cycle de vie des modèles](../explanation/cycle-de-vie-des-modeles.md#décharger-à-la-demande-et-recharger).
modified docs/fr/reference/api-http.md +109 -0
@@ -27,6 +27,7 @@ Les exemples utilisent `mlx-community/Qwen3-4B-4bit` comme modèle de chat et `B
2727 | `POST /v1/chat/completions` | Réponse de chat, entière ou en flux, avec sortie structurée, outils et raisonnement |
2828 | `POST /v1/completions` | Complétion de texte historique : le prompt est continué tel quel |
2929 | `POST /v1/embeddings` | Vecteurs d'embedding |
30+| `GET /rzb/status`, `POST /rzb/…` | Les routes d'administration propres à razorbill, depuis cette machine seulement : voir [routes d'administration locales](#routes-dadministration-locales-rzb) |
3031
3132 Tout autre chemin répond 404 avec le code `unknown_url`.
3233
@@ -298,3 +299,111 @@ curl -sN http://127.0.0.1:7920/v1/chat/completions \
298299 -d '{"model": "mlx-community/Qwen3-4B-4bit", "messages": [{"role": "user", "content": "Count to 5."}],
299300 "stream": true, "stream_options": {"include_usage": true}, "reasoning_effort": "none"}'
300301 ```
302+
303+## Routes d'administration locales (/rzb)
304+
305+Les routes propres à razorbill, pour `rzb tui` et l'opérateur du serveur. Elles ne font pas partie de l'API d'OpenAI et les clients OpenAI ne les appellent jamais.
306+
307+| Règle | Valeur |
308+| --- | --- |
309+| Accès | Seulement les connexions venant de la machine qui fait tourner le serveur (loopback : `127.0.0.0/8`, `::1`, `::ffff:127.x`), même quand il écoute sur `0.0.0.0` ; tout autre client reçoit un 403 `local_only` |
310+| Authentification | Comme sur `/v1` : `Authorization: Bearer <clé>` quand le serveur a une clé d'API |
311+| Journal des requêtes | Journalisées comme toute requête, mais absentes de `recent_requests` |
312+
313+| Méthode et chemin | Rôle |
314+| --- | --- |
315+| `GET /rzb/status` | Ce que le processus du serveur détient en ce moment |
316+| `POST /rzb/models/{id}/unload` | Libérer un modèle tout de suite (`{id}` peut contenir `/`) |
317+| `POST /rzb/config/reload` | Relire le fichier de configuration |
318+
319+### GET /rzb/status
320+
321+```bash
322+curl -s http://127.0.0.1:7920/rzb/status
323+```
324+
325+| Champ | Type | Valeur |
326+| --- | --- | --- |
327+| `version` | chaîne | La version de razorbill |
328+| `uptime_seconds` | entier | Secondes écoulées depuis le démarrage du serveur |
329+| `host`, `port` | chaîne, entier | L'adresse configurée (`port` vaut `0` quand le serveur a choisi un port libre) |
330+| `models` | tableau | Les modèles chargés ou en cours de chargement, triés par `key` (tableau ci-dessous) ; `[]` s'il n'y en a aucun |
331+| `recent_requests` | tableau | Les 50 dernières requêtes traitées, la plus récente d'abord (tableau ci-dessous) |
332+| `memory` | objet ou `null` | La mémoire du moteur (tableau ci-dessous) ; `null` quand le moteur ne sait pas la mesurer (la version Linux) |
333+
334+| Champ d'un modèle | Type | Valeur |
335+| --- | --- | --- |
336+| `key` | chaîne | Le modèle chargé : `org/nom`, ou `org/nom#embedding` pour un chargement d'embedding |
337+| `name` | chaîne | Le nom donné par la requête qui l'a chargé (un `id` déclaré ou un id Hugging Face) |
338+| `kind` | chaîne | `chat` ou `embedding` |
339+| `state` | chaîne | `loading` tant que sa première requête le charge, puis `loaded` |
340+| `size_bytes` | entier | Octets de poids sur le disque ; `0` si inconnu |
341+| `busy` | booléen | Une requête le tient (elle le charge ou génère) |
342+| `queued` | entier | Requêtes qui l'attendent |
343+| `idle_seconds` | nombre | Secondes depuis la fin de sa dernière requête (au dixième) ; `0` tant que `busy` ou `queued` |
344+| `keep_alive_left_seconds` | nombre ou `null` | Secondes avant que [`keep_alive`](configuration.md#limits) le décharge ; `null` tant que `busy` ou `queued` |
345+
346+| Champ d'une requête | Type | Valeur |
347+| --- | --- | --- |
348+| `method`, `path`, `status` | chaîne, chaîne, entier | La requête et le statut de sa réponse |
349+| `model` | chaîne ou `null` | Le modèle qu'elle a utilisé |
350+| `prompt_tokens`, `completion_tokens` | entier ou `null` | Ses nombres de tokens, quand elle a généré |
351+| `cached_tokens` | entier | Tokens du prompt repris de la requête précédente |
352+| `duration_ms` | entier | Temps jusqu'à l'en-tête de la réponse (jusqu'au premier octet, pour un flux) |
353+| `finished_at` | entier | Secondes Unix |
354+
355+| Champ de `memory` | Type | Valeur |
356+| --- | --- | --- |
357+| `active_bytes` | entier | Tenu par les tableaux vivants : poids, caches KV, activations |
358+| `cache_bytes` | entier | Libéré par MLX mais gardé pour être réutilisé |
359+| `peak_bytes` | entier | Le plus haut `active_bytes` depuis le démarrage du processus |
360+| `limit_bytes` | entier | Ce que MLX peut allouer |
361+
362+Exemple, après une requête de chat :
363+
364+```json
365+{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0",
366+ "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564},
367+ "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit",
368+ "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}],
369+ "recent_requests": [{"cached_tokens": 0, "completion_tokens": 9, "duration_ms": 529, "finished_at": 1795728740,
370+ "method": "POST", "model": "qwen", "path": "/v1/chat/completions", "prompt_tokens": 14, "status": 200}]}
371+```
372+
373+### POST /rzb/models/{id}/unload
374+
375+```bash
376+curl -s -X POST http://127.0.0.1:7920/rzb/models/mlx-community/Qwen3-4B-4bit/unload
377+```
378+
379+`{id}` est un [nom de modèle](#noms-de-modèles). Un `id` déclaré libère le chargement de son propre type ; un id Hugging Face libère à la fois son chargement de chat et son chargement d'embedding. La requête suivante pour ce modèle le recharge.
380+
381+| Cas | Statut | Corps |
382+| --- | --- | --- |
383+| Le modèle était chargé et au repos | 200 | `{"model": "<id>", "status": "unloaded", "unloaded": ["<key>", …]}` |
384+| Le modèle n'était pas chargé | 200 | `{"model": "<id>", "status": "not_loaded", "unloaded": []}` |
385+| Une requête tient le modèle ou l'attend | 409 | Erreur `model_busy` ; rien n'est déchargé |
386+| Ce n'est pas un nom de modèle | 404 | Erreur `model_not_found` |
387+| Le chemin ne finit pas par `/unload` | 404 | Erreur `unknown_url` |
388+
389+### POST /rzb/config/reload
390+
391+```bash
392+curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
393+```
394+
395+Relit le fichier passé à `--config` et l'applique ; ce qui change tout de suite et ce qui demande un redémarrage est listé dans la [référence de la configuration](configuration.md#rechargement). Envoyer `SIGHUP` au serveur fait la même chose, avec le résultat écrit dans son journal.
396+
397+| Champ de la réponse | Type | Valeur |
398+| --- | --- | --- |
399+| `file` | chaîne | Le fichier lu |
400+| `declared_models` | entier | Les modèles qu'il déclare |
401+| `unloaded` | tableau de chaînes | Les modèles chargés vers lesquels plus aucun `id` déclaré ne pointe, déchargés tout de suite |
402+| `unload_when_idle` | tableau de chaînes | Ceux de ces modèles encore utilisés, déchargés à la fin de leur dernière requête |
403+| `restart_required` | tableau de chaînes | Les clés `server` modifiées dans le fichier qui ne s'appliquent qu'après un redémarrage : `host`, `port`, `api_key_env`, `cors_origin`. Une clé fixée par une option de la ligne de commande n'est jamais listée |
404+
405+| Cas | Statut | Corps |
406+| --- | --- | --- |
407+| Le fichier est valide | 200 | Les champs ci-dessus |
408+| Le fichier est invalide ou illisible | 400 | Erreur `invalid_config` qui liste les problèmes ; la configuration en vigueur reste |
409+| Le serveur a été démarré sans `--config` | 409 | Erreur `no_config_file` |
@@ -27,6 +27,7 @@ Les exemples utilisent `mlx-community/Qwen3-4B-4bit` comme modèle de chat et `B
27 | `POST /v1/chat/completions` | Réponse de chat, entière ou en flux, avec sortie structurée, outils et raisonnement |27 | `POST /v1/chat/completions` | Réponse de chat, entière ou en flux, avec sortie structurée, outils et raisonnement |
28 | `POST /v1/completions` | Complétion de texte historique : le prompt est continué tel quel |28 | `POST /v1/completions` | Complétion de texte historique : le prompt est continué tel quel |
29 | `POST /v1/embeddings` | Vecteurs d'embedding |29 | `POST /v1/embeddings` | Vecteurs d'embedding |
30+| `GET /rzb/status`, `POST /rzb/…` | Les routes d'administration propres à razorbill, depuis cette machine seulement : voir [routes d'administration locales](#routes-dadministration-locales-rzb) |
30 31
31 Tout autre chemin répond 404 avec le code `unknown_url`.32 Tout autre chemin répond 404 avec le code `unknown_url`.
32 33
@@ -298,3 +299,111 @@ curl -sN http://127.0.0.1:7920/v1/chat/completions \
298 -d '{"model": "mlx-community/Qwen3-4B-4bit", "messages": [{"role": "user", "content": "Count to 5."}],299 -d '{"model": "mlx-community/Qwen3-4B-4bit", "messages": [{"role": "user", "content": "Count to 5."}],
299 "stream": true, "stream_options": {"include_usage": true}, "reasoning_effort": "none"}'300 "stream": true, "stream_options": {"include_usage": true}, "reasoning_effort": "none"}'
300 ```301 ```
302+
303+## Routes d'administration locales (/rzb)
304+
305+Les routes propres à razorbill, pour `rzb tui` et l'opérateur du serveur. Elles ne font pas partie de l'API d'OpenAI et les clients OpenAI ne les appellent jamais.
306+
307+| Règle | Valeur |
308+| --- | --- |
309+| Accès | Seulement les connexions venant de la machine qui fait tourner le serveur (loopback : `127.0.0.0/8`, `::1`, `::ffff:127.x`), même quand il écoute sur `0.0.0.0` ; tout autre client reçoit un 403 `local_only` |
310+| Authentification | Comme sur `/v1` : `Authorization: Bearer <clé>` quand le serveur a une clé d'API |
311+| Journal des requêtes | Journalisées comme toute requête, mais absentes de `recent_requests` |
312+
313+| Méthode et chemin | Rôle |
314+| --- | --- |
315+| `GET /rzb/status` | Ce que le processus du serveur détient en ce moment |
316+| `POST /rzb/models/{id}/unload` | Libérer un modèle tout de suite (`{id}` peut contenir `/`) |
317+| `POST /rzb/config/reload` | Relire le fichier de configuration |
318+
319+### GET /rzb/status
320+
321+```bash
322+curl -s http://127.0.0.1:7920/rzb/status
323+```
324+
325+| Champ | Type | Valeur |
326+| --- | --- | --- |
327+| `version` | chaîne | La version de razorbill |
328+| `uptime_seconds` | entier | Secondes écoulées depuis le démarrage du serveur |
329+| `host`, `port` | chaîne, entier | L'adresse configurée (`port` vaut `0` quand le serveur a choisi un port libre) |
330+| `models` | tableau | Les modèles chargés ou en cours de chargement, triés par `key` (tableau ci-dessous) ; `[]` s'il n'y en a aucun |
331+| `recent_requests` | tableau | Les 50 dernières requêtes traitées, la plus récente d'abord (tableau ci-dessous) |
332+| `memory` | objet ou `null` | La mémoire du moteur (tableau ci-dessous) ; `null` quand le moteur ne sait pas la mesurer (la version Linux) |
333+
334+| Champ d'un modèle | Type | Valeur |
335+| --- | --- | --- |
336+| `key` | chaîne | Le modèle chargé : `org/nom`, ou `org/nom#embedding` pour un chargement d'embedding |
337+| `name` | chaîne | Le nom donné par la requête qui l'a chargé (un `id` déclaré ou un id Hugging Face) |
338+| `kind` | chaîne | `chat` ou `embedding` |
339+| `state` | chaîne | `loading` tant que sa première requête le charge, puis `loaded` |
340+| `size_bytes` | entier | Octets de poids sur le disque ; `0` si inconnu |
341+| `busy` | booléen | Une requête le tient (elle le charge ou génère) |
342+| `queued` | entier | Requêtes qui l'attendent |
343+| `idle_seconds` | nombre | Secondes depuis la fin de sa dernière requête (au dixième) ; `0` tant que `busy` ou `queued` |
344+| `keep_alive_left_seconds` | nombre ou `null` | Secondes avant que [`keep_alive`](configuration.md#limits) le décharge ; `null` tant que `busy` ou `queued` |
345+
346+| Champ d'une requête | Type | Valeur |
347+| --- | --- | --- |
348+| `method`, `path`, `status` | chaîne, chaîne, entier | La requête et le statut de sa réponse |
349+| `model` | chaîne ou `null` | Le modèle qu'elle a utilisé |
350+| `prompt_tokens`, `completion_tokens` | entier ou `null` | Ses nombres de tokens, quand elle a généré |
351+| `cached_tokens` | entier | Tokens du prompt repris de la requête précédente |
352+| `duration_ms` | entier | Temps jusqu'à l'en-tête de la réponse (jusqu'au premier octet, pour un flux) |
353+| `finished_at` | entier | Secondes Unix |
354+
355+| Champ de `memory` | Type | Valeur |
356+| --- | --- | --- |
357+| `active_bytes` | entier | Tenu par les tableaux vivants : poids, caches KV, activations |
358+| `cache_bytes` | entier | Libéré par MLX mais gardé pour être réutilisé |
359+| `peak_bytes` | entier | Le plus haut `active_bytes` depuis le démarrage du processus |
360+| `limit_bytes` | entier | Ce que MLX peut allouer |
361+
362+Exemple, après une requête de chat :
363+
364+```json
365+{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0",
366+ "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564},
367+ "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit",
368+ "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}],
369+ "recent_requests": [{"cached_tokens": 0, "completion_tokens": 9, "duration_ms": 529, "finished_at": 1795728740,
370+ "method": "POST", "model": "qwen", "path": "/v1/chat/completions", "prompt_tokens": 14, "status": 200}]}
371+```
372+
373+### POST /rzb/models/{id}/unload
374+
375+```bash
376+curl -s -X POST http://127.0.0.1:7920/rzb/models/mlx-community/Qwen3-4B-4bit/unload
377+```
378+
379+`{id}` est un [nom de modèle](#noms-de-modèles). Un `id` déclaré libère le chargement de son propre type ; un id Hugging Face libère à la fois son chargement de chat et son chargement d'embedding. La requête suivante pour ce modèle le recharge.
380+
381+| Cas | Statut | Corps |
382+| --- | --- | --- |
383+| Le modèle était chargé et au repos | 200 | `{"model": "<id>", "status": "unloaded", "unloaded": ["<key>", …]}` |
384+| Le modèle n'était pas chargé | 200 | `{"model": "<id>", "status": "not_loaded", "unloaded": []}` |
385+| Une requête tient le modèle ou l'attend | 409 | Erreur `model_busy` ; rien n'est déchargé |
386+| Ce n'est pas un nom de modèle | 404 | Erreur `model_not_found` |
387+| Le chemin ne finit pas par `/unload` | 404 | Erreur `unknown_url` |
388+
389+### POST /rzb/config/reload
390+
391+```bash
392+curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
393+```
394+
395+Relit le fichier passé à `--config` et l'applique ; ce qui change tout de suite et ce qui demande un redémarrage est listé dans la [référence de la configuration](configuration.md#rechargement). Envoyer `SIGHUP` au serveur fait la même chose, avec le résultat écrit dans son journal.
396+
397+| Champ de la réponse | Type | Valeur |
398+| --- | --- | --- |
399+| `file` | chaîne | Le fichier lu |
400+| `declared_models` | entier | Les modèles qu'il déclare |
401+| `unloaded` | tableau de chaînes | Les modèles chargés vers lesquels plus aucun `id` déclaré ne pointe, déchargés tout de suite |
402+| `unload_when_idle` | tableau de chaînes | Ceux de ces modèles encore utilisés, déchargés à la fin de leur dernière requête |
403+| `restart_required` | tableau de chaînes | Les clés `server` modifiées dans le fichier qui ne s'appliquent qu'après un redémarrage : `host`, `port`, `api_key_env`, `cors_origin`. Une clé fixée par une option de la ligne de commande n'est jamais listée |
404+
405+| Cas | Statut | Corps |
406+| --- | --- | --- |
407+| Le fichier est valide | 200 | Les champs ci-dessus |
408+| Le fichier est invalide ou illisible | 400 | Erreur `invalid_config` qui liste les problèmes ; la configuration en vigueur reste |
409+| Le serveur a été démarré sans `--config` | 409 | Erreur `no_config_file` |
modified docs/fr/reference/configuration.md +13 -0
@@ -100,6 +100,19 @@ Une liste d'entrées. Les clients peuvent aussi utiliser tout identifiant Huggin
100100
101101 En plus de ces limites, les poids chargés en même temps ne peuvent pas dépasser 75 % de la mémoire du Mac : un modèle qui ne tient pas, même après déchargement des modèles inactifs, reçoit un 503.
102102
103+## Rechargement
104+
105+Un serveur en marche relit son fichier sur [`POST /rzb/config/reload`](api-http.md#post-rzbconfigreload) ou `SIGHUP`. Un fichier qui a des problèmes ne change rien.
106+
107+| Clé | Au rechargement |
108+| --- | --- |
109+| `models` | S'applique à la requête suivante. Un modèle chargé vers lequel plus aucun `id` déclaré ne pointe est déchargé tout de suite, ou à la fin de sa dernière requête ; un modèle nouvellement déclaré avec `preload` commence à se charger |
110+| `defaults`, `locked` | S'appliquent à la requête suivante, pour tous les modèles |
111+| `limits.max_queue` | S'applique à la prochaine requête qui doit attendre |
112+| `limits.max_loaded_models` | S'applique au prochain chargement ; les modèles chargés restent jusque-là |
113+| `limits.keep_alive` | S'applique dès le prochain passage de nettoyage des modèles inactifs |
114+| `server.host`, `server.port`, `server.api_key_env`, `server.cors_origin` | Ignorées jusqu'au redémarrage du serveur ; listées dans `restart_required` quand elles changent, sauf si l'option de ligne de commande correspondante est donnée |
115+
103116 ## Erreurs
104117
105118 Les problèmes sont affichés ensemble, puis `rzb` sort avec le code 2 :
@@ -100,6 +100,19 @@ Une liste d'entrées. Les clients peuvent aussi utiliser tout identifiant Huggin
100 100
101 En plus de ces limites, les poids chargés en même temps ne peuvent pas dépasser 75 % de la mémoire du Mac : un modèle qui ne tient pas, même après déchargement des modèles inactifs, reçoit un 503.101 En plus de ces limites, les poids chargés en même temps ne peuvent pas dépasser 75 % de la mémoire du Mac : un modèle qui ne tient pas, même après déchargement des modèles inactifs, reçoit un 503.
102 102
103+## Rechargement
104+
105+Un serveur en marche relit son fichier sur [`POST /rzb/config/reload`](api-http.md#post-rzbconfigreload) ou `SIGHUP`. Un fichier qui a des problèmes ne change rien.
106+
107+| Clé | Au rechargement |
108+| --- | --- |
109+| `models` | S'applique à la requête suivante. Un modèle chargé vers lequel plus aucun `id` déclaré ne pointe est déchargé tout de suite, ou à la fin de sa dernière requête ; un modèle nouvellement déclaré avec `preload` commence à se charger |
110+| `defaults`, `locked` | S'appliquent à la requête suivante, pour tous les modèles |
111+| `limits.max_queue` | S'applique à la prochaine requête qui doit attendre |
112+| `limits.max_loaded_models` | S'applique au prochain chargement ; les modèles chargés restent jusque-là |
113+| `limits.keep_alive` | S'applique dès le prochain passage de nettoyage des modèles inactifs |
114+| `server.host`, `server.port`, `server.api_key_env`, `server.cors_origin` | Ignorées jusqu'au redémarrage du serveur ; listées dans `restart_required` quand elles changent, sauf si l'option de ligne de commande correspondante est donnée |
115+
103 ## Erreurs116 ## Erreurs
104 117
105 Les problèmes sont affichés ensemble, puis `rzb` sort avec le code 2 :118 Les problèmes sont affichés ensemble, puis `rzb` sort avec le code 2 :
modified docs/fr/reference/erreurs.md +6 -0
@@ -23,7 +23,9 @@ Pendant un flux, une erreur survenue après le premier morceau est envoyée comm
2323 | --- | --- | --- |
2424 | 400 | `invalid_request_error` | JSON mal formé, mauvais type, valeur hors limites, champ refusé, contrainte non prise en charge, mauvais type de modèle, entrée trop longue |
2525 | 401 | `invalid_request_error` | Clé d'API absente ou fausse |
26+| 403 | `permission_error` | Une route `/rzb/` appelée depuis une autre machine |
2627 | 404 | `invalid_request_error` | Modèle inconnu ou URL inconnue |
28+| 409 | `invalid_request_error` | Une action `/rzb/` en conflit avec l'état du serveur : modèle en cours d'utilisation, pas de fichier de configuration |
2729 | 413 | `invalid_request_error` | Corps de plus de 16 Mio |
2830 | 429 | `rate_limit_error` | Trop de requêtes en attente pour un modèle |
2931 | 499 | — | Le client a fermé la connexion (seulement dans le journal ; le client est parti) |
@@ -42,6 +44,10 @@ Pendant un flux, une erreur survenue après le premier morceau est envoyée comm
4244 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Tous les modèles chargés répondent et `max_loaded_models` est atteint |
4345 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | Les poids dépassent ce qui peut être libéré dans les 75 % de la mémoire |
4446 | `model_load_failed` | 500 | `cannot load 'qwen3': …` | Échec du téléchargement ou du chargement |
47+| `local_only` | 403 | `/rzb/status only answers requests from the machine running the server.` | Une route `/rzb/` appelée depuis une autre adresse que le loopback |
48+| `model_busy` | 409 | `'qwen3' is in use (1 request(s) running, 2 waiting); retry once it is idle.` | `POST /rzb/models/{id}/unload` alors qu'une requête tient le modèle ou l'attend |
49+| `no_config_file` | 409 | `The server was started without --config: there is no file to reload.` | `POST /rzb/config/reload` sur un serveur démarré sans `--config` |
50+| `invalid_config` | 400 | `The configuration was not reloaded, the previous one stays in force. invalid configuration server.yaml …` | `POST /rzb/config/reload` avec un fichier invalide ou illisible ; le message liste ses problèmes comme `rzb config validate` |
4551
4652 ## Messages 400 courants
4753
@@ -23,7 +23,9 @@ Pendant un flux, une erreur survenue après le premier morceau est envoyée comm
23 | --- | --- | --- |23 | --- | --- | --- |
24 | 400 | `invalid_request_error` | JSON mal formé, mauvais type, valeur hors limites, champ refusé, contrainte non prise en charge, mauvais type de modèle, entrée trop longue |24 | 400 | `invalid_request_error` | JSON mal formé, mauvais type, valeur hors limites, champ refusé, contrainte non prise en charge, mauvais type de modèle, entrée trop longue |
25 | 401 | `invalid_request_error` | Clé d'API absente ou fausse |25 | 401 | `invalid_request_error` | Clé d'API absente ou fausse |
26+| 403 | `permission_error` | Une route `/rzb/` appelée depuis une autre machine |
26 | 404 | `invalid_request_error` | Modèle inconnu ou URL inconnue |27 | 404 | `invalid_request_error` | Modèle inconnu ou URL inconnue |
28+| 409 | `invalid_request_error` | Une action `/rzb/` en conflit avec l'état du serveur : modèle en cours d'utilisation, pas de fichier de configuration |
27 | 413 | `invalid_request_error` | Corps de plus de 16 Mio |29 | 413 | `invalid_request_error` | Corps de plus de 16 Mio |
28 | 429 | `rate_limit_error` | Trop de requêtes en attente pour un modèle |30 | 429 | `rate_limit_error` | Trop de requêtes en attente pour un modèle |
29 | 499 | — | Le client a fermé la connexion (seulement dans le journal ; le client est parti) |31 | 499 | — | Le client a fermé la connexion (seulement dans le journal ; le client est parti) |
@@ -42,6 +44,10 @@ Pendant un flux, une erreur survenue après le premier morceau est envoyée comm
42 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Tous les modèles chargés répondent et `max_loaded_models` est atteint |44 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Tous les modèles chargés répondent et `max_loaded_models` est atteint |
43 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | Les poids dépassent ce qui peut être libéré dans les 75 % de la mémoire |45 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | Les poids dépassent ce qui peut être libéré dans les 75 % de la mémoire |
44 | `model_load_failed` | 500 | `cannot load 'qwen3': …` | Échec du téléchargement ou du chargement |46 | `model_load_failed` | 500 | `cannot load 'qwen3': …` | Échec du téléchargement ou du chargement |
47+| `local_only` | 403 | `/rzb/status only answers requests from the machine running the server.` | Une route `/rzb/` appelée depuis une autre adresse que le loopback |
48+| `model_busy` | 409 | `'qwen3' is in use (1 request(s) running, 2 waiting); retry once it is idle.` | `POST /rzb/models/{id}/unload` alors qu'une requête tient le modèle ou l'attend |
49+| `no_config_file` | 409 | `The server was started without --config: there is no file to reload.` | `POST /rzb/config/reload` sur un serveur démarré sans `--config` |
50+| `invalid_config` | 400 | `The configuration was not reloaded, the previous one stays in force. invalid configuration server.yaml …` | `POST /rzb/config/reload` avec un fichier invalide ou illisible ; le message liste ses problèmes comme `rzb config validate` |
45 51
46 ## Messages 400 courants52 ## Messages 400 courants
47 53
modified docs/fr/reference/ligne-de-commande.md +1 -1
@@ -21,7 +21,7 @@ rzb help <commande>
2121 rzb serve [--config <fichier>] [--host <adresse>] [--port <n>] [--api-key-env <nom>] [--cors-origin <origine>]
2222 ```
2323
24-Démarre le serveur et tourne jusqu'à Ctrl-C ou SIGTERM ; il cesse alors d'accepter des requêtes, décharge les modèles et sort avec le code 0.
24+Démarre le serveur et tourne jusqu'à Ctrl-C ou SIGTERM ; il cesse alors d'accepter des requêtes, décharge les modèles et sort avec le code 0. `SIGHUP` relit le fichier passé à `--config` ([ce qui change](configuration.md#rechargement)) et écrit le résultat dans le journal ; sans `--config`, il n'y a rien à relire.
2525
2626 | Option | Type | Défaut | Description |
2727 | --- | --- | --- | --- |
@@ -21,7 +21,7 @@ rzb help <commande>
21 rzb serve [--config <fichier>] [--host <adresse>] [--port <n>] [--api-key-env <nom>] [--cors-origin <origine>]21 rzb serve [--config <fichier>] [--host <adresse>] [--port <n>] [--api-key-env <nom>] [--cors-origin <origine>]
22 ```22 ```
23 23
24-Démarre le serveur et tourne jusqu'à Ctrl-C ou SIGTERM ; il cesse alors d'accepter des requêtes, décharge les modèles et sort avec le code 0.24+Démarre le serveur et tourne jusqu'à Ctrl-C ou SIGTERM ; il cesse alors d'accepter des requêtes, décharge les modèles et sort avec le code 0. `SIGHUP` relit le fichier passé à `--config` ([ce qui change](configuration.md#rechargement)) et écrit le résultat dans le journal ; sans `--config`, il n'y a rien à relire.
25 25
26 | Option | Type | Défaut | Description |26 | Option | Type | Défaut | Description |
27 | --- | --- | --- | --- |27 | --- | --- | --- | --- |