Skip to main content

resources/llm-management.ts

Source: sdks/typescript/packages/sdk/src/resources/llm-management.ts. Back to the TypeScript SDK reference index.

note

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:

NameTypeRequiredDescription
budget_amountstring | nullnoBudget per budget_period, decimal, at least 0, in budget_currency.
budget_currencystringnoISO 4217 currency of the budget, three capital letters, default USD.
budget_periodLlmBudgetPeriodnoBudget period of an LLM project quota or of a LiteLLM key.
token_limitnumber | nullnoMaximum 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_periodLlmBudgetPeriodnoPeriod of the token limit: daily, weekly, monthly (default) or total.
rpm_limitnumber | nullnoRequests per minute allowed to the project.
tpm_limitnumber | nullnoTokens per minute allowed to the project.
max_parallel_requestsnumber | nullnoMaximum number of requests of the project running at the same time.
alert_threshold_pctnumbernoAlert 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_stopbooleannoWhen 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:

NameTypeRequiredDescription
namestringnoDisplay name of the key.
key_aliasstringnoUnique 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.
modelsstring[]noModels the key may call.
max_budgetstring | nullnoBudget limit of the key, as a decimal string; null for no own limit.
budget_periodLlmBudgetPeriodnoBudget period of an LLM project quota or of a LiteLLM key.
rpm_limitnumber | nullnoRequests per minute allowed to the key.
tpm_limitnumber | nullnoTokens per minute allowed to the key.
max_parallel_requestsnumber | nullnoMaximum number of requests of the key running at the same time.
duration_daysnumber | nullnoLifetime 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
keyIdstringyesIdentifier (UUID) of the key in the platform.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
bodyLlmKeyCreate{}noName, alias, models and limits of the new key. Unknown fields are refused.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
bodyDocyesThe new LLM project. Unknown fields are refused.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
query{ refresh?: boolean }{}noQuery string parameters of the route.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
query{ status?: "active" | "suspended" | "archived" }{}noQuery string parameters of the route.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
keyIdstringyesIdentifier (UUID) of the key in the platform (not the LiteLLM token).
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
bodyLlmProjectQuotayesThe complete new quota of the project.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
keyIdstringyesIdentifier (UUID) of the key in the platform.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
keyIdstringyesIdentifier (UUID) of the key in the platform.
bodyOmit<LlmKeyCreate, "key_alias" | "duration_days">yesFields to change; omitted fields keep their value, a limit sent as null removes it.
optsCallOptionsnoPer 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).

NameTypeDefaultRequiredDescription
projectIdstringyesIdentifier (UUID) of the LLM project.
bodyDocyesFields to change; omitted fields keep their value. The quota is changed with PUT .../quota.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).