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

# Authentication

When you connect a provider, you choose where Sourcebot gets its key: stored in Sourcebot, or read from the server's environment. Amazon Bedrock and Google Vertex AI can also use the server's cloud identity.

![The Connect OpenAI dialog with Read it from the server's environment selected, showing the OPENAI\_API\_KEY variable and a pencil to change it](https://mintcdn.com/sourcebot/GXVBx-Rf3UnnNIuv/images/models_key_from_env.png?fit=max\&auto=format\&n=GXVBx-Rf3UnnNIuv\&q=85\&s=633121c5c8c10093ffda9e50212b157e)

## Store it in Sourcebot

Sourcebot encrypts the key with `AUTH_SECRET` and keeps it in its database.

* If `AUTH_SECRET` changes, Sourcebot can't decrypt the key, and the provider shows **Key can't be read**. Requests to it fail until you enter the key again with **Edit**. They never fall back to the server's own key or cloud identity.
* To change where the provider sends requests, such as its base URL, you enter the key again.

## Read it from the server's environment

Sourcebot reads the key from an environment variable on each request. Use this for keys from a secret manager.

* By default, Sourcebot reads the provider's standard variable, such as `OPENAI_API_KEY`. If the server doesn't set it, the provider shows **Key not set**.
* To read a different variable, click the pencil next to its name. Use a name that starts with `SOURCEBOT_MODEL_KEY_`. Sourcebot reads only these and the providers' standard variables, so an owner can't point a provider at other server secrets.
* A standard variable only goes to its own provider's API. To send a key to a gateway or another base URL, use a `SOURCEBOT_MODEL_KEY_` variable or store the key.

## Cloud identities

| Provider | Server's identity | Or enter |
| - | - | - |
| Amazon Bedrock | The server's IAM role | An access key and secret |
| Google Vertex AI | The server's service account | A service account JSON key |

With Bedrock's IAM role, a base URL must be a Bedrock runtime endpoint in the provider's region, such as a VPC endpoint.

## Bearer tokens

Some gateways expect the key as an `Authorization: Bearer` token. For Anthropic, turn on **Send the key as a bearer token** under **Advanced**, or read the key from `ANTHROPIC_AUTH_TOKEN`, which Sourcebot always sends as a bearer token.


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