API keys authenticate your requests to Baseten. You need an API key to:Documentation Index
Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
Use this file to discover all available pages before exploring further.
- Deploy models, Chains, and training projects with the Truss CLI.
- Call model endpoints for inference.
- Use the management API.
API key types
Baseten supports two types of API keys: Personal API keys are tied to your user account. Actions performed with a personal key are attributed to you. Use personal keys for local development and testing. Team API keys are not tied to an individual user. When your organization has teams enabled, team keys can be scoped to a specific team. Team keys can have different permission levels:- Full access: Deploy models, call endpoints, and manage resources.
- Inference only: Call model endpoints but cannot deploy or manage.
- Metrics only: Export metrics but cannot deploy or call models.
Environment-scoped API keys
Environment-scoped API keys are team API keys restricted to specific environments. Use them for least-privilege access when sharing keys with external partners or production integrations. You can scope a key in two ways:- By environment: The key can only call models in the selected environments (for example,
productiononly, orproductionandstaging). - By environment and model: The key can only call specific models within the selected environments.
Create an API key
- Navigate to API keys in your account settings.
- Select Create API key.
- Personal
- Team
- Select Personal and click Next.
- Enter a name for the key (lowercase letters, numbers, and hyphens only).
- Select Create API key.
Use API keys with the CLI
The first time you runtruss push, the CLI prompts you to choose how to authenticate. Choose Paste an API key to use a key from this page, or Log in via browser (OAuth) to authenticate without a long-lived secret on disk:
truss login (or its alias truss auth login). For details on credential storage, OAuth, and managing multiple remotes, see truss auth.
To configure or update an API key manually, edit ~/.trussrc:
Use API keys with endpoints
Pass your API key in theAuthorization header. Baseten accepts two formats interchangeably on every endpoint:
Bearer for compatibility with OpenAI-style clients and AI gateways such as LiteLLM and OpenRouter. For runnable examples, see Call your model.
Manage API keys
The API keys page shows all your keys with their creation date and last used timestamp. Use this information to identify unused keys. API keys don’t automatically expire. To maintain security, rotate keys periodically and revoke any that are no longer in use. To rename a key, select the pencil icon next to the key name. To rotate a key, create a new key, update your applications to use it, then revoke the old key. To revoke a key, select the trash icon next to the key. Revoked keys cannot be restored. You can also manage API keys programmatically with the REST API.Security recommendations
- Store API keys in environment variables or secret managers, not in code.
- Never commit API keys to version control.
- Use environment-scoped keys to limit access to specific environments and models.
- Use team keys with minimal permissions for production applications.
- Rotate keys periodically and revoke unused keys.
- Monitor key creation, deletion, and use through the audit log.