mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
* feat(terraform): close key/team schema gaps, fix team read envelope, add import support * feat(terraform): add fallback resource/data source and key/team block resources * feat(terraform): add access group and unified access group resources and data sources * feat(terraform): add guardrail and prompt resources and data sources * feat(terraform): add agent and search tool resources and data sources * feat(terraform): add user and budget resources and data sources * feat(terraform): add tag and project resources and data sources * docs(terraform): changelog and readme for parity additions * feat(terraform): add data sources for keys, teams, models, organizations, and mcp servers * fix(terraform): key update 400 on empty budget_duration, key info envelope, config-supplied key * fix(terraform): hash raw keys to SHA-256 tokens in key lookup URLs and block resource IDs
48 lines
1.4 KiB
Markdown
48 lines
1.4 KiB
Markdown
# litellm_fallback Resource
|
|
|
|
Manages a fallback configuration for a model in LiteLLM. Fallbacks are triggered when a call to the primary model fails after retries.
|
|
|
|
## Example Usage
|
|
|
|
### Basic Fallback Configuration
|
|
|
|
```hcl
|
|
resource "litellm_fallback" "gpt4_fallbacks" {
|
|
model = "gpt-4"
|
|
fallback_models = ["claude-3-sonnet", "gpt-3.5-turbo"]
|
|
}
|
|
```
|
|
|
|
### Context Window Fallback
|
|
|
|
```hcl
|
|
resource "litellm_fallback" "gpt4_context_window" {
|
|
model = "gpt-4"
|
|
fallback_models = ["claude-3-sonnet"]
|
|
fallback_type = "context_window"
|
|
}
|
|
```
|
|
|
|
## Argument Reference
|
|
|
|
The following arguments are supported:
|
|
|
|
* `model` - (Required, Forces new resource) The model name to configure fallbacks for. The model must already exist on the proxy.
|
|
* `fallback_models` - (Required) List of fallback model names in order of priority. Each model must exist on the proxy, and the primary model cannot be its own fallback.
|
|
* `fallback_type` - (Optional, Forces new resource) Type of fallback. One of `general` (default), `context_window`, or `content_policy`.
|
|
|
|
## Attribute Reference
|
|
|
|
In addition to the arguments above, the following attribute is exported:
|
|
|
|
* `id` - The primary model name.
|
|
|
|
## Import
|
|
|
|
Fallback configurations can be imported using the primary model name:
|
|
|
|
```shell
|
|
terraform import litellm_fallback.example gpt-4
|
|
```
|
|
|
|
Note: import always reads the `general` fallback type. Fallbacks of type `context_window` or `content_policy` cannot be imported.
|