Default Behavior
By default, the TensorZero Gateway will look for credentials in the following environment variables:Model Provider | Default Credential |
---|---|
Anthropic | ANTHROPIC_API_KEY |
AWS Bedrock | Uses AWS SDK credentials |
AWS SageMaker | Uses AWS SDK credentials |
Azure | AZURE_OPENAI_API_KEY |
Deepseek | DEEPSEEK_API_KEY |
Fireworks | FIREWORKS_API_KEY |
GCP Vertex AI (Anthropic) | GCP_VERTEX_CREDENTIALS_PATH |
GCP Vertex AI (Gemini) | GCP_VERTEX_CREDENTIALS_PATH |
Google AI Studio (Gemini) | GOOGLE_API_KEY |
Groq | GROQ_API_KEY |
Hyperbolic | HYPERBOLIC_API_KEY |
Mistral | MISTRAL_API_KEY |
OpenAI | OPENAI_API_KEY |
OpenAI-Compatible | OPENAI_API_KEY |
OpenRouter | OPENROUTER_API_KEY |
SGLang | SGLANG_API_KEY |
Text Generation Inference (TGI) | None |
Together | TOGETHER_API_KEY |
vLLM | None |
XAI | XAI_API_KEY |
Customizing Credential Management
You can customize the source of credentials for each provider. See Configuration Reference (e.g.api_key_location
) for more information on the different ways to configure credentials for each provider.
Also see the relevant provider guides for more information on how to configure credentials for each provider.
Static Credentials
You can set alternative static credentials for each provider. For example, let’s say we want to use a different environment variable for an OpenAI provider. We can customize variable name by setting theapi_key_location
to env::MY_OTHER_OPENAI_API_KEY
.
MY_OTHER_OPENAI_API_KEY
environment variable and use that value for the API key.
Load Balancing Between Multiple Credentials
You can load balance between different API keys for the same provider by defining multiple variants and models.For example, the configuration below will split the traffic between two different OpenAI API keys,OPENAI_API_KEY_1
and OPENAI_API_KEY_2
.Dynamic Credentials
You can provide API keys dynamically at inference time. To do this, you can use thedynamic::
prefix in the relevant credential field in the provider configuration.
For example, let’s say we want to provide dynamic API keys for the OpenAI provider.
credentials
argument.