Secrets

Keep sensitive data out of plaintext.

Use the secret manager to store sensitive data like access tokens, API keys, and passwords.

Secret tokens can be multiple lines, which is useful for things like SSH and PGP keys. Adding, updating, and deleting secrets immediately affects all models that use said secrets.

Using secrets in models

You can reference secrets in your deployed models using Truss. Follow the Truss secrets guide to learn how to let your models access secrets stored in Baseten.

Using secrets in applications

You can retrieve the secret in your code using context.get_secret('my_secret_name'). For example:

slack_api_token = context.get_secret('slack_api_token')
slack_client = slack_sdk.WebClient(token=slack_api_token)
# Use slack_client to send messages, etc.

Last updated