diff --git a/docs/subsystems/gateway-routing.md b/docs/subsystems/gateway-routing.md index d927f6a5b..545b36156 100644 --- a/docs/subsystems/gateway-routing.md +++ b/docs/subsystems/gateway-routing.md @@ -615,6 +615,89 @@ when nothing else makes videos. Covered by `TestMiniMaxKeysMakeH3Videos`, `TestMiniMaxComesAfterOtherVideomakers` and `TestMiniMaxVideoMovesPastATokenPlanKey`. +## Short-lived gateway keys + +A gateway key may expire (`access.Key.Expires`), and one issued under another +key keeps that key's id (`Key.Issuer`). They are for an orchestrator that +gives each sandboxed agent a key of its own that stops working by itself +(xazaj on X, moving off an enterprise LLM gateway). `access.IssueKey` in +[`issue.go`](../../internal/access/issue.go) makes one, living 1 minute to +30 days (`MinTTL`, `MaxTTL`); `--tokens`/`--cost` cap it over its whole life, +as one `hours` limit as long as its life from the moment it is issued. + +Where it is issued: + +- `POST /v1/magpie/keys` with `{"ttl": "1h" | 3600, "name", "models", + "accounts", "tokens", "cost", "readOnly"}` answers 201 with the key's + `id`, `name`, `key` (the secret, told once, `Cache-Control: no-store`), + `expires` and what it is held to. `GET /v1/magpie/keys` lists the keys + the caller issued, masked; `DELETE /v1/magpie/keys/{id}` revokes one. + See [`issue_keys.go`](../../internal/gateway/issue_keys.go). +- `magpie gateway-key issue --ttl 1h [--name n] [--models a,b] [--accounts + a,b] [--tokens N] [--cost USD] [--read-only] [--from ] [--json]` + prints the secret alone; `gateway-key issuer on|off` lets a key + issue; `gateway-key list` shows `until