feat: let all users list AI providers (#32650)
Closes AIGOV-824
`GET /api/v2/ai/providers` now answers every signed-in user. Before, it
returned a 403 to anyone who isn't an owner.
Owners get exactly what they did before. Everyone else gets the same
list without each provider's configuration, i.e. `base_url`, `api_keys`,
`settings` and `status` come back empty:
```json
[
{
"id": "90f4a82a-c945-4598-93be-be9dde57c38d",
"type": "openai",
"name": "corp-openai",
"display_name": "Corp OpenAI",
"icon": "/icon/openai.svg",
"enabled": true,
"base_url": "",
"api_keys": [],
"settings": null,
"created_at": "2026-11-24T11:56:44.789072Z",
"updated_at": "2026-11-24T11:56:44.789072Z"
}
]
```
Clients need the list to find out what a provider is called. They reach
a provider through AI Gateway at `/api/v2/ai-gateway/<provider-name>/`,
and the name is whatever an admin chose. Mux, for example, lists
providers with `GET /api/v2/ai/providers`, so a member's Mux only finds
providers that happen to have a default name.
To do this, I've split the permission in two. `ai_provider:read` now
only covers the fields that are filled in above, and every member holds
it, the same way they can read OAuth2 apps and workspace proxies. A
provider's base URL, keys and settings sit behind a new
`ai_provider:read_secret` permission, which only owners hold. `GET
/api/v2/ai/providers/{idOrName}` and the dashboard's AI settings pages
now check `ai_provider:read_secret`, so they're still owner only.
This doesn't show members much that's new. They can already read the
name, type, display name, icon and enabled state of every enabled
provider from `GET /api/v2/users/{user}/ai-provider-keys`, so the
additions are disabled providers and the two timestamps.
The next PR in the stack removes `GET /api/v2/ai-gateway/providers`,
which `GET /api/v2/ai/providers` replaces.
This commit is contained in:
1 parent
056043b306
commit
fd74a160ec
41 files changed
+301
-92
No files matched your search
Generated
+2
-1
@@ -312,7 +312,8 @@ CREATE TYPE api_key_scope AS ENUM (
|
||||
'workspace_secret:create',
|
||||
'workspace_secret:read',
|
||||
'workspace_secret:read_secret',
|
||||
'workspace_secret:update'
|
||||
'workspace_secret:update',
|
||||
'ai_provider:read_secret'
|
||||
);
|
||||
|
||||
CREATE TYPE app_sharing_level AS ENUM (
|
||||
|
||||
Reference in new issue
Block a user