Back to Litellm

generated by https://github.com/hashicorp/terraform-plugin-docs

terraform/provider/docs/data-sources/keys.md

1.101.0-dev.11.9 KB
Original Source

litellm_keys (Data Source)

Lists LiteLLM API keys via /key/list. Supports server-side filtering and pagination. Raw key values are never returned; each entry is identified by its hashed token.

Example Usage

terraform
data "litellm_keys" "team_keys" {
  team_id = litellm_team.ml.id
  size    = 50
}

output "team_key_aliases" {
  value = [for k in data.litellm_keys.team_keys.keys : k.key_alias]
}

Argument Reference

The following arguments are supported:

  • page - (Optional) Page number for pagination. Defaults to 1.
  • size - (Optional) Number of keys per page. Defaults to 100.
  • user_id - (Optional) Filter keys by user ID.
  • team_id - (Optional) Filter keys by team ID.
  • organization_id - (Optional) Filter keys by organization ID.
  • key_alias - (Optional) Filter keys by key alias.
  • include_team_keys - (Optional) Include all keys for teams the caller is an admin of.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • total_count - Total number of keys matching the filters.
  • total_pages - Total number of pages.
  • current_page - The page returned.
  • ids - Hashed token identifiers of the returned keys.
  • keys - List of key objects. Each entry exports:
    • token_id - Hashed token identifier.
    • key_name - Redacted display name.
    • key_alias - User-friendly alias.
    • spend - Amount spent by the key.
    • max_budget - Maximum budget.
    • models - Models the key can access.
    • user_id - Associated user ID.
    • team_id - Associated team ID.
    • organization_id - Associated organization ID.
    • tpm_limit - Tokens per minute limit.
    • rpm_limit - Requests per minute limit.
    • budget_duration - Budget reset duration.
    • blocked - Whether the key is blocked.
    • expires - Expiry timestamp, if set.
    • created_at - Creation timestamp.
    • updated_at - Last update timestamp.