Skip to content

An open-source, faster Devin alternative

TypeScript

docs: first-class Credentials page, dashboard mentions, SDK coverage

Igor Zalutskie270aa628f6f
diff --git a/docs/agent-sessions/agents.mdx b/docs/agent-sessions/agents.mdx
index a884badc..228cebcc 100644
--- a/docs/agent-sessions/agents.mdx
+++ b/docs/agent-sessions/agents.mdx
@@ -6,6 +6,8 @@ description: "Reusable agent configuration"
An **agent** is reusable configuration: `name`, `prompt`, `model`, and [`runtime`](/agent-sessions/runtimes). Every [session](/agent-sessions/sessions) runs on an agent, so create one first, then start as many sessions on it as you like.
+<Note>You can create and edit agents in the [dashboard](https://app.opencomputer.dev) too — the create dialog also lets you pick or add a [credential](/agent-sessions/credentials) inline.</Note>
+
<CodeGroup>
```ts TypeScript SDK
@@ -38,14 +40,14 @@ Content-Type: application/json
</CodeGroup>
-Pass your model `key` inline and it's stored as a [credential](/agent-sessions/authentication#model-credentials) and attached to the agent — sessions run the model on it. The provider is taken from `model` (Anthropic for `anthropic/…`, OpenAI for `openai/…`), so the key has to be for that provider. Already have a credential? Reference it with `credential: "cred_…"` instead, or omit both to use your org default for that provider. Optionally set default [`limits`](/agent-sessions/sessions#limits) (`tokens`/`turn_seconds`/`turns`) too; sessions inherit them.
+Pass your model `key` inline and it's stored as a [credential](/agent-sessions/credentials) and attached to the agent — sessions run the model on it. The provider is taken from `model` (Anthropic for `anthropic/…`, OpenAI for `openai/…`), so the key has to be for that provider. Already have a credential? Reference it with `credential: "cred_…"` instead, or omit both to use your org default for that provider. Optionally set default [`limits`](/agent-sessions/sessions#limits) (`tokens`/`turn_seconds`/`turns`) too; sessions inherit them.
<Tip>Keep the org key and model key on your backend. Only return session-scoped client tokens to browsers.</Tip>
## Session-pinned config
-When a session is created it **freezes** the agent's `prompt`, `model`, `runtime`, and `revision` (a number that bumps on every edit) into the session — and pins the resolved credential too. Editing the named agent afterwards never changes a running or resumed session — its behavior is pinned for its whole life. Update an agent freely: existing sessions keep what they started with, new sessions pick up the change. (Rotating a credential's **key value** is the exception — that flows to running sessions, so a compromised key can be replaced; see [authentication](/agent-sessions/authentication#model-credentials).)
+When a session is created it **freezes** the agent's `prompt`, `model`, `runtime`, and `revision` (a number that bumps on every edit) into the session — and pins the resolved credential too. Editing the named agent afterwards never changes a running or resumed session — its behavior is pinned for its whole life. Update an agent freely: existing sessions keep what they started with, new sessions pick up the change. (Rotating a credential's **key value** is the exception — that flows to running sessions, so a compromised key can be replaced; see [credentials](/agent-sessions/credentials).)
## Model
-`model` is a `provider/model` id, and its provider must match the [runtime](/agent-sessions/runtimes): `claude` runs `anthropic/…` (e.g. `anthropic/claude-opus-4-8`), `codex` runs `openai/…` (e.g. `openai/gpt-5-codex`). The model runs on [your own key](/agent-sessions/authentication#model-credentials) for that provider (required). The `runtime` / `model` / credential pairing is validated when you **create** the agent. `runtime` is fixed at creation — to switch engines, create a new agent; you can still update `model` later, but keep it within the runtime's provider.
+`model` is a `provider/model` id, and its provider must match the [runtime](/agent-sessions/runtimes): `claude` runs `anthropic/…` (e.g. `anthropic/claude-opus-4-8`), `codex` runs `openai/…` (e.g. `openai/gpt-5-codex`). The model runs on [your own key](/agent-sessions/credentials) for that provider (required). The `runtime` / `model` / credential pairing is validated when you **create** the agent. `runtime` is fixed at creation — to switch engines, create a new agent; you can still update `model` later, but keep it within the runtime's provider.
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdx
index bd218bf7..a20813b7 100644
--- a/docs/agent-sessions/api-reference.mdx
+++ b/docs/agent-sessions/api-reference.mdx
@@ -334,7 +334,7 @@ Responses **never** contain a token or secret. Registering a repo is **optional*
</Tabs>
-Credential body: `provider`, `key`, `name?`, `is_default?`. Keys are write-only. A credential is **required**; sessions run on your provider key.
+Credential body: `provider`, `key`, `name?`, `is_default?`. Keys are write-only. A credential is **required**; sessions run on your provider key. See the [Credentials](/agent-sessions/credentials) guide for resolution, rotation, and the dashboard.
```
Credential = { id, provider, name?, last4, is_default, created_at }
diff --git a/docs/agent-sessions/authentication.mdx b/docs/agent-sessions/authentication.mdx
index 56c95663..d9cf8623 100644
--- a/docs/agent-sessions/authentication.mdx
+++ b/docs/agent-sessions/authentication.mdx
@@ -77,44 +77,6 @@ For the SSE stream the browser passes the client token as `?token=` (native `Eve
## Model credentials
-Sessions run the model on **your own provider key**: Anthropic for the `claude` [runtime](/agent-sessions/runtimes), OpenAI for `codex`. The key is held in OpenComputer's [secret store](/sandboxes/secrets), encrypted at rest (AES-256-GCM), write-only, and **never returned** by the API. The real key never enters a sandbox: the runtime gets an opaque placeholder, and a host-side proxy swaps in the real value only on the outbound HTTPS call to the model provider (`api.anthropic.com` or `api.openai.com`, scoped by an egress allowlist). 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`. The key is held in OpenComputer's [secret store](/sandboxes/secrets), encrypted at rest (AES-256-GCM), write-only, and **never returned** by the API. The real key never enters a sandbox: the runtime gets an opaque placeholder, and a host-side proxy swaps in the real value only on the outbound HTTPS call to the provider. A credential is **required**; a session with no resolvable key fails to start (`422 no_credential`).
-The easiest way to add one is inline when you [create an agent](/agent-sessions/agents) (`"key": "…"`) — the provider is inferred from the agent's `model`. The standalone resource below is for reusing one key across agents, setting an org default, and rotating/removing keys. Set `provider` to `anthropic` or `openai`:
-
-<CodeGroup>
-
-```ts TypeScript SDK
-await oc.credentials.create({
- provider: "anthropic",
- key: "sk-ant-...",
- name: "prod",
-});
-```
-
-```http REST API
-POST https://api.opencomputer.dev/v3/credentials
-Authorization: Bearer $OPENCOMPUTER_API_KEY
-Content-Type: application/json
-
-{ "provider": "anthropic", "key": "sk-ant-...", "name": "prod" }
-```
-
-</CodeGroup>
-
-<CodeGroup>
-
-```ts TypeScript SDK
-await oc.credentials.setDefault({ credential: "cred_..." });
-```
-
-```http REST API
-PUT https://api.opencomputer.dev/v3/credentials/default
-Authorization: Bearer $OPENCOMPUTER_API_KEY
-Content-Type: application/json
-
-{ "credential": "cred_..." }
-```
-
-</CodeGroup>
-
-**Resolution** per session: the agent's credential → your org default for the provider. Sessions run on your configured provider key.
+The quickest way to add one is inline when you [create an agent](/agent-sessions/agents) (`"key": "…"`). To reuse a key across agents, set an org default, or rotate/remove keys, see the dedicated **[Credentials](/agent-sessions/credentials)** page.
diff --git a/docs/agent-sessions/credentials.mdx b/docs/agent-sessions/credentials.mdx
new file mode 100644
index 00000000..1ac4b8ae
--- /dev/null
+++ b/docs/agent-sessions/credentials.mdx
@@ -0,0 +1,128 @@
+---
+mode: "wide"
+title: "Credentials"
+description: "Bring-your-own model provider keys"
+---
+
+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`).
+
+## The quick way
+
+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).
+
+<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>
+
+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>
+
+## 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.
+
+<CodeGroup>
+
+```ts TypeScript SDK
+const cred = await oc.credentials.create({
+ provider: "anthropic",
+ key: "sk-ant-...",
+ name: "prod",
+ isDefault: true,
+});
+// → { id: "cred_…", provider: "anthropic", name: "prod", last4: "AB12", isDefault: true, createdAt: "…" }
+```
+
+```http REST API
+POST https://api.opencomputer.dev/v3/credentials
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+Content-Type: application/json
+
+{ "provider": "anthropic", "key": "sk-ant-...", "name": "prod", "is_default": true }
+```
+
+</CodeGroup>
+
+Attach it to an agent by id (instead of an inline `key`):
+
+```ts TypeScript SDK
+await oc.agents.create({ name: "reviewer", runtime: "claude", model: "anthropic/claude-opus-4-8", prompt: "…", credential: cred.id });
+```
+
+## List, default, and remove
+
+<CodeGroup>
+
+```ts TypeScript SDK
+const creds = await oc.credentials.list(); // metadata only (last4, never the key)
+await oc.credentials.setDefault({ credential: "cred_..." });
+await oc.credentials.delete("cred_...");
+```
+
+```http REST API
+GET https://api.opencomputer.dev/v3/credentials
+PUT https://api.opencomputer.dev/v3/credentials/default { "credential": "cred_..." }
+DELETE https://api.opencomputer.dev/v3/credentials/:id
+```
+
+</CodeGroup>
+
+The 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>
+
+## Resolution
+
+When a session is created, the credential is resolved (and **pinned** for the session's life) in this order:
+
+1. The **agent's** credential, if it has one and it matches the runtime's provider.
+2. Your **org default** for that provider.
+
+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`:
+
+<CodeGroup>
+
+```ts TypeScript SDK
+await oc.agents.update("agt_...", { key: "sk-ant-NEW..." });
+```
+
+```http REST API
+PATCH https://api.opencomputer.dev/v3/agents/agt_...
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+Content-Type: application/json
+
+{ "key": "sk-ant-NEW..." }
+```
+
+</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).
+
+## How keys are protected
+
+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.
+
+<Tip>Keep your org key and model keys on your backend. Hand browsers only session-scoped [client tokens](/agent-sessions/authentication#client-tokens).</Tip>
diff --git a/docs/agent-sessions/overview.mdx b/docs/agent-sessions/overview.mdx
index 2e5e59c7..2dc443d7 100644
--- a/docs/agent-sessions/overview.mdx
+++ b/docs/agent-sessions/overview.mdx
@@ -6,6 +6,8 @@ description: "Define an agent, then run resumable, steerable sessions"
Create an agent, start a session, stream its event log, steer it with messages, and receive results by webhook.
+<Note>Prefer a console? The [dashboard](https://app.opencomputer.dev) does all of this in a UI — create [agents](/agent-sessions/agents) and [credentials](/agent-sessions/credentials), watch and steer sessions live, and inspect webhook deliveries. The API and SDK below are the same surface, scripted.</Note>
+
## Core behavior
<CardGroup cols={2}>
@@ -35,7 +37,7 @@ Create an agent, start a session, stream its event log, steer it with messages,
<Steps>
<Step title="Define an agent">
- Create a reusable `{ name, model, prompt, runtime }` from your backend — `runtime: "claude"` (Anthropic models) or `"codex"` (OpenAI models). Pass your model `key` inline, or reference a saved [credential](/agent-sessions/authentication#model-credentials). ([Agents](/agent-sessions/agents))
+ Create a reusable `{ name, model, prompt, runtime }` from your backend — `runtime: "claude"` (Anthropic models) or `"codex"` (OpenAI models). Pass your model `key` inline, or reference a saved [credential](/agent-sessions/credentials). ([Agents](/agent-sessions/agents))
</Step>
<Step title="Start a session">
Start a session with `{ agent, input }`. The agent starts immediately and returns a browser-safe `client_token`.
diff --git a/docs/agent-sessions/quickstart.mdx b/docs/agent-sessions/quickstart.mdx
index b5c79ca0..8332ac12 100644
--- a/docs/agent-sessions/quickstart.mdx
+++ b/docs/agent-sessions/quickstart.mdx
@@ -8,6 +8,8 @@ This quickstart defines an agent, starts a session, streams its event log, and s
For the finished version, see the [example app](https://github.com/diggerhq/oc-sessions-demos); for every endpoint, the [API / SDK reference](/agent-sessions/api-reference).
+<Tip>Want to click through it first? The [dashboard](https://app.opencomputer.dev) creates agents and credentials, then streams and steers the session live — a fast way to see the flow before wiring it into code.</Tip>
+
## Prerequisites
You need an OpenComputer API key and an Anthropic key:
@@ -63,7 +65,7 @@ Response:
{ "id": "agt_...", "name": "quickstart-coder", "revision": 1 }
```
-<Note>Your model `key` is held in OpenComputer's [secret store](/sandboxes/secrets) (encrypted, write-only) and **never enters the sandbox**. The agent runs with a placeholder; an **egress proxy substitutes the real key in-flight** on the outbound model-provider call. Reuse one key across agents via a [credential](/agent-sessions/authentication#model-credentials).</Note>
+<Note>Your model `key` is held in OpenComputer's [secret store](/sandboxes/secrets) (encrypted, write-only) and **never enters the sandbox**. The agent runs with a placeholder; an **egress proxy substitutes the real key in-flight** on the outbound model-provider call. Reuse one key across agents via a [credential](/agent-sessions/credentials).</Note>
<Tip>`POST /agents` is idempotent by agent name, so it is fine to call this during application startup.</Tip>
diff --git a/docs/agent-sessions/runtimes.mdx b/docs/agent-sessions/runtimes.mdx
index 8c98eb71..3ec97772 100644
--- a/docs/agent-sessions/runtimes.mdx
+++ b/docs/agent-sessions/runtimes.mdx
@@ -4,7 +4,7 @@ title: "Runtimes"
description: "Runtime engine selected per agent"
---
-A **runtime** executes the agent loop: provider SDK, model calls, and tool use. You pick one per agent with `runtime`; it defaults to `claude`. The model is separate configuration, so an agent is a runtime, a `provider/model`, and a matching [credential](/agent-sessions/authentication#model-credentials).
+A **runtime** executes the agent loop: provider SDK, model calls, and tool use. You pick one per agent with `runtime`; it defaults to `claude`. The model is separate configuration, so an agent is a runtime, a `provider/model`, and a matching [credential](/agent-sessions/credentials).
| Runtime | Models | Credential |
| --- | --- | --- |
@@ -20,7 +20,7 @@ Sessions, [events](/agent-sessions/events), [steering](/agent-sessions/messaging
## `claude`
-The managed Claude agent loop (Claude Agent SDK / Claude Code). It works in a sandbox through remote tools, streams its steps into the session as events, and runs Claude models on your [Anthropic key](/agent-sessions/authentication#model-credentials).
+The managed Claude agent loop (Claude Agent SDK / Claude Code). It works in a sandbox through remote tools, streams its steps into the session as events, and runs Claude models on your [Anthropic key](/agent-sessions/credentials).
```http
POST https://api.opencomputer.dev/v3/agents
@@ -38,7 +38,7 @@ Content-Type: application/json
## `codex`
-The managed Codex agent loop (OpenAI Codex SDK). It runs OpenAI models on your [OpenAI key](/agent-sessions/authentication#model-credentials), and drives the same sandbox tools and event stream as `claude` — only the engine and the provider change.
+The managed Codex agent loop (OpenAI Codex SDK). It runs OpenAI models on your [OpenAI key](/agent-sessions/credentials), and drives the same sandbox tools and event stream as `claude` — only the engine and the provider change.
```http
POST https://api.opencomputer.dev/v3/agents
@@ -54,7 +54,7 @@ Content-Type: application/json
}
```
-The runtime, model, and credential have to agree: `runtime: "codex"` needs an `openai/…` model and an OpenAI key, and `runtime: "claude"` needs an `anthropic/…` model and an Anthropic key. A mismatch is rejected when you create the agent, with a clear error — so a session never starts on a broken pairing. See [model credentials](/agent-sessions/authentication#model-credentials).
+The runtime, model, and credential have to agree: `runtime: "codex"` needs an `openai/…` model and an OpenAI key, and `runtime: "claude"` needs an `anthropic/…` model and an Anthropic key. A mismatch is rejected when you create the agent, with a clear error — so a session never starts on a broken pairing. See [model credentials](/agent-sessions/credentials).
## Architecture
@@ -73,7 +73,7 @@ A runtime also **starts fast**: the engine is prepared ahead of time and baked i
### Brain and hands
-The runtime runs the agent loop in its **own per-session sandbox** (the *brain*). The agent's file and shell tools don't run there — they run in a **separate sandbox** (the *hands*) exposed to the brain through tools, so commands and file edits stay isolated from the model loop. The brain carries the [sealed model key](/agent-sessions/authentication#model-credentials) (egress-allowlisted to the model API, swapped in by a host proxy so the key never enters the VM); the hands sandbox holds no secrets.
+The runtime runs the agent loop in its **own per-session sandbox** (the *brain*). The agent's file and shell tools don't run there — they run in a **separate sandbox** (the *hands*) exposed to the brain through tools, so commands and file edits stay isolated from the model loop. The brain carries the [sealed model key](/agent-sessions/credentials) (egress-allowlisted to the model API, swapped in by a host proxy so the key never enters the VM); the hands sandbox holds no secrets.
### Each turn is bounded
diff --git a/docs/agent-sessions/sessions.mdx b/docs/agent-sessions/sessions.mdx
index e43a9908..1596c88f 100644
--- a/docs/agent-sessions/sessions.mdx
+++ b/docs/agent-sessions/sessions.mdx
@@ -6,9 +6,11 @@ description: "Durable, resumable agent execution"
A **session** is an [agent](/agent-sessions/agents) run with an append-only [event log](/agent-sessions/events), a pinned agent snapshot, and a lifecycle status. Compute can attach, detach when idle, and reattach on the next message; the log persists.
+<Note>The [dashboard](https://app.opencomputer.dev) lists your sessions and opens each with a live event stream you can watch and steer — handy for following or debugging a run without building UI.</Note>
+
## Session flow
-1. You create a session from an [agent](/agent-sessions/agents) (and a [model credential](/agent-sessions/authentication#model-credentials) — both required). The session starts immediately.
+1. You create a session from an [agent](/agent-sessions/agents) (and a [model credential](/agent-sessions/credentials) — both required). The session starts immediately.
2. The [runtime](/agent-sessions/runtimes) executes the agent in a sandbox, appending [events](/agent-sessions/events) to the log as it works.
3. With nothing left to do, the session goes **idle** and the sandbox **hibernates**.
4. A [steer](/agent-sessions/messaging) message wakes it; it resumes with its prior context. Repeat.
diff --git a/docs/docs.json b/docs/docs.json
index 80254353..d57ea806 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -66,6 +66,7 @@
"agent-sessions/overview",
"agent-sessions/quickstart",
"agent-sessions/agents",
+ "agent-sessions/credentials",
"agent-sessions/sessions",
"agent-sessions/repos",
"agent-sessions/events",
diff --git a/sdks/typescript/README.md b/sdks/typescript/README.md
index 3cfc8d09..2415b302 100644
--- a/sdks/typescript/README.md
+++ b/sdks/typescript/README.md
@@ -65,6 +65,19 @@ if (delivery.type === "turn.completed") {
}
```
+### Credentials
+
+Sessions run on **your** model-provider key (Anthropic for `claude`, OpenAI for `codex`). The inline `key` above stores one and attaches it to the agent; manage them directly to reuse a key across agents, set an org default, or rotate/remove:
+
+```typescript
+await oc.credentials.create({ provider: "anthropic", key: process.env.ANTHROPIC_API_KEY!, name: "prod", isDefault: true });
+const creds = await oc.credentials.list(); // metadata only — keys are write-only
+await oc.credentials.setDefault({ credential: creds[0].id });
+await oc.credentials.delete(creds[0].id);
+```
+
+Or reference one by id when creating an agent: `oc.agents.create({ …, credential: "cred_…" })`. A credential is **required** — a session with no resolvable key fails with `422 no_credential`. Full guide: [Credentials](https://docs.opencomputer.dev/agent-sessions/credentials).
+
## Sandbox webhooks (Preview)
Subscribe to sandbox lifecycle events (`sandbox.ready`, `sandbox.stopped`, …) — signed, retried, and redeliverable. The same `verifyWebhook` helper verifies both session and sandbox deliveries. **Preview: newly available; the surface may change.**