resources/llm-management.ts
Source: sdks/typescript/packages/sdk/src/resources/llm-management.ts. Back to the TypeScript SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Type alias LlmBudgetPeriod
Budget period of an LLM project quota or of a LiteLLM key.
Definition: "daily" \| "weekly" \| "monthly" \| "total".
Interface LlmProjectQuota
Quota of an LLM project (mirrored into its LiteLLM team, daily and monthly limits also enforced by the gateway).
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
budget_amount | string | null | no | Budget per budget_period, decimal, at least 0, in budget_currency. |
budget_currency | string | no | ISO 4217 currency of the budget, three capital letters, default USD. |
budget_period | LlmBudgetPeriod | no | Budget period of an LLM project quota or of a LiteLLM key. |
token_limit | number | null | no | Maximum tokens per token_period, at least 0. Enforced by the Control Plane gateway through a FinOps quota when the project is linked and the period is daily or monthly. |
token_period | LlmBudgetPeriod | no | Period of the token limit: daily, weekly, monthly (default) or total. |
rpm_limit | number | null | no | Requests per minute allowed to the project. |
tpm_limit | number | null | no | Tokens per minute allowed to the project. |
max_parallel_requests | number | null | no | Maximum number of requests of the project running at the same time. |
alert_threshold_pct | number | no | Alert threshold as a share of the budget, in percent (1 to 100, default 80): sent in the LiteLLM team metadata and used as the soft budget of each new key (this share of its max_budget). |
hard_stop | boolean | no | When true (default), calls are refused once the budget is spent (LiteLLM maximum budget, hard FinOps quotas). When false, the budget only alerts. |
Interface LlmKeyCreate
Limits of a LiteLLM key: never wider than the project ones (422 llm_key_limit_exceeds_project).
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
name | string | no | Display name of the key. |
key_alias | string | no | Unique alias of the key in LiteLLM, 1 to 120 characters, letters, digits, dots, dashes and underscores, starting with a letter or digit. Generated from the tenant and project names when omitted. |
models | string[] | no | Models the key may call. |
max_budget | string | null | no | Budget limit of the key, as a decimal string; null for no own limit. |
budget_period | LlmBudgetPeriod | no | Budget period of an LLM project quota or of a LiteLLM key. |
rpm_limit | number | null | no | Requests per minute allowed to the key. |
tpm_limit | number | null | no | Tokens per minute allowed to the key. |
max_parallel_requests | number | null | no | Maximum number of requests of the key running at the same time. |
duration_days | number | null | no | Lifetime of the key in days, 1 to 3650; the key expires afterwards. Omit it for a key without expiry. |
Class LlmManagementResource
LLM projects, quotas and LiteLLM keys (/v1/llm/projects, roles tenant_admin or platform_admin). createKey returns the clear LiteLLM key once in key: the platform never stores it.
Resource
LlmManagementResource.blockKey
blockKey(projectId: string, keyId: string, opts?: CallOptions)
Block a project key. Blocks the key in LiteLLM: calls with it are refused until it is unblocked. The status becomes blocked. A revoked key answers 409 llm_key_revoked. Audited (llm_key.block). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys/{key_id}/block (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
keyId | string | yes | Identifier (UUID) of the key in the platform. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.createKey
createKey(projectId: string, body: LlmKeyCreate = {}, opts?: CallOptions)
Generate a project key. Generates a LiteLLM key for the project and answers 201 with the key record plus key (the clear key) and key_shown_once: true, with Cache-Control: no-store. The clear key is in this answer only: it is never stored nor audited. Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
body | LlmKeyCreate | {} | no | Name, alias, models and limits of the new key. Unknown fields are refused. |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.createProject
createProject(body: Doc, opts?: CallOptions)
Create an LLM project. Creates an LLM project in the caller's tenant and answers 201 with the project. Requires tenant_admin or platform_admin.
Route: /v1/llm/projects (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | The new LLM project. Unknown fields are refused. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.deleteProject
deleteProject(projectId: string, opts?: CallOptions)
Delete an LLM project. Deletes the project, its LiteLLM team and its FinOps quotas, and answers 204. Refused with 409 llm_project_has_keys while the project has keys that are not revoked. A LiteLLM error while deleting the team stops the deletion. Audited (llm_project.delete). Requires tenant_admin or platform_admin; unknown id: 404 llm_project_not_found.
Route: /v1/llm/projects/{project_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.getProject
getProject(projectId: string, opts?: CallOptions)
Get an LLM project. One LLM project with its effective models, quota, LiteLLM team, sync status and error, FinOps quotas and key count. Requires tenant_admin or platform_admin; unknown id: 404 llm_project_not_found.
Route: /v1/llm/projects/{project_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.listKeys
listKeys(projectId: string, query: { refresh?: boolean } = {}, opts?: CallOptions)
List the keys of a project. Keys of a project, newest first, with their alias, display prefix, models, limits, status, spend and expiry; never the clear key. With refresh, the spend of up to 50 keys that are not revoked is read again from LiteLLM and stored; usage_source is then litellm, or stored with litellm_error when LiteLLM did not answer. Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
query | { refresh?: boolean } | {} | no | Query string parameters of the route. |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.listProjects
listProjects(query: { status?: "active" | "suspended" | "archived" } = {}, opts?: CallOptions)
List the LLM projects. LLM projects of the tenant by name, each with its effective models (explicit ids plus the registry models of its categories), quota, LiteLLM team and sync state, FinOps quotas and number of keys that are not revoked. One page only (next_cursor is always null). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
query | { status?: "active" | "suspended" | "archived" } | {} | no | Query string parameters of the route. |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.revokeKey
revokeKey(projectId: string, keyId: string, opts?: CallOptions)
Revoke a project key. Revokes a key: it is deleted in LiteLLM and kept here with status revoked and its revocation time, for the history. A revoked key cannot be changed again (409 llm_key_revoked). Audited (llm_key.revoke). Requires tenant_admin or platform_admin; unknown key: 404 llm_key_not_found.
Route: /v1/llm/projects/{project_id}/keys/{key_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
keyId | string | yes | Identifier (UUID) of the key in the platform (not the LiteLLM token). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.setQuota
setQuota(projectId: string, body: LlmProjectQuota, opts?: CallOptions)
Set the quota of a project. Replaces the whole quota of the project (omitted fields take their default), rebuilds its FinOps quotas and pushes it to LiteLLM. With hard_stop false, LiteLLM gets no maximum budget (alert only) and the FinOps quotas are soft. An invalid quota answers 422 invalid_quota. Audited (llm_project.quota). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/quota (PUT).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
body | LlmProjectQuota | yes | The complete new quota of the project. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.status
status(opts?: CallOptions)
Check the LiteLLM admin connection. LiteLLM admin configuration without any secret value: whether it is configured, the admin address, whether the master key is present and where it is read from (setting, environment reference or OpenBao reference), the settings still missing, and a liveness probe (reachable) when it is configured. error_code is litellm_not_configured, litellm_unreachable or null. Requires tenant_admin or platform_admin.
Route: /v1/llm/management/status (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.syncProject
syncProject(projectId: string, opts?: CallOptions)
Push a project to LiteLLM again. Pushes the project to LiteLLM again (team created or updated) and answers the project with its new sync_status. Unlike the other changes, a failure is returned: 503 litellm_not_configured, 502 litellm_unreachable or 502 litellm_rejected. Audited (llm_project.sync). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/sync (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.unblockKey
unblockKey(projectId: string, keyId: string, opts?: CallOptions)
Unblock a project key. Unblocks the key in LiteLLM; the status becomes active again. A revoked key answers 409 llm_key_revoked. Audited (llm_key.unblock). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys/{key_id}/unblock (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
keyId | string | yes | Identifier (UUID) of the key in the platform. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.updateKey
updateKey(projectId: string, keyId: string, body: Omit<LlmKeyCreate, "key_alias" | "duration_days">, opts?: CallOptions)
Update a project key. Changes the name, models and limits of a key, first in LiteLLM then here. The merged limits are checked against the project: a wider limit answers 422 llm_key_limit_exceeds_project, a model the project does not allow 422 llm_key_model_not_allowed. A revoked key answers 409 llm_key_revoked. Audited (llm_key.update). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys/{key_id} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
keyId | string | yes | Identifier (UUID) of the key in the platform. | |
body | Omit<LlmKeyCreate, "key_alias" | "duration_days"> | yes | Fields to change; omitted fields keep their value, a limit sent as null removes it. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmManagementResource.updateProject
updateProject(projectId: string, body: Doc, opts?: CallOptions)
Update an LLM project. Changes the given fields of the project, rebuilds its FinOps quotas (removed when the project is no longer active or no longer linked) and pushes it to LiteLLM again; a LiteLLM failure does not fail the request but is shown in sync_status and sync_error. Another project with the new name answers 409 llm_project_exists; an unknown tenant project 404 tenant_project_not_found. Audited (llm_project.update). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
projectId | string | yes | Identifier (UUID) of the LLM project. | |
body | Doc | yes | Fields to change; omitted fields keep their value. The quota is changed with PUT .../quota. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).