Organizations, teams, projects, keys and memberships in the admin API

What llmgw org, keys and users did against the store on a control plane
can now be done remotely and by automation: the tree read, added to,
renamed, moved and emptied; keys issued (the key in the answer, once),
listed and revoked, with the scopes' lifetime limits; people put in and
taken out of the tree, their keys in projects they no longer reach
revoked with it.

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-08 22:42:43 +02:00
1 parent 9c675e7293
commit 90e0942481
9 files changed
+2015 -10

No files matched your search

+49
View File
@@ -67,6 +67,11 @@ var PathParams = map[string]string{
"federation/{peer}": "The federation peer's name, as `llmgw ctl federation list` lists it.",
"holds/{domain}": "The domain as level:name, rack:r12-07, as `llmgw ctl facility` lists it.",
"collections/{id}": "The collection's ID, its name when that is unique, or ORG/NAME.",
"orgs/{id}": "The organization's ID or name.",
"teams/{id}": "The team's ID.",
"projects/{id}": "The project's ID.",
"keys/{id}": "The key's ID, as listed (not the key itself).",
"users/{id}": "The person's ID or email.",
"artifacts/{kind}": "What the job made: peft, a gzipped tar of the PEFT adapter, or gguf, the adapter for llama.cpp.",
}
@@ -297,6 +302,50 @@ var Routes = []Route{
Request: KBSearchRequest{}, Response: []KBHitView{}},
// LoRA adapters trained on the nodes.
// Organizations, teams, projects, keys and people.
{Method: "GET", Path: "/api/v1/orgs", Summary: "The tenancy tree: every organization, its teams and their projects",
Response: []OrgView{}},
{Method: "POST", Path: "/api/v1/orgs", Summary: "Add an organization",
Request: TenancyCreateRequest{}, Response: TenancyItem{}, Status: http.StatusCreated},
{Method: "PATCH", Path: "/api/v1/orgs/{id}", Summary: "Rename an organization",
Request: TenancyChangeRequest{}, Response: TenancyItem{}},
{Method: "DELETE", Path: "/api/v1/orgs/{id}", Summary: "Remove an organization that has no teams",
Response: map[string]any{}},
{Method: "POST", Path: "/api/v1/teams", Summary: "Add a team to an organization",
Request: TenancyCreateRequest{}, Response: TenancyItem{}, Status: http.StatusCreated},
{Method: "PATCH", Path: "/api/v1/teams/{id}", Summary: "Rename a team, or move it to another organization",
Description: "Everything under it moves too, and from then on inherits the new organization's limits.",
Request: TenancyChangeRequest{}, Response: TenancyItem{}},
{Method: "DELETE", Path: "/api/v1/teams/{id}", Summary: "Remove a team that has no projects",
Response: map[string]any{}},
{Method: "POST", Path: "/api/v1/projects", Summary: "Add a project to a team",
Request: TenancyCreateRequest{}, Response: TenancyItem{}, Status: http.StatusCreated},
{Method: "PATCH", Path: "/api/v1/projects/{id}", Summary: "Rename a project, or move it to another team",
Request: TenancyChangeRequest{}, Response: TenancyItem{}},
{Method: "DELETE", Path: "/api/v1/projects/{id}", Summary: "Remove a project with no people, keys or collections",
Description: "A project that ever had a key keeps it, revoked, because usage refers to it; rename such a project instead.",
Response: map[string]any{}},
{Method: "GET", Path: "/api/v1/keys", Summary: "API keys, with their project and owner; never the keys themselves",
Query: []Param{{Name: "project", Description: "Only this project's keys: ORG/TEAM/PROJECT or its ID."}},
Response: []KeyView{}},
{Method: "POST", Path: "/api/v1/keys", Summary: "Issue an API key",
Description: "The answer holds the key, once: only its hash is kept. A lifetime longer than a scope above it allows is refused.",
Request: KeyCreateRequest{}, Response: KeyCreated{}, Status: http.StatusCreated},
{Method: "GET", Path: "/api/v1/keys/{id}", Summary: "One API key", Response: KeyView{}},
{Method: "DELETE", Path: "/api/v1/keys/{id}", Summary: "Revoke an API key",
Description: "A soft delete: usage refers to it. A gateway that has it cached accepts it until auth.cache_ttl.",
Response: map[string]any{}},
{Method: "GET", Path: "/api/v1/users", Summary: "People, with where each is a member",
Query: []Param{{Name: "state", Description: "Only people in this state: pending, active or disabled."}},
Response: []UserView{}},
{Method: "GET", Path: "/api/v1/users/{id}", Summary: "One person, with where they are a member", Response: UserView{}},
{Method: "POST", Path: "/api/v1/users/{id}/memberships", Summary: "Put a person in an organization, team or project",
Description: "Already there, only the role changes.",
Request: MembershipRequest{}, Response: UserView{}},
{Method: "DELETE", Path: "/api/v1/users/{id}/memberships", Summary: "Take a person out of an organization, team or project",
Description: "Their keys in projects they no longer reach are revoked.",
Request: MembershipRequest{}, Response: UserView{}},
{Method: "POST", Path: "/api/v1/train/jobs", Summary: "Queue a LoRA adapter's training on a node",
Description: "The node trains when its agent is there, nothing else trains on it, and a card has gpu_memory_mib free; " +
"the pairs are NDJSON of {\"q\", \"a\"}. An adapter learns how answers sound far better than what they say.",