The [`config_list_from_json`](/docs/reference/oai/openai_utils#config_list_from_json) function loads a list of configurations from an environment variable or a json file.
It first looks for environment variable "OAI_CONFIG_LIST" which needs to be a valid json string. If that variable is not found, it then looks for a json file named "OAI_CONFIG_LIST" under the specified `file_location`. It then filters the configs by models (you can filter by other keys as well).
The `OAI_CONFIG_LIST` var or file content looks like the following:
```json
[
{
"model": "gpt-4",
"api_key": "<yourOpenAIAPIkeyhere>"
},
{
"model": "gpt-4",
"api_key": "<yourAzureOpenAIAPIkeyhere>",
"api_base": "<yourAzureOpenAIAPIbasehere>",
"api_type": "azure",
"api_version": "2023-07-01-preview"
},
{
"model": "gpt-3.5-turbo",
"api_key": "<yourAzureOpenAIAPIkeyhere>",
"api_base": "<yourAzureOpenAIAPIbasehere>",
"api_type": "azure",
"api_version": "2023-07-01-preview"
},
]
```
### Construct a list of endpoints for OpenAI or Azure OpenAI
he [`config_list_from_models`](/docs/reference/oai/openai_utils#config_list_from_models) function tries to create a list of configurations using Azure OpenAI endpoints and OpenAI endpoints for the provided list of models. It assumes the api keys and api bases are stored in the corresponding environment variables or local txt files: