The admin API described in OpenAPI 3.1: generated from a route table by docgen, served at /api/v1/openapi.json

adminapi.Routes lists every endpoint with its query parameters and Go values
of the bodies it reads and answers with; internal/docgen/openapi turns that
into docs/admin-api.openapi.json by reflection, the way encoding/json encodes
the types, with the fields' comments as descriptions. A test fails when an
endpoint is registered and not in the table, another when the committed
document is stale. The binary embeds it and serves it with the token.

Handlers that wrote map literals and decoded anonymous structs now use named
types, so the document can see them. GET /api/v1/models/{name} answers with a
model's whole definition as it is in force, which a tool managing it needs.
docs/admin-api.md: reaching the API, the token, what a request must carry.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 23:47:59 +02:00
1 parent 30f7f3474a
commit a95c519bc5
17 files changed
+7643 -62

No files matched your search

+2 -1
View File
@@ -252,7 +252,8 @@ knowing before you edit it:
`LLMGW_ADMIN_TOKEN` gives it from elsewhere. pprof, whose heap holds the API
keys requests presented, is off unless `debug_pprof: true`, and then behind
the token too. To see the dashboard from elsewhere use `/admin` on the
client port — do not move this listener.
client port — do not move this listener. The API itself is described in
[admin-api.md](admin-api.md).
- `default_rpm`, `default_tpm` and `default_price` are what make limits and
budgets mean anything. Without a price every request costs zero and a budget
never binds; without the defaults, a project created without limits is