Manage API keys and credentials
This guide covers the full credential lifecycle in Wayland: adding a key, rotating it when it expires, removing a provider entirely, and understanding where the app stores the material so you know what to back up and what to protect.
Where credentials are stored
Section titled “Where credentials are stored”Desktop app (Electron)
Section titled “Desktop app (Electron)”On a machine running the Wayland desktop app, every API key and OAuth token is encrypted before it touches disk. The app uses Electron’s safeStorage API, which delegates to the OS secret store on each platform:
- macOS: the system Keychain
- Windows: DPAPI (Data Protection API)
- Linux (desktop): libsecret, backed by gnome-keyring or KWallet
The encrypted ciphertext is then stored in a column of Wayland’s local SQLite database. The plaintext key never appears in that database. If you inspect the SQLite file directly, you see only opaque ciphertext.
Headless server
Section titled “Headless server”When Wayland runs as a server (the wayland start npm package, or the standalone bun runtime), there is no Electron process and therefore no OS keychain. The app uses a file-based AES-256-GCM fallback instead.
The encryption key for this backend is a 32-byte random secret stored at .secret-key inside the data directory, set to mode 0600 (owner-read/write only, no other users). The data directory itself is 0700. The encryption key is derived from that secret via HKDF-SHA256 and is never stored in the database.
This is weaker than an OS keychain: anyone who can read the data directory (for example, a root-level backup process) can potentially access the secret and decrypt the stored credentials. For a single-tenant container behind Tailscale, this trade-off is acceptable and is the same posture as the rest of the 0600 config files on disk.
What is encrypted
Section titled “What is encrypted”All sensitive credential fields are encrypted regardless of backend. The classification covers any field whose name matches (case-insensitively, ignoring underscores and hyphens) one of these patterns: apiKey, token, accessToken, refreshToken, password, appSecret, and similar variants. Encrypted values carry a scheme prefix (enc:v1: for OS keychain, fenc:v1: for the file backend) so the two formats are never confused.
Add or connect a provider
Section titled “Add or connect a provider”- Open Settings > Models. The grid lists every provider in the catalog.
- Find the provider you want and click Manage.
- Paste your API key into the credential field, or follow the OAuth flow for providers that support keyless sign-in (xAI Grok, ChatGPT).
- Save. The provider card shows as connected.
For cloud providers (AWS Bedrock, Google Vertex AI, Azure OpenAI), the credential form has multiple fields. Fill them all in before saving.
See Add a Cloud Model Provider for provider-by-provider detail.
Rotate a key
Section titled “Rotate a key”When a key expires or you want to replace it:
- Open Settings > Models.
- Find the connected provider and click Manage.
- Use the Re-key action (sometimes labeled Update key). Enter the new key and confirm.
The old ciphertext is replaced atomically. There is no window where the provider is left uncredentialed during the swap.
If Wayland cannot decrypt the stored credentials (for example, after a keychain reset or a corrupt key file), the provider shows as “undecryptable” and prompts you to re-enter the key. This is the same re-key flow.
Disconnect a provider
Section titled “Disconnect a provider”Disconnecting removes the provider and its stored credentials from the registry. The deletion cascades: the provider’s model catalog entries and any override rows are removed along with the credentials.
- Open Settings > Models.
- Find the connected provider and click Manage.
- Scroll to the Disconnect section and click Disconnect. Wayland asks for confirmation before proceeding.
You can re-add the provider at any time by returning to the provider grid and supplying a new key.
Disable without removing
Section titled “Disable without removing”If you want to stop using a provider temporarily without deleting its credentials, use the per-provider on/off toggle on the provider’s card. A disabled provider is not offered in model selectors but its credentials remain stored and encrypted. Re-enable it to restore access.
Headless server: rotating keys
Section titled “Headless server: rotating keys”On a self-hosted server, the wayland setup command is the fastest way to update a provider key. wayland setup is the interactive configuration command installed alongside the server when you run npm install -g getwayland; it is separate from wayland start (which runs the server). Re-run wayland setup and paste the new key when prompted. Alternatively, use the Settings panel in the web UI if the server is already running.