You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+74-1Lines changed: 74 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# LiteLLM Terraform Provider
2
2
3
-
This Terraform provider allows you to manage LiteLLM resources through Infrastructure as Code. It provides support for managing models, teams, and team members via the LiteLLM REST API.
3
+
This Terraform provider allows you to manage LiteLLM resources through Infrastructure as Code. It provides support for managing models, teams, team members, and API keys via the LiteLLM REST API.
4
4
5
5
## Features
6
6
@@ -10,6 +10,7 @@ This Terraform provider allows you to manage LiteLLM resources through Infrastru
10
10
- Set usage limits and budgets
11
11
- Control access to specific models
12
12
- Specify model modes (e.g., completion, embeddings, image generation)
*`models` - (Optional) List of models that can be used with this key. This restricts the key to only use the specified models.
53
+
54
+
*`max_budget` - (Optional) Maximum budget for this key. This sets an upper limit on the total spend allowed for this key.
55
+
56
+
*`user_id` - (Optional) User ID associated with this key. This links the key to a specific user in the LiteLLM system.
57
+
58
+
*`team_id` - (Optional) Team ID associated with this key. This links the key to a specific team in the LiteLLM system.
59
+
60
+
*`max_parallel_requests` - (Optional) Maximum number of parallel requests allowed for this key. This helps in controlling concurrent usage.
61
+
62
+
*`metadata` - (Optional) Metadata associated with this key. This can be used to store additional, custom information about the key.
63
+
64
+
*`tpm_limit` - (Optional) Tokens per minute limit for this key. This sets a rate limit based on the number of tokens processed.
65
+
66
+
*`rpm_limit` - (Optional) Requests per minute limit for this key. This sets a rate limit based on the number of API calls.
67
+
68
+
*`budget_duration` - (Optional) Duration for the budget (e.g., "monthly", "weekly"). This defines the time period for which the `max_budget` applies.
69
+
70
+
*`allowed_cache_controls` - (Optional) List of allowed cache control directives. This can be used to control caching behavior for requests made with this key.
71
+
72
+
*`soft_budget` - (Optional) Soft budget limit for this key. This can be used to set a warning threshold before reaching the `max_budget`.
73
+
74
+
*`key_alias` - (Optional) Alias for this key. This provides a human-readable identifier for the key.
75
+
76
+
*`duration` - (Optional) Duration for which this key is valid. This sets an expiration time for the key.
77
+
78
+
*`aliases` - (Optional) Map of model aliases. This allows you to create custom names for models when using this key.
79
+
80
+
*`config` - (Optional) Configuration options for this key. This can be used to set key-specific settings.
81
+
82
+
*`permissions` - (Optional) Permissions associated with this key. This defines what actions are allowed with this key.
83
+
84
+
*`model_max_budget` - (Optional) Maximum budget per model. This allows setting different budget limits for each model.
85
+
86
+
*`model_rpm_limit` - (Optional) Requests per minute limit per model. This allows setting different RPM limits for each model.
87
+
88
+
*`model_tpm_limit` - (Optional) Tokens per minute limit per model. This allows setting different TPM limits for each model.
89
+
90
+
*`guardrails` - (Optional) List of guardrails applied to this key. This can be used to enforce certain safety or quality checks.
91
+
92
+
*`blocked` - (Optional) Whether this key is blocked. If set to true, the key will be unable to make any requests.
93
+
94
+
*`tags` - (Optional) List of tags associated with this key. This can be used for organization and filtering of keys.
95
+
96
+
## Attribute Reference
97
+
98
+
In addition to all arguments above, the following attributes are exported:
99
+
100
+
*`key` - The generated API key. This is the actual key value that will be used for authentication.
101
+
102
+
*`spend` - The current spend for this key. This reflects the total amount spent using this key so far.
103
+
104
+
## State Management
105
+
106
+
Recent updates have improved how the Key resource manages its state. The provider now ensures that all non-zero and non-empty values are correctly persisted in the Terraform state file. This means that any value you set will be accurately reflected in your state, preventing unnecessary updates and ensuring consistency between your configuration and the actual resource state.
107
+
108
+
## Import
109
+
110
+
LiteLLM keys can be imported using the `id`, e.g.,
111
+
112
+
```
113
+
$ terraform import litellm_key.example 12345
114
+
```
115
+
116
+
This allows you to import existing keys into your Terraform state, enabling management of keys that were created outside of Terraform.
0 commit comments