SpyBara
Go Premium

Documentation 2026-11-19 23:02 UTC to 2026-11-20 23:59 UTC

7 files changed +324 −27. View all changes and history on the product overview
2026
Thu 26 23:00 Wed 25 23:02 Tue 24 23:01 Mon 23 23:58 Fri 20 23:59 Thu 19 23:02 Wed 18 22:59 Tue 17 22:59 Mon 16 23:00 Sun 15 23:01 Sat 14 23:01 Fri 13 23:58 Thu 12 22:58 Wed 11 23:00 Tue 10 23:57 Mon 9 23:02 Fri 6 23:02 Thu 5 23:03 Wed 4 23:02 Tue 3 23:57 Mon 2 23:02

codex-sdk.md +87 −0

Details

75For example, `codex.startThread({ threadSource: "ci" })` labels the thread75For example, `codex.startThread({ threadSource: "ci" })` labels the thread

76as `ci`. Resuming a thread preserves its original source.76as `ci`. Resuming a thread preserves its original source.

77 77 

78Set the model and sandbox when creating a thread:

79 

80```typescript

81import { Codex } from "@openai/codex-sdk";

82 

83const codex = new Codex();

84const thread = codex.startThread({

85 model: "gpt-6.1-sol",

86 modelReasoningEffort: "low",

87 sandboxMode: "workspace-write",

88});

89const result = await thread.run(

90 "Make a plan to diagnose and fix the CI failures"

91);

92console.log(result.finalResponse);

93```

94 

95```python

96from openai_codex import Codex, Sandbox

97 

98with Codex() as codex:

99 thread = codex.thread_start(

100 model="gpt-6.1-sol",

101 sandbox=Sandbox.workspace_write,

102 )

103 result = thread.run("Make a plan to diagnose and fix the CI failures")

104 print(result.final_response)

105```

106 

107 

108The TypeScript SDK is asynchronous. Await the result inside your application's async function:

109 

110```typescript

111import { Codex } from "@openai/codex-sdk";

112 

113async function main(): Promise<void> {

114 const codex = new Codex();

115 const thread = codex.startThread();

116 const result = await thread.run("Implement the plan");

117 console.log(result.finalResponse);

118}

119await main();

120```

121 

122```python

123import asyncio

124from openai_codex import AsyncCodex

125 

126 

127async def main() -> None:

128 async with AsyncCodex() as codex:

129 thread = await codex.thread_start(model="gpt-6.1-sol")

130 result = await thread.run("Implement the plan")

131 print(result.final_response)

132 

133 

134asyncio.run(main())

135```

136 

137 

78### Configuration overrides138### Configuration overrides

79 139 

80Pass `config` to set structured Codex configuration. For keys that can't be140Pass `config` to set structured Codex configuration. For keys that can't be


122which must be available to your signed-in account. Otherwise, omit `model` to182which must be available to your signed-in account. Otherwise, omit `model` to

123use your configured default. See [model availability by plan](https://learn.chatgpt.com/docs/pricing#feature-availability).183use your configured default. See [model availability by plan](https://learn.chatgpt.com/docs/pricing#feature-availability).

124 184 

185```typescript

186import { Codex } from "@openai/codex-sdk";

187 

188const codex = new Codex();

189const thread = codex.startThread({

190 model: "gpt-6.1-sol",

191 modelReasoningEffort: "low",

192 sandboxMode: "workspace-write",

193});

194const result = await thread.run(

195 "Make a plan to diagnose and fix the CI failures"

196);

197console.log(result.finalResponse);

198```

199 

125```python200```python

126from openai_codex import Codex, Sandbox201from openai_codex import Codex, Sandbox

127 202 


137 212 

138Use `AsyncCodex` when your application is already asynchronous:213Use `AsyncCodex` when your application is already asynchronous:

139 214 

215```typescript

216import { Codex } from "@openai/codex-sdk";

217 

218async function main(): Promise<void> {

219 const codex = new Codex();

220 const thread = codex.startThread();

221 const result = await thread.run("Implement the plan");

222 console.log(result.finalResponse);

223}

224await main();

225```

226 

140```python227```python

141import asyncio228import asyncio

142from openai_codex import AsyncCodex229from openai_codex import AsyncCodex

Details

716 716 

717Use `notify` to trigger an external program whenever Codex emits supported events (currently only `agent-turn-complete`). This is handy for desktop toasts, chat webhooks, CI updates, or any side-channel alerting that the built-in TUI notifications don't cover.717Use `notify` to trigger an external program whenever Codex emits supported events (currently only `agent-turn-complete`). This is handy for desktop toasts, chat webhooks, CI updates, or any side-channel alerting that the built-in TUI notifications don't cover.

718 718 

719<CodeSampleNote client:load language="python" languages={Object.keys(samples.all.codexConfigAdvanced.notifications())}>

720 

719```toml721```toml

720notify = ["python3", "/path/to/notify.py"]722notify = ["python3", "/path/to/notify.py"]

721```723```

722 724 

723Example `notify.py` (truncated) that reacts to `agent-turn-complete`:725</CodeSampleNote>

726 

727These programs react to `agent-turn-complete` on macOS. Install `terminal-notifier` first.

728 

729<CodeSampleNote client:load language="typescript" languages={Object.keys(samples.all.codexConfigAdvanced.notifications())}>

730 

731For TypeScript, save the source as `notify.ts` and configure `notify = ["node", "--experimental-strip-types", "/path/to/notify.ts"]`.

732 

733</CodeSampleNote>

734 

735```typescript

736import { execFileSync } from "node:child_process";

737 

738const argument = process.argv[2];

739if (!argument)

740 throw new Error("Pass the Codex notification JSON as one argument");

741const notification = JSON.parse(argument);

742if (notification.type === "agent-turn-complete") {

743 execFileSync(

744 "terminal-notifier",

745 [

746 "-title",

747 `Codex: ${notification["last-assistant-message"] ?? "Turn Complete!"}`,

748 "-message",

749 (notification["input-messages"] ?? []).join(" "),

750 "-group",

751 `codex-${notification["thread-id"] ?? ""}`,

752 "-activate",

753 "com.googlecode.iterm2",

754 ],

755 { stdio: "inherit" }

756 );

757}

758```

724 759 

725```python760```python

726#!/usr/bin/env python3761#!/usr/bin/env python3

Details

716 716 

717Use `notify` to trigger an external program whenever Codex emits supported events (currently only `agent-turn-complete`). This is handy for desktop toasts, chat webhooks, CI updates, or any side-channel alerting that the built-in TUI notifications don't cover.717Use `notify` to trigger an external program whenever Codex emits supported events (currently only `agent-turn-complete`). This is handy for desktop toasts, chat webhooks, CI updates, or any side-channel alerting that the built-in TUI notifications don't cover.

718 718 

719<CodeSampleNote client:load language="python" languages={Object.keys(samples.all.codexConfigAdvanced.notifications())}>

720 

719```toml721```toml

720notify = ["python3", "/path/to/notify.py"]722notify = ["python3", "/path/to/notify.py"]

721```723```

722 724 

723Example `notify.py` (truncated) that reacts to `agent-turn-complete`:725</CodeSampleNote>

726 

727These programs react to `agent-turn-complete` on macOS. Install `terminal-notifier` first.

728 

729<CodeSampleNote client:load language="typescript" languages={Object.keys(samples.all.codexConfigAdvanced.notifications())}>

730 

731For TypeScript, save the source as `notify.ts` and configure `notify = ["node", "--experimental-strip-types", "/path/to/notify.ts"]`.

732 

733</CodeSampleNote>

734 

735```typescript

736import { execFileSync } from "node:child_process";

737 

738const argument = process.argv[2];

739if (!argument)

740 throw new Error("Pass the Codex notification JSON as one argument");

741const notification = JSON.parse(argument);

742if (notification.type === "agent-turn-complete") {

743 execFileSync(

744 "terminal-notifier",

745 [

746 "-title",

747 `Codex: ${notification["last-assistant-message"] ?? "Turn Complete!"}`,

748 "-message",

749 (notification["input-messages"] ?? []).join(" "),

750 "-group",

751 `codex-${notification["thread-id"] ?? ""}`,

752 "-activate",

753 "com.googlecode.iterm2",

754 ],

755 { stdio: "inherit" }

756 );

757}

758```

724 759 

725```python760```python

726#!/usr/bin/env python3761#!/usr/bin/env python3

dots.md +2 −16

Details

2 2 

3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 4 

5<OFeatureCanvas>5<DotsFeatureCanvas>

6 6 

7<DotsCharacters7<DotsCharacters

8 client:load8 client:load


10 switchLabel="Choose your dot character"10 switchLabel="Choose your dot character"

11/>11/>

12 12 

13<a id="introducing-o"></a>

14<a id="what-is-o"></a>

15 

16Your dot is an always-on agent that keeps work moving across your tools and projects. You can keep talking to it while it works, and it reaches out with results or decisions that need you.13Your dot is an always-on agent that keeps work moving across your tools and projects. You can keep talking to it while it works, and it reaches out with results or decisions that need you.

17 14 

18New to delegating work to an agent? Start with [Working with agents](https://learn.chatgpt.com/docs/working-with-agents).15New to delegating work to an agent? Start with [Working with agents](https://learn.chatgpt.com/docs/working-with-agents).


25 22 

26See [availability and access](#access) for plan, region, and workspace requirements.23See [availability and access](#access) for plan, region, and workspace requirements.

27 24 

28<a id="meet-your-o"></a>

29 

30## Make it your own25## Make it your own

31 26 

32Create your dot in the ChatGPT mobile app, desktop app, or a desktop browser. On your phone, you can give it a name, customize its appearance, and connect plugins. In the desktop app, you can also connect your computer. See [Getting started](https://learn.chatgpt.com/docs/dots/getting-started#create-your-dot) for setup steps.27Create your dot in the ChatGPT mobile app, desktop app, or a desktop browser. On your phone, you can give it a name, customize its appearance, and connect plugins. In the desktop app, you can also connect your computer. See [Getting started](https://learn.chatgpt.com/docs/dots/getting-started#create-your-dot) for setup steps.


59 54 

60Tell your dot where to send different kinds of updates. For example, ask it to keep routine progress in ChatGPT and bring decisions to you in Slack. Explain which changes need your attention, such as a deadline at risk.55Tell your dot where to send different kinds of updates. For example, ask it to keep routine progress in ChatGPT and bring decisions to you in Slack. Explain which changes need your attention, such as a deadline at risk.

61 56 

62<a id="choose-where-o-can-reach-you"></a>

63<a id="where-to-use-o"></a>

64 

65Open your dot's profile and select **Add** to connect an available contact method. Texting is rolling out in beta to ChatGPT Pro users in the U.S. See how to [set up texting](https://learn.chatgpt.com/docs/dots/channels#texting) with iMessage or RCS on Android. See [Message your dot](https://learn.chatgpt.com/docs/dots/channels) for other ways to reach it.57Open your dot's profile and select **Add** to connect an available contact method. Texting is rolling out in beta to ChatGPT Pro users in the U.S. See how to [set up texting](https://learn.chatgpt.com/docs/dots/channels#texting) with iMessage or RCS on Android. See [Message your dot](https://learn.chatgpt.com/docs/dots/channels) for other ways to reach it.

66 58 

67In Slack, you can DM your dot or mention it in a channel you’ve added it to. By default, it responds to you; you can instruct it to engage with others. Existing permissions and safeguards still apply to what it shares and does. Tell it which channels and events to watch for. Adding it to a channel alone doesn’t start monitoring. See [Message your dot in Slack](https://learn.chatgpt.com/docs/dots/channels#slack) for setup instructions.59In Slack, you can DM your dot or mention it in a channel you’ve added it to. By default, it responds to you; you can instruct it to engage with others. Existing permissions and safeguards still apply to what it shares and does. Tell it which channels and events to watch for. Adding it to a channel alone doesn’t start monitoring. See [Message your dot in Slack](https://learn.chatgpt.com/docs/dots/channels#slack) for setup instructions.

68 60 

69<a id="how-o-works"></a>

70<a id="how-your-dot-works"></a>61<a id="how-your-dot-works"></a>

71 62 

72## How dots work63## How dots work


194| Codex | When you want to build, debug, test, or review software and work directly with code and developer tools. |185| Codex | When you want to build, debug, test, or review software and work directly with code and developer tools. |

195| Your dot | When you want an agent to keep track of an ongoing responsibility, figure out next steps as things change, and follow up between conversations. It can keep you updated in ChatGPT or Slack and delegate tasks to ChatGPT Work or Codex. |186| Your dot | When you want an agent to keep track of an ongoing responsibility, figure out next steps as things change, and follow up between conversations. It can keep you updated in ChatGPT or Slack and delegate tasks to ChatGPT Work or Codex. |

196 187 

197<a id="what-o-can-do"></a>

198<a id="things-to-try-with-o"></a>

199<a id="try-more-with-o"></a>

200<a id="what-could-you-do-with-yours"></a>188<a id="what-could-you-do-with-yours"></a>

201 189 

202## Work with your dot190## Work with your dot

203 191 

204Start with work you regularly need to check or update. Describe the responsibility and share the source material it needs, then review its work and explain what needs to change.192Start with work you regularly need to check or update. Describe the responsibility and share the source material it needs, then review its work and explain what needs to change.

205 193 

206<a id="work-with-o"></a>

207<a id="start-working-together"></a>194<a id="start-working-together"></a>

208<a id="give-o-your-first-task"></a>

209<a id="an-event-youre-organizing"></a>195<a id="an-event-youre-organizing"></a>

210<a id="a-project-youre-working-on"></a>196<a id="a-project-youre-working-on"></a>

211 197 


282| [Computers and apps](https://learn.chatgpt.com/docs/dots/computers-and-apps) | Cloud work, local access, plugins, and website sign-in. |268| [Computers and apps](https://learn.chatgpt.com/docs/dots/computers-and-apps) | Cloud work, local access, plugins, and website sign-in. |

283| [Controls](https://learn.chatgpt.com/docs/dots/controls) | Review activity, manage permissions, and stop work. |269| [Controls](https://learn.chatgpt.com/docs/dots/controls) | Review activity, manage permissions, and stop work. |

284 270 

285</OFeatureCanvas>271</DotsFeatureCanvas>

Details

40 40 

41## Configure the provider41## Configure the provider

42 42 

43In the interactive CLI, run `/config` and open **Sessions** > **Model providers**.43<Tabs

44Choose **Create a custom provider or gateway** and enter the name, base URL,44 id="gateway-provider-setup"

45and, if needed, the name of the environment variable holding the API key.45 param="setup"

46To change an editable provider, open its details and choose **Edit configuration**.46 ariaLabel="Gateway provider setup by client"

47If you can change the default, highlight the provider, press <kbd>Space</kbd>, and47 tabs={[

48start a chat with `/new`.48 { id: "cli", label: "CLI" },

49 { id: "desktop", label: "Desktop" },

50 ]}

51>

52

53 

54 

551. Run `/config` and open **Sessions** > **Model providers**.

56 

57![CLI provider list with Company gateway highlighted and Space available to set the default.](https://developers.openai.com/images/codex/gateways/cli-provider-list.webp)

58 

592. If you don't see your gateway, select **Create a custom provider or gateway**. Enter its **Name** and **Base URL**. If the gateway uses an API key, enter the environment variable name in **API key variable**. Select **Save**.

60 

61![CLI gateway form with Name, Base URL, and API key variable fields.](https://developers.openai.com/images/codex/gateways/cli-add-provider.webp)

62 

633. If your organization lets you change the default, highlight your gateway and press <kbd>Space</kbd>.

644. Start a chat with `/new` and [verify the connection](#verify-the-connection).

65 

66To edit a saved gateway, open its details and select **Edit configuration** if available.

49 67 

50To set up a gateway during CLI sign-in, start `codex --enable gateway_setup_wizard`68To set up a gateway during CLI sign-in, start `codex --enable gateway_setup_wizard`

51and choose **Sign in another way** > **Use a custom provider or gateway**.69and choose **Sign in another way** > **Use a custom provider or gateway**.


53using the embedded app server when the default provider is OpenAI, API-key71using the embedded app server when the default provider is OpenAI, API-key

54sign-in is allowed, and no managed setting or launch override selects a provider.72sign-in is allowed, and no managed setting or launch override selects a provider.

55 73 

74

75 

76

77 

78 

79Open **Settings** and select **Model Providers**. If your gateway is listed, open its menu and select **Switch provider** if available. Skip this step if the gateway is already your current provider. Then start a new chat and [verify the connection](#verify-the-connection).

80 

81If you don't see your gateway and you can add providers, follow these steps.

82 

831. On **Model Providers & Gateways**, select **Add** > **Gateway or custom provider**.

84 

85![Model Providers & Gateways with the Add menu open and Gateway or custom provider at the bottom.](https://developers.openai.com/images/codex/gateways/desktop-model-providers.webp)

86 

872. Enter a **Name** for the gateway and the **Base URL** from your administrator, including the API path.

883. Under **Authentication**, choose the method your administrator specified. For **Environment variable**, enter the variable name (for example, `COMPANY_GATEWAY_API_KEY`) in **API key environment variable**.

894. To use the gateway for new chats, turn on **Set as current provider** if available. Select **Save**.

90 

91![Completed gateway form with an example base URL, environment variable authentication, and Set as current provider enabled.](https://developers.openai.com/images/codex/gateways/desktop-add-provider.webp)

92 

935. Start a new chat with the gateway and [verify the connection](#verify-the-connection).

94 

95

96 

97</Tabs>

98 

56For manual setup or additional authentication settings, open99For manual setup or additional authentication settings, open

57`config.toml` at `~/.codex/config.toml` on macOS or Linux, or100`config.toml` at `~/.codex/config.toml` on macOS or Linux, or

58`%USERPROFILE%\.codex\config.toml` on Windows.101`%USERPROFILE%\.codex\config.toml` on Windows.


397 440 

398With ChatGPT sign-in, start the client and sign in to the workspace that provides the managed configuration. If you use native gateway OAuth, also complete your organization's gateway sign-in when prompted. Then [verify the connection](#verify-the-connection).441With ChatGPT sign-in, start the client and sign in to the workspace that provides the managed configuration. If you use native gateway OAuth, also complete your organization's gateway sign-in when prompted. Then [verify the connection](#verify-the-connection).

399 442 

400For a locally configured provider, follow the instructions for your client.443If you edited `config.toml` manually, follow the instructions for your client.

401 444 

402### Configure the CLI445### Configure the CLI

403 446 


437 480 

438Use the provider ID and model alias in your administrator's handoff. The provider identifies the configured connection; the model alias identifies a model routed through that connection. ChatGPT sign-in and gateway authentication control access and may both be required.481Use the provider ID and model alias in your administrator's handoff. The provider identifies the configured connection; the model alias identifies a model routed through that connection. ChatGPT sign-in and gateway authentication control access and may both be required.

439 482 

440Restart the client after changing the configuration. In the CLI, start `codex`483In the CLI, use `/status` to inspect the active model and provider. In the desktop app,

441and use `/status` to inspect the active model and provider. In the desktop app,

442check the selected model and configuration.484check the selected model and configuration.

443 485 

444Send this prompt in a new task:486Send this prompt in a new task:

Details

1199 1199 

1200</CodeSampleNote>1200</CodeSampleNote>

1201 1201 

1202<CodeSampleNote client:load language="typescript" languages={Object.keys(samples.all.codexSecurityCookbook.installAndEnforceAdministratorManagedHooks())}>

1203 

1204Save the TypeScript version as `pre_tool_use_policy.ts`. Set the hook `command` to `/absolute/path/to/node --experimental-strip-types /etc/codex/hooks/pre_tool_use_policy.ts`, replacing the interpreter path with the path to your installed Node executable. In the installation commands below, replace both `pre_tool_use_policy.py` paths with `pre_tool_use_policy.ts`; retain root ownership and permissions. The hook uses only Node's standard library.

1205 

1206</CodeSampleNote>

1207 

1202It blocks only the synthetic marker; replace it with a reviewed organization-specific policy before relying on it. Confirm that the configured executable and any required interpreter exist on the target. The command must match the selected language:1208It blocks only the synthetic marker; replace it with a reviewed organization-specific policy before relying on it. Confirm that the configured executable and any required interpreter exist on the target. The command must match the selected language:

1203 1209 

1204Define a managed hook policy1210Define a managed hook policy

1205 1211 

1212```typescript

1213import { readFileSync } from "node:fs";

1214 

1215try {

1216 const event = JSON.parse(readFileSync(0, "utf8")) as {

1217 tool_input?: { command?: unknown };

1218 };

1219 const command = event.tool_input?.command ?? "";

1220 if (typeof command !== "string") throw new Error("Invalid command");

1221 if (command.includes("CODEX_HOOK_TEST_DENY")) {

1222 console.error("Synthetic test command blocked by managed hook.");

1223 process.exit(2);

1224 }

1225} catch {

1226 console.error("Invalid hook event.");

1227 process.exit(2);

1228}

1229```

1230 

1206```python1231```python

1207import json1232import json

1208import sys1233import sys

sdk.md +87 −0

Details

75For example, `codex.startThread({ threadSource: "ci" })` labels the thread75For example, `codex.startThread({ threadSource: "ci" })` labels the thread

76as `ci`. Resuming a thread preserves its original source.76as `ci`. Resuming a thread preserves its original source.

77 77 

78Set the model and sandbox when creating a thread:

79 

80```typescript

81import { Codex } from "@openai/codex-sdk";

82 

83const codex = new Codex();

84const thread = codex.startThread({

85 model: "gpt-6.1-sol",

86 modelReasoningEffort: "low",

87 sandboxMode: "workspace-write",

88});

89const result = await thread.run(

90 "Make a plan to diagnose and fix the CI failures"

91);

92console.log(result.finalResponse);

93```

94 

95```python

96from openai_codex import Codex, Sandbox

97 

98with Codex() as codex:

99 thread = codex.thread_start(

100 model="gpt-6.1-sol",

101 sandbox=Sandbox.workspace_write,

102 )

103 result = thread.run("Make a plan to diagnose and fix the CI failures")

104 print(result.final_response)

105```

106 

107 

108The TypeScript SDK is asynchronous. Await the result inside your application's async function:

109 

110```typescript

111import { Codex } from "@openai/codex-sdk";

112 

113async function main(): Promise<void> {

114 const codex = new Codex();

115 const thread = codex.startThread();

116 const result = await thread.run("Implement the plan");

117 console.log(result.finalResponse);

118}

119await main();

120```

121 

122```python

123import asyncio

124from openai_codex import AsyncCodex

125 

126 

127async def main() -> None:

128 async with AsyncCodex() as codex:

129 thread = await codex.thread_start(model="gpt-6.1-sol")

130 result = await thread.run("Implement the plan")

131 print(result.final_response)

132 

133 

134asyncio.run(main())

135```

136 

137 

78### Configuration overrides138### Configuration overrides

79 139 

80Pass `config` to set structured Codex configuration. For keys that can't be140Pass `config` to set structured Codex configuration. For keys that can't be


122which must be available to your signed-in account. Otherwise, omit `model` to182which must be available to your signed-in account. Otherwise, omit `model` to

123use your configured default. See [model availability by plan](https://learn.chatgpt.com/docs/pricing#feature-availability).183use your configured default. See [model availability by plan](https://learn.chatgpt.com/docs/pricing#feature-availability).

124 184 

185```typescript

186import { Codex } from "@openai/codex-sdk";

187 

188const codex = new Codex();

189const thread = codex.startThread({

190 model: "gpt-6.1-sol",

191 modelReasoningEffort: "low",

192 sandboxMode: "workspace-write",

193});

194const result = await thread.run(

195 "Make a plan to diagnose and fix the CI failures"

196);

197console.log(result.finalResponse);

198```

199 

125```python200```python

126from openai_codex import Codex, Sandbox201from openai_codex import Codex, Sandbox

127 202 


137 212 

138Use `AsyncCodex` when your application is already asynchronous:213Use `AsyncCodex` when your application is already asynchronous:

139 214 

215```typescript

216import { Codex } from "@openai/codex-sdk";

217 

218async function main(): Promise<void> {

219 const codex = new Codex();

220 const thread = codex.startThread();

221 const result = await thread.run("Implement the plan");

222 console.log(result.finalResponse);

223}

224await main();

225```

226 

140```python227```python

141import asyncio228import asyncio

142from openai_codex import AsyncCodex229from openai_codex import AsyncCodex