app-server.md +30 −20
21Requests include `method`, `params`, and `id`:21Requests include `method`, `params`, and `id`:
22 22
23```json23```json
2424{ "method": "thread/start", "id": 10, "params": { "model": "gpt-5.1-codex" } }{ "method": "thread/start", "id": 10, "params": { "model": "gpt-5.4" } }
25```25```
26 26
27Responses echo the `id` with either `result` or `error`:27Responses echo the `id` with either `result` or `error`:
99 },99 },
100});100});
101send({ method: "initialized", params: {} });101send({ method: "initialized", params: {} });
102102send({ method: "thread/start", id: 1, params: { model: "gpt-5.1-codex" } });send({ method: "thread/start", id: 1, params: { model: "gpt-5.4" } });
103```103```
104 104
105## Core primitives105## Core primitives
123 123
124Clients must send a single `initialize` request per transport connection before invoking any other method on that connection, then acknowledge with an `initialized` notification. Requests sent before initialization receive a `Not initialized` error, and repeated `initialize` calls on the same connection return `Already initialized`.124Clients must send a single `initialize` request per transport connection before invoking any other method on that connection, then acknowledge with an `initialized` notification. Requests sent before initialization receive a `Not initialized` error, and repeated `initialize` calls on the same connection return `Already initialized`.
125 125
126126The server returns the user agent string it will present to upstream services. Set `clientInfo` to identify your integration.The server returns the user agent string it will present to upstream services plus `platformFamily` and `platformOs` values that describe the runtime target. Set `clientInfo` to identify your integration.
127 127
128`initialize.params.capabilities` also supports per-connection notification opt-out via `optOutNotificationMethods`, which is a list of exact method names to suppress for that connection. Matching is exact (no wildcards/prefixes). Unknown method names are accepted and ignored.128`initialize.params.capabilities` also supports per-connection notification opt-out via `optOutNotificationMethods`, which is a list of exact method names to suppress for that connection. Matching is exact (no wildcards/prefixes). Unknown method names are accepted and ignored.
129 129
159 },159 },
160 "capabilities": {160 "capabilities": {
161 "experimentalApi": true,161 "experimentalApi": true,
162162 "optOutNotificationMethods": [ "optOutNotificationMethods": ["thread/started", "item/agentMessage/delta"]
163 "codex/event/session_configured",
164 "item/agentMessage/delta"
165 ]
166 }163 }
167 }164 }
168}165}
204- `thread/read` - read a stored thread by id without resuming it; set `includeTurns` to return full turn history. Returned `thread` objects include runtime `status`.201- `thread/read` - read a stored thread by id without resuming it; set `includeTurns` to return full turn history. Returned `thread` objects include runtime `status`.
205- `thread/list` - page through stored thread logs; supports cursor-based pagination plus `modelProviders`, `sourceKinds`, `archived`, and `cwd` filters. Returned `thread` objects include runtime `status`.202- `thread/list` - page through stored thread logs; supports cursor-based pagination plus `modelProviders`, `sourceKinds`, `archived`, and `cwd` filters. Returned `thread` objects include runtime `status`.
206- `thread/loaded/list` - list the thread ids currently loaded in memory.203- `thread/loaded/list` - list the thread ids currently loaded in memory.
204- `thread/name/set` - set or update a thread's user-facing name for a loaded thread or a persisted rollout; emits `thread/name/updated`.
207- `thread/archive` - move a thread's log file into the archived directory; returns `{}` on success and emits `thread/archived`.205- `thread/archive` - move a thread's log file into the archived directory; returns `{}` on success and emits `thread/archived`.
208- `thread/unsubscribe` - unsubscribe this connection from thread turn/item events. If this was the last subscriber, the server unloads the thread and emits `thread/closed`.206- `thread/unsubscribe` - unsubscribe this connection from thread turn/item events. If this was the last subscriber, the server unloads the thread and emits `thread/closed`.
209- `thread/unarchive` - restore an archived thread rollout back into the active sessions directory; returns the restored `thread` and emits `thread/unarchived`.207- `thread/unarchive` - restore an archived thread rollout back into the active sessions directory; returns the restored `thread` and emits `thread/unarchived`.
215- `turn/interrupt` - request cancellation of an in-flight turn; success is `{}` and the turn ends with `status: "interrupted"`.213- `turn/interrupt` - request cancellation of an in-flight turn; success is `{}` and the turn ends with `status: "interrupted"`.
216- `review/start` - kick off the Codex reviewer for a thread; emits `enteredReviewMode` and `exitedReviewMode` items.214- `review/start` - kick off the Codex reviewer for a thread; emits `enteredReviewMode` and `exitedReviewMode` items.
217- `command/exec` - run a single command under the server sandbox without starting a thread/turn.215- `command/exec` - run a single command under the server sandbox without starting a thread/turn.
216- `command/exec/write` - write stdin bytes to a running `command/exec` session or close stdin.
217- `command/exec/resize` - resize a running PTY-backed `command/exec` session.
218- `command/exec/terminate` - terminate a running `command/exec` session.
218- `model/list` - list available models (set `includeHidden: true` to include entries with `hidden: true`) with effort options, optional `upgrade`, and `inputModalities`.219- `model/list` - list available models (set `includeHidden: true` to include entries with `hidden: true`) with effort options, optional `upgrade`, and `inputModalities`.
219- `experimentalFeature/list` - list feature flags with lifecycle stage metadata and cursor pagination.220- `experimentalFeature/list` - list feature flags with lifecycle stage metadata and cursor pagination.
220- `collaborationMode/list` - list collaboration mode presets (experimental, no pagination).221- `collaborationMode/list` - list collaboration mode presets (experimental, no pagination).
221- `skills/list` - list skills for one or more `cwd` values (supports `forceReload` and optional `perCwdExtraUserRoots`).222- `skills/list` - list skills for one or more `cwd` values (supports `forceReload` and optional `perCwdExtraUserRoots`).
223- `plugin/list` - list discovered plugin marketplaces and plugin state, including install/auth policy metadata.
224- `plugin/read` - read one plugin by marketplace path and plugin name, including bundled skills, apps, and MCP server names.
222- `app/list` - list available apps (connectors) with pagination plus accessibility/enabled metadata.225- `app/list` - list available apps (connectors) with pagination plus accessibility/enabled metadata.
223- `skills/config/write` - enable or disable skills by path.226- `skills/config/write` - enable or disable skills by path.
224- `mcpServer/oauth/login` - start an OAuth login for a configured MCP server; returns an authorization URL and emits `mcpServer/oauthLogin/completed` on completion.227- `mcpServer/oauth/login` - start an OAuth login for a configured MCP server; returns an authorization URL and emits `mcpServer/oauthLogin/completed` on completion.
232- `externalAgentConfig/import` - apply selected external-agent migration items by passing explicit `migrationItems` with `cwd` (`null` for home).235- `externalAgentConfig/import` - apply selected external-agent migration items by passing explicit `migrationItems` with `cwd` (`null` for home).
233- `config/value/write` - write a single configuration key/value to the user's `config.toml` on disk.236- `config/value/write` - write a single configuration key/value to the user's `config.toml` on disk.
234- `config/batchWrite` - apply configuration edits atomically to the user's `config.toml` on disk.237- `config/batchWrite` - apply configuration edits atomically to the user's `config.toml` on disk.
235238- `configRequirements/read` - fetch requirements from `requirements.toml` and/or MDM, including allow-lists and residency requirements (or `null` if you haven’t set any up).- `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).
239- `fs/readFile`, `fs/writeFile`, `fs/createDirectory`, `fs/getMetadata`, `fs/readDirectory`, `fs/remove`, and `fs/copy` - operate on absolute filesystem paths through the app-server v2 filesystem API.
236 240
237## Models241## Models
238 242
244{ "method": "model/list", "id": 6, "params": { "limit": 20, "includeHidden": false } }248{ "method": "model/list", "id": 6, "params": { "limit": 20, "includeHidden": false } }
245{ "id": 6, "result": {249{ "id": 6, "result": {
246 "data": [{250 "data": [{
247251 "id": "gpt-5.2-codex", "id": "gpt-5.4",
248252 "model": "gpt-5.2-codex", "model": "gpt-5.4",
249253 "upgrade": "gpt-5.3-codex", "displayName": "GPT-5.4",
250 "displayName": "GPT-5.2 Codex",
251 "hidden": false,254 "hidden": false,
252 "defaultReasoningEffort": "medium",255 "defaultReasoningEffort": "medium",
253256 "reasoningEffort": [{ "supportedReasoningEfforts": [{
254257 "effort": "low", "reasoningEffort": "low",
255 "description": "Lower latency"258 "description": "Lower latency"
256 }],259 }],
257 "inputModalities": ["text", "image"],260 "inputModalities": ["text", "image"],
264 267
265Each model entry can include:268Each model entry can include:
266 269
267270- `reasoningEffort` - supported effort options for the model.- `supportedReasoningEfforts` - supported effort options for the model.
268- `defaultReasoningEffort` - suggested default effort for clients.271- `defaultReasoningEffort` - suggested default effort for clients.
269- `upgrade` - optional recommended upgrade model id for migration prompts in clients.272- `upgrade` - optional recommended upgrade model id for migration prompts in clients.
273- `upgradeInfo` - optional upgrade metadata for migration prompts in clients.
270- `hidden` - whether the model is hidden from the default picker list.274- `hidden` - whether the model is hidden from the default picker list.
271- `inputModalities` - supported input types for the model (for example `text`, `image`).275- `inputModalities` - supported input types for the model (for example `text`, `image`).
272- `supportsPersonality` - whether the model supports personality-specific instructions such as `/personality`.276- `supportsPersonality` - whether the model supports personality-specific instructions such as `/personality`.
315 319
316```json320```json
317{ "method": "thread/start", "id": 10, "params": {321{ "method": "thread/start", "id": 10, "params": {
318322 "model": "gpt-5.1-codex", "model": "gpt-5.4",
319 "cwd": "/Users/me/project",323 "cwd": "/Users/me/project",
320 "approvalPolicy": "never",324 "approvalPolicy": "never",
321 "sandbox": "workspaceWrite",325 "sandbox": "workspaceWrite",
570 "writableRoots": ["/Users/me/project"],574 "writableRoots": ["/Users/me/project"],
571 "networkAccess": true575 "networkAccess": true
572 },576 },
573577 "model": "gpt-5.1-codex", "model": "gpt-5.4",
574 "effort": "medium",578 "effort": "medium",
575 "summary": "concise",579 "summary": "concise",
576 "personality": "friendly",580 "personality": "friendly",
713- The server rejects empty `command` arrays.717- The server rejects empty `command` arrays.
714- `sandboxPolicy` accepts the same shape used by `turn/start` (for example, `dangerFullAccess`, `readOnly`, `workspaceWrite`, `externalSandbox`).718- `sandboxPolicy` accepts the same shape used by `turn/start` (for example, `dangerFullAccess`, `readOnly`, `workspaceWrite`, `externalSandbox`).
715- When omitted, `timeoutMs` falls back to the server default.719- When omitted, `timeoutMs` falls back to the server default.
720- Set `tty: true` for PTY-backed sessions, and use `processId` when you plan to follow up with `command/exec/write`, `command/exec/resize`, or `command/exec/terminate`.
721- Set `streamStdoutStderr: true` to receive `command/exec/outputDelta` notifications while the command is running.
716 722
717### Read admin requirements (`configRequirements/read`)723### Read admin requirements (`configRequirements/read`)
718 724
724 "requirements": {730 "requirements": {
725 "allowedApprovalPolicies": ["onRequest", "unlessTrusted"],731 "allowedApprovalPolicies": ["onRequest", "unlessTrusted"],
726 "allowedSandboxModes": ["readOnly", "workspaceWrite"],732 "allowedSandboxModes": ["readOnly", "workspaceWrite"],
733 "featureRequirements": {
734 "personality": true,
735 "unified_exec": false
736 },
727 "network": {737 "network": {
728 "enabled": true,738 "enabled": true,
729 "allowedDomains": ["api.openai.com"],739 "allowedDomains": ["api.openai.com"],
734} }744} }
735```745```
736 746
737747`result.requirements` is `null` when no requirements are configured. When present, the optional `network` object carries managed proxy constraints (domain rules, proxy settings, and unix-socket policy).`result.requirements` is `null` when no requirements are configured. See the docs on [`requirements.toml`](https://developers.openai.com/codex/config-reference#requirementstoml) for details on supported keys and values.
738 748
739### Windows sandbox setup (`windowsSandbox/setupStart`)749### Windows sandbox setup (`windowsSandbox/setupStart`)
740 750
769 779
770- Exact-match only: `item/agentMessage/delta` suppresses only that method.780- Exact-match only: `item/agentMessage/delta` suppresses only that method.
771- Unknown method names are ignored.781- Unknown method names are ignored.
772782- Applies to both legacy (`codex/event/*`) and v2 (`thread/*`, `turn/*`, `item/*`, etc.) notifications.- Applies to the current `thread/*`, `turn/*`, `item/*`, and related v2 notifications.
773- Doesn't apply to requests, responses, or errors.783- Doesn't apply to requests, responses, or errors.
774 784
775### Fuzzy file search events (experimental)785### Fuzzy file search events (experimental)
868 878
869When `networkApprovalContext` is present, the prompt is for managed network access (not a general shell-command approval). The current v2 schema exposes the target `host` and `protocol`; clients should render a network-specific prompt and not rely on `command` being a user-meaningful shell command preview.879When `networkApprovalContext` is present, the prompt is for managed network access (not a general shell-command approval). The current v2 schema exposes the target `host` and `protocol`; clients should render a network-specific prompt and not rely on `command` being a user-meaningful shell command preview.
870 880
871881Codex deduplicates concurrent network approval prompts by destination (`host`, protocol, and port). The app-server may therefore send one prompt that unblocks multiple queued requests to the same destination, while different ports on the same host are treated separately.Codex groups concurrent network approval prompts by destination (`host`, protocol, and port). The app-server may therefore send one prompt that unblocks multiple queued requests to the same destination, while different ports on the same host are treated separately.
872 882
873### File change approvals883### File change approvals
874 884