docs(configs.md): update to clarify you can use os.environ/ for any config value

This commit is contained in:
Krrish Dholakia 2024-09-05 12:40:31 -07:00 committed by Ishaan Jaff
parent a30917311e
commit c154c5e230

View file

@ -409,12 +409,12 @@ You can view your cost once you set up [Virtual keys](https://docs.litellm.ai/do
## Load API Keys
### Load API Keys from Environment
### Load API Keys / config values from Environment
If you have secrets saved in your environment, and don't want to expose them in the config.yaml, here's how to load model-specific keys from the environment.
If you have secrets saved in your environment, and don't want to expose them in the config.yaml, here's how to load model-specific keys from the environment. **This works for ANY value on the config.yaml**
```python
os.environ["AZURE_NORTH_AMERICA_API_KEY"] = "your-azure-api-key"
```yaml
os.environ/<YOUR-ENV-VAR> # runs os.getenv("YOUR-ENV-VAR")
```
```yaml
@ -424,7 +424,7 @@ model_list:
model: azure/chatgpt-v-2
api_base: https://openai-gpt-4-test-v-1.openai.azure.com/
api_version: "2023-05-15"
api_key: os.environ/AZURE_NORTH_AMERICA_API_KEY
api_key: os.environ/AZURE_NORTH_AMERICA_API_KEY # 👈 KEY CHANGE
```
[**See Code**](https://github.com/BerriAI/litellm/blob/c12d6c3fe80e1b5e704d9846b246c059defadce7/litellm/utils.py#L2366)