An open-source, faster Devin alternative
TypeScript
docs(credentials): lead with the security model, move the inline shortcut to the end
Igor Zalutskif1f4157979f8
diff --git a/docs/agent-sessions/credentials.mdx b/docs/agent-sessions/credentials.mdxindex 1ac4b8ae..add94fe1 100644--- a/docs/agent-sessions/credentials.mdx+++ b/docs/agent-sessions/credentials.mdx@@ -1,44 +1,35 @@---mode: "wide"title: "Credentials"-description: "Bring-your-own model provider keys"+description: "Bring-your-own model provider keys, held as hard secrets"----Sessions run the model on **your own provider key** — Anthropic for the `claude` [runtime](/agent-sessions/runtimes), OpenAI for `codex`. A **credential** is that key, stored once and reused across [agents](/agent-sessions/agents). A credential is **required**: a session with no resolvable key fails to start (`422 no_credential`).+Sessions run the model on **your own provider key** — Anthropic for the `claude` [runtime](/agent-sessions/runtimes), OpenAI for `codex`. A **credential** is that key, stored once and reused across [agents](/agent-sessions/agents). It's treated as a hard secret end to end: **encrypted at rest, never returned by the API, and never present inside a sandbox.** A credential is required — a session with no resolvable key fails to start (`422 no_credential`).-## The quick way+## How your keys are protected-The simplest path is to pass the key inline when you [create an agent](/agent-sessions/agents) — it's stored as a credential and attached to the agent. The provider is inferred from the agent's `model` (`anthropic/…` → Anthropic, `openai/…` → OpenAI).+<CardGroup cols={2}>+ <Card title="Encrypted, write-only" icon="lock">+ Keys live in a dedicated [secret store](/sandboxes/secrets), encrypted at rest (AES-256-GCM) and isolated from the application database. A key is **write-only**: once submitted it's never returned — reads expose only a `last4` display hint.+ </Card>+ <Card title="Never in the sandbox" icon="shield-halved">+ The real value never enters the agent's machine. The runtime sees an **opaque placeholder**; a host-side proxy swaps in the real key only on the outbound HTTPS call to the provider.+ </Card>+ <Card title="Egress-scoped" icon="arrow-right-from-bracket">+ That substitution happens **only** for the model provider's host (`api.anthropic.com` / `api.openai.com`), enforced by an egress allowlist — the sealed token is useless anywhere else.+ </Card>+ <Card title="Rotatable in place" icon="rotate">+ Replace a key's value at any time and it flows to **running** sessions, so a compromised key can be retired without restarting work. See [rotation](#rotation).+ </Card>+</CardGroup>-<CodeGroup>--```ts TypeScript SDK-await oc.agents.create({- name: "reviewer",- runtime: "claude",- model: "anthropic/claude-opus-4-8",- prompt: "Review the repo. Run tests. Summarize risks.",- key: "sk-ant-...",-});-```--```http REST API-POST https://api.opencomputer.dev/v3/agents-Authorization: Bearer $OPENCOMPUTER_API_KEY-Content-Type: application/json--{ "name": "reviewer", "runtime": "claude", "model": "anthropic/claude-opus-4-8", "prompt": "…", "key": "sk-ant-..." }-```--</CodeGroup>+So a key is safe to hand to OpenComputer: it can be **used** by your sessions to call your model provider, and read back by no one — not the API, not the model, not the sandbox, not us.-Reach for the standalone resource below when you want to **reuse one key across agents**, set an **org default**, or **rotate / remove** keys.--<Tip>Prefer not to touch the API? Add and manage credentials from the [dashboard](https://app.opencomputer.dev) under **Agents → Credentials** — and pick one (or add a new one inline) right in the create-agent dialog.</Tip>+<Warning>The matching responsibility is yours: keep your **org API key** (which manages credentials) on your backend, and hand browsers only session-scoped [client tokens](/agent-sessions/authentication#client-tokens) — never a model key or the org key.</Warning>## Add a credential-Set `provider` to `anthropic` or `openai`. `name` is an optional label; `is_default` makes it your org default for that provider (see [resolution](#resolution)). The response is the credential's **metadata only** — the key is write-only and never returned.+Set `provider` to `anthropic` or `openai`. `name` is an optional label; `is_default` makes it your org default for that provider (see [resolution](#resolution)). The response is the credential's **metadata only** — the key is never echoed back.<CodeGroup>@@ -62,12 +53,14 @@ Content-Type: application/json</CodeGroup>-Attach it to an agent by id (instead of an inline `key`):+Attach it to an agent by id, so the agent runs on it:```ts TypeScript SDKawait oc.agents.create({ name: "reviewer", runtime: "claude", model: "anthropic/claude-opus-4-8", prompt: "…", credential: cred.id });```+<Tip>Prefer not to touch the API? Add and manage credentials from the [dashboard](https://app.opencomputer.dev) under **Agents → Credentials** — and pick one (or add a new one inline) right in the create-agent dialog.</Tip>+## List, default, and remove<CodeGroup>@@ -88,7 +81,7 @@ DELETE https://api.opencomputer.dev/v3/credentials/:idThe credential object: `{ id, provider, name?, last4, is_default, created_at }`. `last4` is the last four characters, for display — the key itself is never returned.-<Warning>Deleting a credential breaks agents pinned to it and sessions that fall back to it (they'll `422 no_credential` until you point them at another). Make sure another credential is in place — or set a new default — first.</Warning>+<Warning>Deleting a credential breaks agents pinned to it and sessions that fall back to it (they'll `422 no_credential` until you point them at another). Make sure another credential — or a new default — is in place first.</Warning>## Resolution@@ -101,7 +94,7 @@ If neither resolves, the session fails to start with `422 no_credential`.## Rotation-Rotating the **key value** behind a credential flows to **running** sessions too (so a compromised key can be swapped without restarting work) — this is the one exception to a session's pinned config. Rotate by updating the agent's `key`:+Rotating the **key value** behind a credential flows to **running** sessions too — the one exception to a session's otherwise [pinned config](/agent-sessions/agents#session-pinned-config), so a compromised key can be swapped without restarting work. Rotate by updating the agent's `key`:<CodeGroup>@@ -119,10 +112,32 @@ Content-Type: application/json</CodeGroup>-Changing **which** credential an agent uses (a different `credential` id) affects only **future** sessions — existing sessions keep the one they pinned. See [session-pinned config](/agent-sessions/agents#session-pinned-config).+Changing **which** credential an agent uses (a different `credential` id) affects only **future** sessions — existing sessions keep the one they pinned.++## Shortcut: add a key inline++Once you're set up, you rarely call the credentials API directly. The common path is to pass the key **inline** when you [create an agent](/agent-sessions/agents) — it's stored as a credential (with all of the protections above) and attached to the agent in one call. The provider is inferred from the agent's `model` (`anthropic/…` → Anthropic, `openai/…` → OpenAI).-## How keys are protected+<CodeGroup>-The key is held in OpenComputer's [secret store](/sandboxes/secrets), encrypted at rest (AES-256-GCM) and **never returned** by the API. The real value never enters a sandbox: the runtime gets an opaque placeholder, and a host-side proxy swaps in the real key only on the outbound HTTPS call to the model provider (`api.anthropic.com` / `api.openai.com`), scoped by an egress allowlist.+```ts TypeScript SDK+await oc.agents.create({+ name: "reviewer",+ runtime: "claude",+ model: "anthropic/claude-opus-4-8",+ prompt: "Review the repo. Run tests. Summarize risks.",+ key: "sk-ant-...",+});+```++```http REST API+POST https://api.opencomputer.dev/v3/agents+Authorization: Bearer $OPENCOMPUTER_API_KEY+Content-Type: application/json++{ "name": "reviewer", "runtime": "claude", "model": "anthropic/claude-opus-4-8", "prompt": "…", "key": "sk-ant-..." }+```++</CodeGroup>-<Tip>Keep your org key and model keys on your backend. Hand browsers only session-scoped [client tokens](/agent-sessions/authentication#client-tokens).</Tip>+Reach for the standalone resource above when you want to reuse one key across agents, set an org default, or rotate / remove keys.