Back to Litellm

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

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

1.101.0-dev.11.7 KB
Original Source

litellm_key (Data Source)

Retrieves information about an existing LiteLLM API key via /key/info. Pass either the raw key or its hashed token. The raw key value is never written to state beyond the input you provide; the data source ID is the hashed token.

Example Usage

terraform
data "litellm_key" "ci" {
  key = var.ci_key_hash
}

output "ci_key_team" {
  value = data.litellm_key.ci.team_id
}

Argument Reference

The following arguments are supported:

  • key - (Required, Sensitive) The API key (or its hash) to look up.

Attributes Reference

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

  • token_id - Hashed token identifier of the key (safe to store in state).
  • key_name - Redacted display name of the key.
  • key_alias - User-friendly alias for the key.
  • models - List of models this key can access.
  • spend - Amount spent by this key.
  • max_budget - Maximum budget for this key.
  • user_id - User ID associated with this key.
  • team_id - Team ID associated with this key.
  • organization_id - Organization ID associated with this key.
  • tpm_limit - Tokens per minute limit.
  • rpm_limit - Requests per minute limit.
  • max_parallel_requests - Maximum parallel requests allowed.
  • budget_duration - Budget reset duration.
  • metadata - Map of string metadata values for the key.
  • tags - Tags attached to the key.
  • blocked - Whether the key is blocked.
  • expires - Expiry timestamp, if set.
  • created_at - Timestamp when the key was created.
  • updated_at - Timestamp when the key was last updated.

Security Note

The raw key value is only used to perform the lookup; it is never exported as an attribute or used as the data source ID.