app-server.md +224 −24
239- `thread/resume` - reopen an existing thread by id so later `turn/start` calls append to it.239- `thread/resume` - reopen an existing thread by id so later `turn/start` calls append to it.
240- `thread/fork` - fork a thread into a new thread id by copying stored history; emits `thread/started` for the new thread. Returned threads include `forkedFromId` when available.240- `thread/fork` - fork a thread into a new thread id by copying stored history; emits `thread/started` for the new thread. Returned threads include `forkedFromId` when available.
241- `thread/read` - read a stored thread by id without resuming it; set `includeTurns` to return full turn history. Returned `thread` objects include runtime `status`.241- `thread/read` - read a stored thread by id without resuming it; set `includeTurns` to return full turn history. Returned `thread` objects include runtime `status`.
242242- `thread/list` - page through stored thread logs; supports cursor-based pagination plus `modelProviders`, `sourceKinds`, `archived`, `cwd`, and `searchTerm` filters. Returned `thread` objects include runtime `status`.- `thread/list` - page through stored thread logs; supports cursor-based pagination plus `modelProviders`, `sourceKinds`, `archived`, `cwd`, `searchTerm`, and experimental `parentThreadId` filters. Returned `thread` objects include runtime `status`.
243- `thread/turns/list` - page through a stored thread's turn history without resuming it. `itemsView` controls whether turn items are omitted, summarized, or fully loaded.243- `thread/turns/list` - page through a stored thread's turn history without resuming it. `itemsView` controls whether turn items are omitted, summarized, or fully loaded.
244- `thread/turns/items/list` - reserved for paged turn-item loading; currently returns unsupported.244- `thread/turns/items/list` - reserved for paged turn-item loading; currently returns unsupported.
245- `thread/loaded/list` - list the thread ids currently loaded in memory.245- `thread/loaded/list` - list the thread ids currently loaded in memory.
248- `thread/goal/get` - read the current goal for a thread.248- `thread/goal/get` - read the current goal for a thread.
249- `thread/goal/clear` - clear the goal for a thread; emits `thread/goal/cleared`.249- `thread/goal/clear` - clear the goal for a thread; emits `thread/goal/cleared`.
250- `thread/metadata/update` - patch SQLite-backed stored thread metadata; currently supports persisted `gitInfo`.250- `thread/metadata/update` - patch SQLite-backed stored thread metadata; currently supports persisted `gitInfo`.
251251- `thread/archive` - move a thread's log file into the archived directory; returns `{}` on success and emits `thread/archived`.- `thread/archive` - move a thread's log file into the archived directory and attempt to archive spawned descendant thread logs that aren't already archived; returns `{}` on success and emits `thread/archived` for each archived thread.
252- `thread/delete` - permanently delete a persisted active or archived thread and any spawned descendant threads; returns `{}` on success and emits `thread/deleted` for each deleted thread.
252- `thread/unsubscribe` - unsubscribe this connection from thread turn/item events. If this was the last subscriber, the server unloads the thread after a no-subscriber inactivity grace period and emits `thread/closed`.253- `thread/unsubscribe` - unsubscribe this connection from thread turn/item events. If this was the last subscriber, the server unloads the thread after a no-subscriber inactivity grace period and emits `thread/closed`.
253- `thread/unarchive` - restore an archived thread rollout back into the active sessions directory; returns the restored `thread` and emits `thread/unarchived`.254- `thread/unarchive` - restore an archived thread rollout back into the active sessions directory; returns the restored `thread` and emits `thread/unarchived`.
254- `thread/status/changed` - notification emitted when a loaded thread's runtime `status` changes.255- `thread/status/changed` - notification emitted when a loaded thread's runtime `status` changes.
255- `thread/compact/start` - trigger conversation history compaction for a thread; returns `{}` immediately while progress streams via `turn/*` and `item/*` notifications.256- `thread/compact/start` - trigger conversation history compaction for a thread; returns `{}` immediately while progress streams via `turn/*` and `item/*` notifications.
256- `thread/shellCommand` - run a user-initiated shell command against a thread. This runs outside the sandbox with full access and doesn't inherit the thread sandbox policy.257- `thread/shellCommand` - run a user-initiated shell command against a thread. This runs outside the sandbox with full access and doesn't inherit the thread sandbox policy.
257- `thread/backgroundTerminals/clean` - stop all running background terminals for a thread (experimental; requires `capabilities.experimentalApi`).258- `thread/backgroundTerminals/clean` - stop all running background terminals for a thread (experimental; requires `capabilities.experimentalApi`).
259- `thread/backgroundTerminals/list` - list running background terminals for a loaded thread (experimental; requires `capabilities.experimentalApi`).
260- `thread/backgroundTerminals/terminate` - terminate one running background terminal by app-server `processId` (experimental; requires `capabilities.experimentalApi`).
258- `thread/rollback` - drop the last N turns from the in-memory context and persist a rollback marker; returns the updated `thread`.261- `thread/rollback` - drop the last N turns from the in-memory context and persist a rollback marker; returns the updated `thread`.
259- `turn/start` - add user input to a thread and begin Codex generation; responds with the initial `turn` and streams events. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode."262- `turn/start` - add user input to a thread and begin Codex generation; responds with the initial `turn` and streams events. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode."
260- `thread/inject_items` - append raw Responses API items to a loaded thread's model-visible history without starting a user turn.263- `thread/inject_items` - append raw Responses API items to a loaded thread's model-visible history without starting a user turn.
281- `marketplace/add` - add a remote plugin marketplace and persist it into the user's marketplace config.284- `marketplace/add` - add a remote plugin marketplace and persist it into the user's marketplace config.
282- `marketplace/upgrade` - refresh a configured Git marketplace, or all configured Git marketplaces when you omit the marketplace name.285- `marketplace/upgrade` - refresh a configured Git marketplace, or all configured Git marketplaces when you omit the marketplace name.
283- `plugin/list` - list discovered plugin marketplaces and plugin state, including install/auth policy metadata, marketplace load errors, featured plugin ids, and local, Git, or remote plugin source metadata.286- `plugin/list` - list discovered plugin marketplaces and plugin state, including install/auth policy metadata, marketplace load errors, featured plugin ids, and local, Git, or remote plugin source metadata.
284287- `plugin/read` - read one plugin by marketplace path or remote marketplace name and plugin name, including bundled skills, apps, and MCP server names when those details are available.- `plugin/read` - read one plugin by marketplace path or remote marketplace name and plugin name, including bundled skills, apps, MCP server names, and a remote plugin `shareUrl` when the remote catalog provides one.
285- `plugin/install` - install a plugin from a marketplace path or remote marketplace name.288- `plugin/install` - install a plugin from a marketplace path or remote marketplace name.
286- `plugin/uninstall` - uninstall an installed plugin.289- `plugin/uninstall` - uninstall an installed plugin.
287- `app/list` - list available apps (connectors) with pagination plus accessibility/enabled metadata.290- `app/list` - list available apps (connectors) with pagination plus accessibility/enabled metadata.
297- `feedback/upload` - submit a feedback report (classification + optional reason/logs + conversation id, plus optional `extraLogFiles` attachments).300- `feedback/upload` - submit a feedback report (classification + optional reason/logs + conversation id, plus optional `extraLogFiles` attachments).
298- `config/read` - fetch the effective configuration on disk after resolving configuration layering.301- `config/read` - fetch the effective configuration on disk after resolving configuration layering.
299- `externalAgentConfig/detect` - detect external-agent artifacts that can be migrated with `includeHome` and optional `cwds`; each detected item includes `cwd` (`null` for home).302- `externalAgentConfig/detect` - detect external-agent artifacts that can be migrated with `includeHome` and optional `cwds`; each detected item includes `cwd` (`null` for home).
300303- `externalAgentConfig/import` - apply selected external-agent migration items by passing explicit `migrationItems` with `cwd` (`null` for home). Supported item types include config, skills, `AGENTS.md`, plugins, MCP server config, subagents, hooks, commands, and sessions; plugin imports emit `externalAgentConfig/import/completed`.- `externalAgentConfig/import` - apply selected external-agent migration items by passing explicit `migrationItems` with `cwd` (`null` for home). Supported item types include config, skills, `AGENTS.md`, plugins, MCP server config, subagents, hooks, commands, and sessions; non-empty imports emit `externalAgentConfig/import/progress` and `externalAgentConfig/import/completed` as work finishes. Plugin and session imports can complete asynchronously.
301- `config/value/write` - write a single configuration key/value to the user's `config.toml` on disk.304- `config/value/write` - write a single configuration key/value to the user's `config.toml` on disk.
302- `config/batchWrite` - apply configuration edits atomically to the user's `config.toml` on disk.305- `config/batchWrite` - apply configuration edits atomically to the user's `config.toml` on disk.
303- `configRequirements/read` - fetch requirements from `requirements.toml` and/or MDM, including allow-lists, pinned `featureRequirements`, and residency/network requirements (or `null` if you haven't set any up).306- `configRequirements/read` - fetch requirements from `requirements.toml` and/or MDM, including allow-lists, pinned `featureRequirements`, and residency/network requirements (or `null` if you haven't set any up).
381- `thread/turns/list` pages through a stored thread's turn history without384- `thread/turns/list` pages through a stored thread's turn history without
382 resuming it. Use `itemsView` to choose whether turn items are omitted,385 resuming it. Use `itemsView` to choose whether turn items are omitted,
383 summarized, or fully loaded.386 summarized, or fully loaded.
384387- `thread/list` supports cursor pagination plus `modelProviders`, `sourceKinds`, `archived`, `cwd`, and `searchTerm` filtering.- `thread/list` supports cursor pagination plus `modelProviders`, `sourceKinds`, `archived`, `cwd`, `searchTerm`, and experimental `parentThreadId` filtering.
385- `thread/loaded/list` returns the thread IDs currently in memory.388- `thread/loaded/list` returns the thread IDs currently in memory.
386389- `thread/archive` moves the thread's persisted JSONL log into the archived directory.- `thread/archive` moves the thread's persisted JSONL log into the archived directory and attempts to archive spawned descendant thread logs that aren't already archived.
390- `thread/delete` permanently deletes a persisted active or archived thread and its spawned descendant threads.
387- `thread/metadata/update` patches stored thread metadata, currently including persisted `gitInfo`.391- `thread/metadata/update` patches stored thread metadata, currently including persisted `gitInfo`.
388- `thread/unsubscribe` unsubscribes the current connection from a loaded thread and can trigger `thread/closed` after an inactivity grace period.392- `thread/unsubscribe` unsubscribes the current connection from a loaded thread and can trigger `thread/closed` after an inactivity grace period.
389- `thread/unarchive` restores an archived thread rollout back into the active sessions directory.393- `thread/unarchive` restores an archived thread rollout back into the active sessions directory.
537 541
538- `cursor` - opaque string from a prior response; omit for the first page.542- `cursor` - opaque string from a prior response; omit for the first page.
539- `limit` - server defaults to a reasonable page size if unset.543- `limit` - server defaults to a reasonable page size if unset.
540544- `sortKey` - `created_at` (default) or `updated_at`.- `sortKey` - `created_at` (default), `updated_at`, or `recency_at`.
545- `sortDirection` - `desc` (default) or `asc`.
541- `modelProviders` - restrict results to specific providers; unset, null, or an empty array includes all providers.546- `modelProviders` - restrict results to specific providers; unset, null, or an empty array includes all providers.
542- `sourceKinds` - restrict results to specific thread sources. When omitted or `[]`, the server defaults to interactive sources only: `cli` and `vscode`.547- `sourceKinds` - restrict results to specific thread sources. When omitted or `[]`, the server defaults to interactive sources only: `cli` and `vscode`.
543- `archived` - when `true`, list archived threads only. When `false` or omitted, list non-archived threads (default).548- `archived` - when `true`, list archived threads only. When `false` or omitted, list non-archived threads (default).
544- `cwd` - restrict results to threads whose session current working directory exactly matches this path.549- `cwd` - restrict results to threads whose session current working directory exactly matches this path.
545- `searchTerm` - search stored thread summaries and metadata before pagination.550- `searchTerm` - search stored thread summaries and metadata before pagination.
551- `parentThreadId` - restrict results to direct child threads of the given parent thread. This filter is experimental and requires `capabilities.experimentalApi = true`.
546 552
547`sourceKinds` accepts the following values:553`sourceKinds` accepts the following values:
548 554
643 649
644### Archive a thread650### Archive a thread
645 651
646652Use `thread/archive` to move the persisted thread log (stored as a JSONL file on disk) into the archived sessions directory.Use `thread/archive` to move the persisted thread log (stored as a JSONL file on disk) into the archived sessions directory. Archiving a thread also attempts to archive spawned descendant threads that aren't already archived.
647 653
648```json654```json
649{ "method": "thread/archive", "id": 22, "params": { "threadId": "thr_b" } }655{ "method": "thread/archive", "id": 22, "params": { "threadId": "thr_b" } }
650{ "id": 22, "result": {} }656{ "id": 22, "result": {} }
651{ "method": "thread/archived", "params": { "threadId": "thr_b" } }657{ "method": "thread/archived", "params": { "threadId": "thr_b" } }
658{ "method": "thread/archived", "params": { "threadId": "thr_child" } }
652```659```
653 660
654661Archived threads won't appear in future calls to `thread/list` unless you pass `archived: true`.Archived threads won't appear in future calls to `thread/list` unless you pass `archived: true`. The server emits one `thread/archived` notification for each thread it actually archives; if a spawned descendant can't be archived, the request can still succeed without an archived notification for that descendant.
662
663### Delete a thread
664
665Use `thread/delete` to permanently delete a persisted active or archived thread
666and its spawned descendant threads. The server removes existing rollout files and
667associated metadata before returning success; missing rollout files are treated
668as already deleted. Ephemeral root threads can't be deleted.
669
670```json
671{ "method": "thread/delete", "id": 23, "params": { "threadId": "thr_b" } }
672{ "id": 23, "result": {} }
673{ "method": "thread/deleted", "params": { "threadId": "thr_b" } }
674{ "method": "thread/deleted", "params": { "threadId": "thr_child" } }
675```
655 676
656### Unarchive a thread677### Unarchive a thread
657 678
696{ "id": 27, "result": {} }717{ "id": 27, "result": {} }
697```718```
698 719
720Use `thread/backgroundTerminals/list` to inspect running background terminals
721for a loaded thread. The request supports standard `cursor` and `limit`
722pagination, and the returned `processId` is the app-server process id. This
723method is experimental and requires `capabilities.experimentalApi = true`:
724
725```json
726{ "method": "thread/backgroundTerminals/list", "id": 28, "params": { "threadId": "thr_b" } }
727{ "id": 28, "result": { "data": [
728 {
729 "itemId": "item_456",
730 "processId": "42",
731 "command": "python3 -m http.server",
732 "cwd": "/workspace",
733 "osPid": null,
734 "cpuPercent": null,
735 "rssKb": null
736 }
737], "nextCursor": null } }
738```
739
740Use `thread/backgroundTerminals/terminate` with that `processId` to stop one
741background terminal. This method is experimental and requires
742`capabilities.experimentalApi = true`:
743
744```json
745{ "method": "thread/backgroundTerminals/terminate", "id": 29, "params": { "threadId": "thr_b", "processId": "42" } }
746{ "id": 29, "result": { "terminated": true } }
747```
748
699### Roll back recent turns749### Roll back recent turns
700 750
701Use `thread/rollback` to remove the last `numTurns` entries from the in-memory context and persist a rollback marker in the rollout log. The returned `thread` includes `turns` populated after the rollback.751Use `thread/rollback` to remove the last `numTurns` entries from the in-memory context and persist a rollback marker in the rollout log. The returned `thread` includes `turns` populated after the rollback.
702 752
703```json753```json
704754{ "method": "thread/rollback", "id": 28, "params": { "threadId": "thr_b", "numTurns": 1 } }{ "method": "thread/rollback", "id": 30, "params": { "threadId": "thr_b", "numTurns": 1 } }
705755{ "id": 28, "result": { "thread": { "id": "thr_b", "name": "Bug bash notes", "ephemeral": false } } }{ "id": 30, "result": { "thread": { "id": "thr_b", "name": "Bug bash notes", "ephemeral": false } } }
706```756```
707 757
708## Turns758## Turns
1164 1214
1165When the client responds to `item/tool/requestUserInput`, app-server emits `serverRequest/resolved` with `{ threadId, requestId }`. If the pending request is cleared by turn start, turn completion, or turn interruption before the client answers, the server emits the same notification for that cleanup.1215When the client responds to `item/tool/requestUserInput`, app-server emits `serverRequest/resolved` with `{ threadId, requestId }`. If the pending request is cleared by turn start, turn completion, or turn interruption before the client answers, the server emits the same notification for that cleanup.
1166 1216
1217Request params include `autoResolutionMs` as an integer millisecond timeout or
1218`null`. When present, host clients can resolve the prompt automatically after that
1219interval if the user doesn't answer.
1220
1167### Dynamic tool calls (experimental)1221### Dynamic tool calls (experimental)
1168 1222
1169`dynamicTools` on `thread/start` and the corresponding `item/tool/call` request or response flow are experimental APIs.1223`dynamicTools` on `thread/start` and the corresponding `item/tool/call` request or response flow are experimental APIs.
1376 "_default": {1430 "_default": {
1377 "enabled": true,1431 "enabled": true,
1378 "destructive_enabled": true,1432 "destructive_enabled": true,
13791433 "open_world_enabled": true "open_world_enabled": true,
1434 "approvals_reviewer": "user",
1435 "default_tools_approval_mode": "auto"
1380 },1436 },
1381 "google_drive": {1437 "google_drive": {
1382 "enabled": true,1438 "enabled": true,
1383 "destructive_enabled": false,1439 "destructive_enabled": false,
1440 "approvals_reviewer": "auto_review",
1384 "default_tools_approval_mode": "prompt",1441 "default_tools_approval_mode": "prompt",
1385 "tools": {1442 "tools": {
1386 "files/delete": { "enabled": false, "approval_mode": "approve" }1443 "files/delete": { "enabled": false, "approval_mode": "approve" }
1391} }1448} }
1392```1449```
1393 1450
1451`apps._default.approvals_reviewer` sets the reviewer for all apps unless a
1452per-app value overrides it. When both are omitted, the app inherits the
1453top-level `approvals_reviewer` value. `apps._default.default_tools_approval_mode`
1454sets the fallback approval mode for tools without a per-app or per-tool
1455override. Managed approval-mode requirements override tool approval-mode
1456settings.
1457
1394Update a single app setting:1458Update a single app setting:
1395 1459
1396```json1460```json
1465 "description": "Import /Users/me/project/CLAUDE.md to /Users/me/project/AGENTS.md.",1529 "description": "Import /Users/me/project/CLAUDE.md to /Users/me/project/AGENTS.md.",
1466 "cwd": "/Users/me/project"1530 "cwd": "/Users/me/project"
1467 }1531 }
1532 ],
1533 "source": "claude-code"
1534} }
1535{ "id": 64, "result": { "importId": "8ae96ff3-3425-4f4c-8772-b6fd61502868" } }
1536```
1537
1538The optional top-level `source` import parameter labels the product that
1539produced the selected migration items.
1540
1541The server emits `externalAgentConfig/import/progress` as item types complete,
1542and `externalAgentConfig/import/completed` after all synchronous and background
1543imports finish. These notifications include the same `importId` from the
1544response and `itemTypeResults` with per-type `successes` and `failures`.
1545Completion may arrive immediately after the response or after background remote
1546imports complete.
1547
1548```json
1549{ "method": "externalAgentConfig/import/progress", "params": {
1550 "importId": "8ae96ff3-3425-4f4c-8772-b6fd61502868",
1551 "itemTypeResults": [
1552 {
1553 "itemType": "AGENTS_MD",
1554 "successes": [
1555 { "itemType": "AGENTS_MD", "cwd": "/Users/me/project", "source": null, "target": "/Users/me/project/AGENTS.md" }
1556 ],
1557 "failures": []
1558 }
1559 ]
1560} }
1561{ "method": "externalAgentConfig/import/completed", "params": {
1562 "importId": "8ae96ff3-3425-4f4c-8772-b6fd61502868",
1563 "itemTypeResults": [
1564 {
1565 "itemType": "AGENTS_MD",
1566 "successes": [
1567 { "itemType": "AGENTS_MD", "cwd": "/Users/me/project", "source": null, "target": "/Users/me/project/AGENTS.md" }
1568 ],
1569 "failures": []
1570 }
1468 ]1571 ]
1469} }1572} }
1470{ "id": 64, "result": {} }
1471```1573```
1472 1574
14731575When a request includes plugin imports, the server emits `externalAgentConfig/import/completed` after the import finishes. This notification may arrive immediately after the response or after background remote imports complete.Read prior completed imports:
1576
1577```json
1578{ "method": "externalAgentConfig/import/readHistories", "id": 65 }
1579{ "id": 65, "result": { "data": [
1580 {
1581 "importId": "8ae96ff3-3425-4f4c-8772-b6fd61502868",
1582 "completedAtMs": 1781784000000,
1583 "successes": [
1584 { "itemType": "AGENTS_MD", "cwd": "/Users/me/project", "source": null, "target": "/Users/me/project/AGENTS.md" }
1585 ],
1586 "failures": []
1587 }
1588] } }
1589```
1474 1590
1475Supported `itemType` values are `AGENTS_MD`, `CONFIG`, `SKILLS`, `PLUGINS`,1591Supported `itemType` values are `AGENTS_MD`, `CONFIG`, `SKILLS`, `PLUGINS`,
14761592and `MCP_SERVER_CONFIG`. For `PLUGINS` items, `details.plugins` lists each`MCP_SERVER_CONFIG`, `SUBAGENTS`, `HOOKS`, `COMMANDS`, and `SESSIONS`. For
14771593`marketplaceName` and the `pluginNames` Codex can try to migrate. Detection`PLUGINS` items, `details.plugins` lists each `marketplaceName` and the
14781594returns only items that still have work to do. For example, Codex skips AGENTS`pluginNames` Codex can try to migrate. Detection returns only items that still
14791595migration when `AGENTS.md` already exists and is non-empty, and skill importshave work to do. For example, Codex skips AGENTS migration when `AGENTS.md`
14801596don't overwrite existing skill directories.already exists and is non-empty, and skill imports don't overwrite existing
1597skill directories.
1481 1598
1482When detecting plugins from `.claude/settings.json`, Codex reads configured1599When detecting plugins from `.claude/settings.json`, Codex reads configured
1483marketplace sources from `extraKnownMarketplaces`. If `enabledPlugins` contains1600marketplace sources from `extraKnownMarketplaces`. If `enabledPlugins` contains
1495- **API key (`apikey`)** - the caller supplies an OpenAI API key with `type: "apiKey"`, and Codex stores it for API requests.1612- **API key (`apikey`)** - the caller supplies an OpenAI API key with `type: "apiKey"`, and Codex stores it for API requests.
1496- **ChatGPT managed (`chatgpt`)** - Codex owns the ChatGPT OAuth flow, persists tokens, and refreshes them automatically. Start with `type: "chatgpt"` for the browser flow or `type: "chatgptDeviceCode"` for the device-code flow.1613- **ChatGPT managed (`chatgpt`)** - Codex owns the ChatGPT OAuth flow, persists tokens, and refreshes them automatically. Start with `type: "chatgpt"` for the browser flow or `type: "chatgptDeviceCode"` for the device-code flow.
1497- **ChatGPT external tokens (`chatgptAuthTokens`)** - experimental and intended for host apps that already own the user's ChatGPT auth lifecycle. The host app supplies an `accessToken`, `chatgptAccountId`, and optional `chatgptPlanType` directly, and must refresh the token when asked.1614- **ChatGPT external tokens (`chatgptAuthTokens`)** - experimental and intended for host apps that already own the user's ChatGPT auth lifecycle. The host app supplies an `accessToken`, `chatgptAccountId`, and optional `chatgptPlanType` directly, and must refresh the token when asked.
1615- **Amazon Bedrock** - `account/read` reports Bedrock accounts as `type: "amazonBedrock"` and indicates whether credentials come from a Codex-managed Bedrock API key (`credentialSource: "codexManaged"`) or the external AWS credential chain (`credentialSource: "awsManaged"`). `account/updated.authMode` uses `bedrockApiKey` for Codex-managed Bedrock API keys.
1498 1616
1499### API overview1617### API overview
1500 1618
1503- `account/login/completed` (notify) - emitted when a login attempt finishes (success or error).1621- `account/login/completed` (notify) - emitted when a login attempt finishes (success or error).
1504- `account/login/cancel` - cancel a pending managed ChatGPT login by `loginId`.1622- `account/login/cancel` - cancel a pending managed ChatGPT login by `loginId`.
1505- `account/logout` - sign out; triggers `account/updated`.1623- `account/logout` - sign out; triggers `account/updated`.
15061624- `account/updated` (notify) - emitted whenever auth mode changes (`authMode`: `apikey`, `chatgpt`, `chatgptAuthTokens`, or `null`) and includes `planType` when available.- `account/updated` (notify) - emitted whenever auth mode changes (`authMode`: `apikey`, `chatgpt`, `chatgptAuthTokens`, `agentIdentity`, `personalAccessToken`, `bedrockApiKey`, or `null`) and includes `planType` when available.
1507- `account/chatgptAuthTokens/refresh` (server request) - request fresh externally managed ChatGPT tokens after an authorization error.1625- `account/chatgptAuthTokens/refresh` (server request) - request fresh externally managed ChatGPT tokens after an authorization error.
1508- `account/rateLimits/read` - fetch ChatGPT rate limits.1626- `account/rateLimits/read` - fetch ChatGPT rate limits.
1509- `account/rateLimits/updated` (notify) - emitted whenever a user's ChatGPT rate limits change.1627- `account/rateLimits/updated` (notify) - emitted whenever a user's ChatGPT rate limits change.
1510- `account/sendAddCreditsNudgeEmail` - ask ChatGPT to email a workspace owner about depleted credits or a reached usage limit.1628- `account/sendAddCreditsNudgeEmail` - ask ChatGPT to email a workspace owner about depleted credits or a reached usage limit.
1629- `account/rateLimitResetCredit/consume` - consume one earned rate-limit reset using a caller-provided `idempotencyKey` value.
1630- `account/usage/read` - fetch ChatGPT account token-activity summaries and daily buckets.
1511- `mcpServer/oauthLogin/completed` (notify) - emitted after a `mcpServer/oauth/login` flow finishes; payload includes `{ name, success, error? }`.1631- `mcpServer/oauthLogin/completed` (notify) - emitted after a `mcpServer/oauth/login` flow finishes; payload includes `{ name, success, error? }`.
1512- `mcpServer/startupStatus/updated` (notify) - emitted when a configured MCP server's startup status changes for a loaded thread; payload includes `{ name, status, error }`.1632- `mcpServer/startupStatus/updated` (notify) - emitted when a configured MCP server's startup status changes for a loaded thread; payload includes `{ name, status, error }`.
1513 1633
1536}1656}
1537```1657```
1538 1658
1659```json
1660{
1661 "id": 1,
1662 "result": {
1663 "account": {
1664 "type": "amazonBedrock",
1665 "credentialSource": "codexManaged"
1666 },
1667 "requiresOpenaiAuth": false
1668 }
1669}
1670```
1671
1672```json
1673{
1674 "id": 1,
1675 "result": {
1676 "account": {
1677 "type": "amazonBedrock",
1678 "credentialSource": "awsManaged"
1679 },
1680 "requiresOpenaiAuth": false
1681 }
1682}
1683```
1684
1539```json1685```json
1540{1686{
1541 "id": 1,1687 "id": 1,
1554 1700
1555- `refreshToken` (boolean): set `true` to force a token refresh in managed ChatGPT mode. In external token mode (`chatgptAuthTokens`), app-server ignores this flag.1701- `refreshToken` (boolean): set `true` to force a token refresh in managed ChatGPT mode. In external token mode (`chatgptAuthTokens`), app-server ignores this flag.
1556- `requiresOpenaiAuth` reflects the active provider; when `false`, Codex can run without OpenAI credentials.1702- `requiresOpenaiAuth` reflects the active provider; when `false`, Codex can run without OpenAI credentials.
1703- Amazon Bedrock reports `credentialSource: "codexManaged"` when it uses a
1704 Bedrock API key managed by Codex. It reports `credentialSource: "awsManaged"`
1705 for the external AWS credential path. This identifies the selected credential
1706 source; it doesn't validate that the AWS credential chain can resolve
1707 credentials.
1557 1708
1558### 2) Log in with an API key1709### 2) Log in with an API key
1559 1710
1764 "secondary": null,1915 "secondary": null,
1765 "rateLimitReachedType": null1916 "rateLimitReachedType": null
1766 }1917 }
17671918 } },
1919 "rateLimitResetCredits": { "availableCount": 2 }
1768} }1920} }
1769{ "method": "account/rateLimits/updated", "params": {1921{ "method": "account/rateLimits/updated", "params": {
1770 "rateLimits": {1922 "rateLimits": {
1786- `planType` is included when the server returns the ChatGPT plan associated with a bucket.1938- `planType` is included when the server returns the ChatGPT plan associated with a bucket.
1787- `credits` is included when the server returns remaining workspace credit details.1939- `credits` is included when the server returns remaining workspace credit details.
1788- `rateLimitReachedType` identifies the server-classified limit state when one has been reached.1940- `rateLimitReachedType` identifies the server-classified limit state when one has been reached.
1941- `rateLimitResetCredits` contains the available earned-reset count when the service provides it. Fetch `account/rateLimits/read` after consuming a reset.
1942
1943### 7) Token usage (ChatGPT)
1944
1945Use `account/usage/read` to fetch ChatGPT token-activity summary fields and
1946optional daily buckets.
1947
1948```json
1949{ "method": "account/usage/read", "id": 7 }
1950{ "id": 7, "result": {
1951 "summary": {
1952 "lifetimeTokens": 1234567,
1953 "peakDailyTokens": 45678,
1954 "longestRunningTurnSec": 540,
1955 "currentStreakDays": 8,
1956 "longestStreakDays": 14
1957 },
1958 "dailyUsageBuckets": [
1959 { "startDate": "2026-06-18", "tokens": 12345 }
1960 ]
1961} }
1962```
1963
1964Field notes:
1965
1966- `summary` values may be `null` when the service hasn't returned that metric.
1967- `dailyUsageBuckets` may be `null`; when present, each bucket includes `startDate` and `tokens`.
1968- The endpoint requires authentication backed by Codex services. ChatGPT,
1969 external ChatGPT tokens, agent identity, and personal access token auth work;
1970 API-key-only and Bedrock auth don't.
1971
1972### 8) Earned rate-limit resets (ChatGPT)
1973
1974Use `account/rateLimitResetCredit/consume` to consume one earned reset.
1975
1976```json
1977{ "method": "account/rateLimitResetCredit/consume", "id": 8, "params": { "idempotencyKey": "8ae96ff3-3425-4f4c-8772-b6fd61502868" } }
1978{ "id": 8, "result": { "outcome": "reset" } }
1979```
1980
1981Field notes:
1982
1983- `idempotencyKey` must be non-empty. Use a UUID for each logical redemption attempt and reuse the same value when retrying that attempt.
1984- `reset` means a credit was consumed.
1985- `alreadyRedeemed` means the same redemption completed previously. Treat it as an idempotent success and refresh account limits.
1986- `nothingToReset` means there is no eligible rate-limit window to reset.
1987- `noCredit` means the account has no earned reset credits available.
1988- Fetch `account/rateLimits/read` after consuming a reset instead of inferring updated windows from this response.
1789 1989
17901990### 7) Notify a workspace owner about a limit### 9) Notify a workspace owner about a limit
1791 1991
1792Use `account/sendAddCreditsNudgeEmail` to ask ChatGPT to email a workspace owner when credits are depleted or a usage limit has been reached.1992Use `account/sendAddCreditsNudgeEmail` to ask ChatGPT to email a workspace owner when credits are depleted or a usage limit has been reached.
1793 1993
1794```json1994```json
17951995{ "method": "account/sendAddCreditsNudgeEmail", "id": 7, "params": { "creditType": "credits" } }{ "method": "account/sendAddCreditsNudgeEmail", "id": 9, "params": { "creditType": "credits" } }
17961996{ "id": 7, "result": { "status": "sent" } }{ "id": 9, "result": { "status": "sent" } }
1797```1997```
1798 1998
1799Use `creditType: "credits"` when workspace credits are depleted, or `creditType: "usage_limit"` when the workspace usage limit has been reached. If the owner was already notified recently, the response status is `cooldown_active`.1999Use `creditType: "credits"` when workspace credits are depleted, or `creditType: "usage_limit"` when the workspace usage limit has been reached. If the owner was already notified recently, the response status is `cooldown_active`.