> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nextchat.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> Environment variables for selfhost deployments.

## Examples

> Few examples to get you started

### Enable `CODE` Authentication with OpenAI API Key

> Users required to input access password to use the API, they can also using their own api key to use NextChat.

| Variable Name | Value |
| - | - |
| `CODE` | `password1` |
| `OPENAI_API_KEY` | `sk_xxxxx` |

### Enable OpenAI to all users who have access to your website

| Variable Name | Value |
| - | - |
| `OPENAI_API_KEY` | `sk_xxxxx` |

### Using Azure as GPT Model Provider

| Variable Name | Value |
| - | - |
| `AZURE_URL` | `https://{azure-resource-url}/openai/deployments/{deploy-name}` |
| `AZURE_API_KEY` | `azure_key_123456` |
| `AZURE_API_VERSION` | `2022-06-01-preview` |

### Using Google Gemini Pro as Model Provider

| Variable Name | Value |
| - | - |
| `GOOGLE_API_KEY` | `google_key_123456` |

## Avaliable Environment Variables

| Variable Name | Required | Default Value | Description | Example |
| - | - | - | - | - |
| `CODE` | Optional | | Access password, separated by comma. | `password1,password2` |
| `OPENAI_API_KEY` | Required | | Your OpenAI API key, join multiple API keys with comma. | `key1,key2` |
| `BASE_URL` | Optional | `https://api.openai.com` | Override OpenAI API request base URL. | `http://your-openai-proxy.com` |
| `OPENAI_ORG_ID` | Optional | | Specify OpenAI organization ID. | `org-1234` |
| `AZURE_URL` | Optional | | Azure deploy URL. | `https://{azure-resource-url}/openai/deployments/{deploy-name}` |
| `AZURE_API_KEY` | Optional | | Azure API Key. | `azure_key_123456` |
| `AZURE_API_VERSION` | Optional | | Azure API Version, find it at Azure Documentation. | `2022-06-01-preview` |
| `GOOGLE_API_KEY` | Optional | | Google Gemini Pro API Key. | `google_key_123456` |
| `GOOGLE_URL` | Optional | | Google Gemini Pro API URL. | `https://googleapis.com/gemini/v1` |
| `HIDE_USER_API_KEY` | Optional | Empty | If you do not want users to input their own API key, set this value to 1. | `1` |
| `DISABLE_GPT4` | Optional | Empty | If you do not want users to use GPT-4, set this value to 1. | `1` |
| `ENABLE_BALANCE_QUERY` | Optional | Empty | If you do want users to query balance, set this value to 1, or you should set it to 0. | `1` |
| `DISABLE_FAST_LINK` | Optional | Empty | If you want to disable parse settings from URL, set this to 1. | `1` |
| `CUSTOM_MODELS` | Optional | Empty | To control custom models, use `+` to add a custom model, use `-` to hide a model, use `name=displayName` to customize model name, separated by comma. | `+llama,+claude-2,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.