mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: hide AI Gateway key management UI/CLI/API (#26879)
Hides UI, CLI and API related to AI Gateway key management + `/api/v2/ai-gateway/serve` endpoint. API endpoints and CLI commands are still working they are just not visible.
This commit is contained in:
Generated
+16
-4
@@ -1434,7 +1434,10 @@ const docTemplate = `{
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
@@ -1471,7 +1474,10 @@ const docTemplate = `{
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/ai-gateway/keys/{key}": {
|
||||
@@ -1500,7 +1506,10 @@ const docTemplate = `{
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/ai-gateway/models": {
|
||||
@@ -1548,7 +1557,10 @@ const docTemplate = `{
|
||||
{
|
||||
"AIGatewayKey": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/ai-gateway/sessions": {
|
||||
|
||||
Generated
+16
-4
@@ -1269,7 +1269,10 @@
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": ["application/json"],
|
||||
@@ -1300,7 +1303,10 @@
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/ai-gateway/keys/{key}": {
|
||||
@@ -1327,7 +1333,10 @@
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/ai-gateway/models": {
|
||||
@@ -1369,7 +1378,10 @@
|
||||
{
|
||||
"AIGatewayKey": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/ai-gateway/sessions": {
|
||||
|
||||
Generated
-146
@@ -178,152 +178,6 @@ curl -X GET http://coder-server:8080/api/v2/agent-firewall/sessions/{id}/logs \
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## List AI Gateway keys
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X GET http://coder-server:8080/api/v2/ai-gateway/keys \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`GET /api/v2/ai-gateway/keys`
|
||||
|
||||
### Example responses
|
||||
|
||||
> 200 Response
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
"key_prefix": "string",
|
||||
"last_heartbeat_at": "2019-08-24T14:15:22Z",
|
||||
"name": "string"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
|--------|---------------------------------------------------------|-------------|-------------------------------------------------------------------|
|
||||
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.AIGatewayKey](schemas.md#codersdkaigatewaykey) |
|
||||
|
||||
<h3 id="list-ai-gateway-keys-responseschema">Response Schema</h3>
|
||||
|
||||
Status Code **200**
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|-----------------------|-------------------|----------|--------------|-------------|
|
||||
| `[array item]` | array | false | | |
|
||||
| `» created_at` | string(date-time) | false | | |
|
||||
| `» id` | string(uuid) | false | | |
|
||||
| `» key_prefix` | string | false | | |
|
||||
| `» last_heartbeat_at` | string(date-time) | false | | |
|
||||
| `» name` | string | false | | |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Create AI Gateway key
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X POST http://coder-server:8080/api/v2/ai-gateway/keys \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`POST /api/v2/ai-gateway/keys`
|
||||
|
||||
> Body parameter
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
|--------|------|------------------------------------------------------------------------------------|----------|-------------------------------|
|
||||
| `body` | body | [codersdk.CreateAIGatewayKeyRequest](schemas.md#codersdkcreateaigatewaykeyrequest) | true | Create AI Gateway key request |
|
||||
|
||||
### Example responses
|
||||
|
||||
> 201 Response
|
||||
|
||||
```json
|
||||
{
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
"key": "string",
|
||||
"key_prefix": "string",
|
||||
"name": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
|--------|--------------------------------------------------------------|-------------|--------------------------------------------------------------------------------------|
|
||||
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.CreateAIGatewayKeyResponse](schemas.md#codersdkcreateaigatewaykeyresponse) |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Delete AI Gateway key
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X DELETE http://coder-server:8080/api/v2/ai-gateway/keys/{key} \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`DELETE /api/v2/ai-gateway/keys/{key}`
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
|-------|------|--------------|----------|-------------|
|
||||
| `key` | path | string(uuid) | true | Key ID |
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
|--------|-----------------------------------------------------------------|-------------|--------|
|
||||
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## AI Gateway serve
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X GET http://coder-server:8080/api/v2/ai-gateway/serve \
|
||||
-H 'X-AI-Governance-Gateway-Key: API_KEY'
|
||||
```
|
||||
|
||||
`GET /api/v2/ai-gateway/serve`
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
|--------|--------------------------------------------------------------------------|---------------------|--------|
|
||||
| 101 | [Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) | Switching Protocols | |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Get appearance
|
||||
|
||||
### Code samples
|
||||
|
||||
Generated
-1
@@ -66,7 +66,6 @@ Coder — A tool for provisioning self-hosted development environments with Terr
|
||||
| [<code>support</code>](./support.md) | Commands for troubleshooting issues with a Coder deployment. |
|
||||
| [<code>server</code>](./server.md) | Start a Coder server |
|
||||
| [<code>provisioner</code>](./provisioner.md) | View and manage provisioner daemons and jobs |
|
||||
| [<code>ai-gateway</code>](./ai-gateway.md) | Manage AI Gateway |
|
||||
| [<code>agent-firewall</code>](./agent-firewall.md) | Network isolation tool for monitoring and restricting HTTP/HTTPS requests |
|
||||
| [<code>features</code>](./features.md) | List Enterprise features |
|
||||
| [<code>licenses</code>](./licenses.md) | Add, delete, and list licenses |
|
||||
|
||||
@@ -14,8 +14,9 @@ import (
|
||||
|
||||
func (r *RootCmd) aiGateway() *serpent.Command {
|
||||
return &serpent.Command{
|
||||
Use: "ai-gateway",
|
||||
Short: "Manage AI Gateway",
|
||||
Use: "ai-gateway",
|
||||
Short: "Manage AI Gateway",
|
||||
Hidden: true,
|
||||
Handler: func(inv *serpent.Invocation) error {
|
||||
return inv.Command.HelpHandler(inv)
|
||||
},
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ USAGE:
|
||||
SUBCOMMANDS:
|
||||
agent-firewall Network isolation tool for monitoring and restricting
|
||||
HTTP/HTTPS requests
|
||||
ai-gateway Manage AI Gateway
|
||||
external-workspaces Create or manage external workspaces
|
||||
features List Enterprise features
|
||||
groups Manage groups
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder ai-gateway
|
||||
|
||||
Manage AI Gateway
|
||||
|
||||
SUBCOMMANDS:
|
||||
keys Manage AI Gateway keys
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,14 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder ai-gateway keys
|
||||
|
||||
Manage AI Gateway keys
|
||||
|
||||
SUBCOMMANDS:
|
||||
create Create an AI Gateway key
|
||||
delete Delete an AI Gateway key
|
||||
list List AI Gateway keys
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,9 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder ai-gateway keys create <name>
|
||||
|
||||
Create an AI Gateway key
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,15 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder ai-gateway keys delete [flags] <name|id>
|
||||
|
||||
Delete an AI Gateway key
|
||||
|
||||
Aliases: rm
|
||||
|
||||
OPTIONS:
|
||||
-y, --yes bool
|
||||
Bypass confirmation prompts.
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,18 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder ai-gateway keys list [flags]
|
||||
|
||||
List AI Gateway keys
|
||||
|
||||
Aliases: ls
|
||||
|
||||
OPTIONS:
|
||||
-c, --column [id|name|key prefix|created at|last heartbeat at] (default: id,name,key prefix,last heartbeat at,created at)
|
||||
Columns to display in table output.
|
||||
|
||||
-o, --output table|json (default: table)
|
||||
Output format.
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -42,6 +42,7 @@ const aiGatewayKeyHeartbeatInterval = 60 * time.Second
|
||||
// @Tags Enterprise
|
||||
// @Success 101
|
||||
// @Router /api/v2/ai-gateway/serve [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) aiGatewayServe(rw http.ResponseWriter, r *http.Request) {
|
||||
key := r.Header.Get(codersdk.AIGatewayKeyHeader)
|
||||
if key == "" {
|
||||
|
||||
@@ -29,6 +29,7 @@ const nameFormatDetail = "Must be 64 characters or fewer, lowercase letters, num
|
||||
// @Param request body codersdk.CreateAIGatewayKeyRequest true "Create AI Gateway key request"
|
||||
// @Success 201 {object} codersdk.CreateAIGatewayKeyResponse
|
||||
// @Router /api/v2/ai-gateway/keys [post]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) postAIGatewayKey(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -117,6 +118,7 @@ func writeKeyInsertError(ctx context.Context, rw http.ResponseWriter, err error)
|
||||
// @Tags Enterprise
|
||||
// @Success 200 {array} codersdk.AIGatewayKey
|
||||
// @Router /api/v2/ai-gateway/keys [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) aiGatewayKeys(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -147,6 +149,7 @@ func (api *API) aiGatewayKeys(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param key path string true "Key ID" format(uuid)
|
||||
// @Success 204
|
||||
// @Router /api/v2/ai-gateway/keys/{key} [delete]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) deleteAIGatewayKey(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
@@ -42,11 +42,6 @@ const AISettingsSidebarView: FC<AISettingsSidebarViewProps> = ({
|
||||
AI Governance
|
||||
</SidebarNavItem>
|
||||
)}
|
||||
{permissions.viewAIGatewayKeys && (
|
||||
<SidebarNavItem href="/ai/settings/gateway-keys">
|
||||
AI Gateway keys
|
||||
</SidebarNavItem>
|
||||
)}
|
||||
{permissions.viewAnyAIProvider && (
|
||||
<SidebarNavItem href="/ai/settings/providers">
|
||||
Providers
|
||||
|
||||
+1
-9
@@ -437,7 +437,7 @@ const AISettingsAddProviderPage = lazy(
|
||||
"./pages/AISettingsPage/ProvidersPage/AddProviderPage/AddProviderPage"
|
||||
),
|
||||
);
|
||||
const AISettingsGatewayKeysPage = lazy(
|
||||
const _AISettingsGatewayKeysPage = lazy(
|
||||
() => import("./pages/AISettingsPage/GatewayKeysPage/GatewayKeysPage"),
|
||||
);
|
||||
const AISettingsModelsPage = lazy(
|
||||
@@ -479,10 +479,6 @@ const AISettingsIndexRedirect = () => {
|
||||
return <Navigate to="/ai/settings/providers" replace />;
|
||||
}
|
||||
|
||||
if (permissions.viewAIGatewayKeys) {
|
||||
return <Navigate to="/ai/settings/gateway-keys" replace />;
|
||||
}
|
||||
|
||||
if (permissions.editDeploymentConfig) {
|
||||
return <Navigate to="/ai/settings/models" replace />;
|
||||
}
|
||||
@@ -763,10 +759,6 @@ export const router = createBrowserRouter(
|
||||
<Route element={<DeploymentConfigProvider />}>
|
||||
<Route path="governance" element={<AIGovernanceSettingsPage />} />
|
||||
</Route>
|
||||
<Route
|
||||
path="gateway-keys"
|
||||
element={<AISettingsGatewayKeysPage />}
|
||||
/>
|
||||
<Route index element={<AISettingsIndexRedirect />} />
|
||||
<Route path="models" element={<AISettingsModelsPage />} />
|
||||
<Route path="spend" element={<AISettingsSpendPage />} />
|
||||
|
||||
Reference in New Issue
Block a user