Credentials
How Credentials Are Resolved¶
Rusty resolves API keys through a tiered chain, checking each source in order. The first non-empty value found is used.
Resolution Order¶
-
Environment Variables
RUSTY_API_KEYis checked first, thenOPENAI_API_KEY. Empty strings are treated as absent. -
OS Keyring
If
credential_storeis set to"keyring"in settings, Rusty reads from the system keyring:- macOS: Keychain Access
- Windows: Credential Manager
- Linux: Secret Service (GNOME Keyring, KWallet)
-
Settings File
The
api_keyfield in~/.rusty/settings.jsonis used as a final fallback.
Credential Store Options¶
Keyring (Recommended)¶
Stores the API key in the operating system's secure credential store. This is the default and recommended option.
The keyring is managed automatically by the setup wizard. You can also manage it programmatically:
Settings File¶
Stores the API key in plaintext in ~/.rusty/settings.json. Use this if your platform does not have a keyring available (e.g., headless Linux without a desktop environment).
Warning
When using settings_file mode, the API key is stored in plaintext. Ensure appropriate file permissions on ~/.rusty/settings.json.
Multi-Provider Setup¶
If you switch between providers, you can store separate credentials using environment variables:
RUSTY_API_KEY always takes precedence over OPENAI_API_KEY.