Skip to main content
Every request to the LiteLLM gateway is authenticated against a single master key before routing. Auth runs as the first step of every API endpoint.

Configure the master key

Set master_key under general_settings in config.yaml:
The value is read from the LITELLM_MASTER_KEY environment variable at boot. For local Docker Compose, the default master key is sk-local. Change it by setting LITELLM_MASTER_KEY in your .env file.

Supported header formats

The gateway accepts the master key in two header styles:

Response codes

A 401 returns:

Key separation

The master key authenticates callers to the gateway. It is separate from the provider API keys the gateway uses to call upstream LLMs. Provider keys are stored encrypted in the credentials vault and never exposed to callers.

Per-user keys (teams)

For team access, issue per-user virtual keys instead of sharing the master key. In Settings → Keys, click New Key and set budget limits, model restrictions, and expiry.
Team members use their virtual key as Authorization: Bearer <virtual-key> — they never see the master key or any provider credential.