The two credentials
The Cave key carries your tenant and project scope. The upstream key is forwarded by the gateway to the provider on your behalf. When you store the upstream key in a Caveman Cloud provider connection, you can drop the
x-cave-upstream-key header from requests.
Gateway authentication
Send the Cave API key on every request to the gateway. The gateway reads thex-cave-api-key header first and falls back to authorization: Bearer <key>, so both styles work. It resolves your organization and project from the key, then forwards the request upstream with the provider key.
x-cave-agent and x-cave-workflow identify traffic for reporting. They do not grant access. Tenant scope always comes from the verified API key, never from a request label or payload field.
Control API and console authentication
The console and the control API authenticate with the same identity system used by the gateway. When you sign in through the browser, the console obtains an access token for control-plane operations. The Cloud SDKs and CLI use the same token.CLI sign-in
Install thecvm CLI and sign in once through the browser. The CLI reuses the credential saved by caveman login.
CAVE_TOKEN and, for a private installation, CAVE_API_URL. Signed-out cvm commands exit with code 3 instead of hanging.
~/.caveman-cloud/config.json. Auth tokens go to the OS keychain when available, with a file fallback under ~/.caveman/credentials.
MCP and coding agents
Coding agents connect through the MCP endpoint using browser OAuth. Open Connect your coding agent in the dashboard. The approval binds one project and defaults to metadata reads; content, authoring, and paid execution stay opt-in. No Caveman CLI or gateway key is required for this path. OAuth uses S256 PKCE and issuer-bound authorization responses. There is no dynamic client registration.Project scoping
Keys, traces, workloads, evals, and SQL queries are all scoped to a project. When using the CLI, you can target a project with:--project UUID- The
CAVE_PROJECT_IDenvironment variable cvm context bind(writes.caveman-cloud.jsonin the repository)- The saved default project
projectId at initialization.
Key rotation and governance
Project owners and admins manage API keys under Governance, Keys in the console. You can create, revoke, and review key usage. Identity administration and credential lifecycle remain human-only: shared agents cannot create or rotate keys. A Cloud access token and a gateway inference key have different audiences. Do not use one where the other is expected.Common auth errors
For SQL access, per-person columns need
billing:read, payload columns need payload:read, and agent connections additionally need trace:read_payload. Project keys with sql:read can query their own project only.