Skip to main content

llm_management.go (package eai)

Source: sdks/go/llm_management.go. Back to the Go 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.

Class LLMManagementService​

LLMManagementService groups the endpoints of: LLM projects, their quota and the LiteLLM keys of each project (/v1/llm/projects, roles tenant_admin or platform_admin). CreateKey returns the clear LiteLLM key once in "key": the platform never stores it.

LLMManagementService.BlockKey​

BlockKey(ctx context.Context, projectID string, keyID string, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
keyIDstringyesIdentifier (UUID) of the key in the platform.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Block a project key". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.CreateKey​

CreateKey(ctx context.Context, projectID string, body any, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
bodyanyyesName, alias, models and limits of the new key. Unknown fields are refused.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Generate a project key". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.CreateProject​

CreateProject(ctx context.Context, body any, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
bodyanyyesThe new LLM project. Unknown fields are refused.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Create an LLM project". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.DeleteProject​

DeleteProject(ctx context.Context, projectID string, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Delete an LLM project". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.GetProject​

GetProject(ctx context.Context, projectID string, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Get an LLM project". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.ListKeys​

ListKeys(ctx context.Context, projectID string, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "List the keys of a project". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.ListProjects​

ListProjects(ctx context.Context, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "List the LLM projects". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.RevokeKey​

RevokeKey(ctx context.Context, projectID string, keyID string, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
keyIDstringyesIdentifier (UUID) of the key in the platform (not the LiteLLM token).
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Revoke a project key". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.SetQuota​

SetQuota(ctx context.Context, projectID string, body any, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
bodyanyyesThe complete new quota of the project.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Set the quota of a project". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.Status​

Status(ctx context.Context, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Check the LiteLLM admin connection". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.SyncProject​

SyncProject(ctx context.Context, projectID string, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Push a project to LiteLLM again". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.UnblockKey​

UnblockKey(ctx context.Context, projectID string, keyID string, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
keyIDstringyesIdentifier (UUID) of the key in the platform.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Unblock a project key". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.UpdateKey​

UpdateKey(ctx context.Context, projectID string, keyID string, body any, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
keyIDstringyesIdentifier (UUID) of the key in the platform.
bodyanyyesFields to change; omitted fields keep their value, a limit sent as null removes it.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Update a project key". The error is a typed error of the SDK, nil on success.

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

LLMManagementService.UpdateProject​

UpdateProject(ctx context.Context, projectID string, body any, opts ...CallOption) (json.RawMessage, error)

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
ctxcontext.ContextyesContext of the call: cancellation and deadline.
projectIDstringyesIdentifier (UUID) of the LLM project.
bodyanyyesFields to change; omitted fields keep their value. The quota is changed with PUT .../quota.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Update an LLM project". The error is a typed error of the SDK, nil on success.

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