small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs auth.md
46 kB · 351 lines
Markdown

# model authentication model authentication is supplied by model-provider extensions rather than the daemon configuration loader. ## credentials Every secret albedo keeps lives in `$ALBEDO_HOME/creds.json`, mode `0600`, and only the daemon reads or writes it. `accounts` holds OAuth and key accounts by store key, as one object or an array. Key accounts contain `type: "key"`, `apiKey`, `endpoint`, `label`, and `_albedo_account_id`; generic compatible keys use `accounts.openai`, OpenCode Go uses `accounts.opencode-go`, Perplexity uses `accounts.perplexity`, and Mistral uses `accounts.mistral`. `providers` holds legacy profile keys for other extensions; `mcp` holds each MCP server's `bearerToken`, `headers`, `env`, a configured OAuth client (`oauthClient`) and its OAuth sign-in (`oauth`, see [mcp](mcp.md#sign-in-with-oauth)). All credential and settings mutations share one per-home daemon lock. OAuth refreshes re-read under that lock and preserve unrelated sections. A hand-written config `apiKey` wins at runtime: the next start moves it into a key account and pins the profile for `openai`, `opencode-go` and `mistral`, and leaves it in the profile for a provider that reads its own (`bedrock`, `vertex`, `perplexity`). Account limit marks under `accounts` are recorded per model-family meter for Google Antigravity (`limitedMeters: {"claude": <epoch ms>, ...}` with meter keys `gemini`, `claude`, `gpt-oss`, falling back conservatively to legacy `limitedUntil` when `limitedMeters` is absent). Codex and saved API keys use account-wide `limitedUntil`. Environment keys keep transient marks for the daemon's lifetime. At start the daemon moves secrets still kept elsewhere into `creds.json`: `auth.json`'s accounts, `mcp-credentials.json`'s servers, and the `apiKey` of a `config.json` profile whose provider keeps its keys as accounts (`openai`, Alibaba profiles included as they convert to it, `opencode-go`, and `mistral`). A provider that reads its own profile key (`bedrock`, `vertex`, `perplexity`) keeps it there, so a `conf…