Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
# Model authentication
Provider profiles select an upstream and its credentials. Account identity and
profile selection are separate: a profile can refer to a saved account, while
environment accounts come from the process environment. See [models](models.md)
and [quota](quota.md) for consumers of those choices.
## Credentials
[`albedo_credentials`](../src/albedo/harness/sdk/albedo_credentials.erl) owns
`creds.json` under the Albedo home. Its `accounts` section holds provider
accounts, `providers` holds profile API keys, and `mcp` holds MCP credentials.
The file can contain secrets, but account records also contain metadata. Its
default write uses a temporary file with mode `0600`, syncs it, and renames it
into place. Mutations use the settings lock.
`migrate` copies legacy account, MCP, and profile-key data into `creds.json`
before retiring the old files to backups. An unreadable credential store causes
migration to fail rather than overwrite it. The module merges saved profile keys
into configuration on read. A nonempty key still in `config.json` takes
precedence.
## Accounts
[`albedo_auth_accounts`](../src/albedo/harness/sdk/albedo_auth_accounts.erl)
builds the account projection used by the auth API. It includes saved OAuth and
key accounts and environment key accounts, together with profiles that select or
rotate through them. The projection exposes account metadata, not the credential
value. Environment accounts cannot be renamed through `rename_account`.
`put_key` checks the provider, UUIDv7 identity, endpoint, key, and label before
saving a key account. The endpoint must be an HTTP or HTTPS URL with a host and
without credentials, query, or fragment. Duplicate keys at the same provider and
endpoint produce `key_exists`. Conflicting identity content produces `conflict`.
## Typed key accounts
[`key_accounts.gleam`](../src/albedo/harness/sdk/key_accounts.gleam) selects
profile-bound key accounts for OpenAI, Perplexity, and Mistral model requests.
`Profile` supplies the home, credential store, and pr…