mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-12-24 10:04:26 +00:00
Add inference api key frontend integration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { CreateInstanceOptions, Instance } from "@/types/instance";
|
||||
import type { AppConfig } from "@/types/config";
|
||||
import type { ApiKey, CreateKeyRequest, CreateKeyResponse, KeyPermissionResponse } from "@/types/apiKey";
|
||||
import { handleApiError } from "./errorUtils";
|
||||
|
||||
// Adding baseURI as a prefix to support being served behind a subpath
|
||||
@@ -178,3 +179,29 @@ export const instancesApi = {
|
||||
// GET /instances/{name}/proxy/health
|
||||
getHealth: (name: string) => apiCall<Record<string, unknown>>(`/instances/${encodeURIComponent(name)}/proxy/health`),
|
||||
};
|
||||
|
||||
// API Keys API functions
|
||||
export const apiKeysApi = {
|
||||
// GET /auth/keys
|
||||
list: () => apiCall<ApiKey[]>("/auth/keys"),
|
||||
|
||||
// GET /auth/keys/{id}
|
||||
get: (id: number) => apiCall<ApiKey>(`/auth/keys/${id}`),
|
||||
|
||||
// POST /auth/keys
|
||||
create: (request: CreateKeyRequest) =>
|
||||
apiCall<CreateKeyResponse>("/auth/keys", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(request),
|
||||
}),
|
||||
|
||||
// DELETE /auth/keys/{id}
|
||||
delete: (id: number) =>
|
||||
apiCall<void>(`/auth/keys/${id}`, {
|
||||
method: "DELETE",
|
||||
}),
|
||||
|
||||
// GET /auth/keys/{id}/permissions
|
||||
getPermissions: (id: number) =>
|
||||
apiCall<KeyPermissionResponse[]>(`/auth/keys/${id}/permissions`),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user