Skip to content

Codex SDKBuild directly on Codex.

A typed app-server client and Node.js transports for streaming conversations, approvals, and tools in your own application.

Codex SDK

A conversation on one screen ​

The client finds Codex, starts the app-server, and streams the reply. Everything else, from state to interface, stays yours.

ts
import { CodexAppServerClient, CodexAppServerStdioTransport } from '@korus-dev/codex-sdk';

const client = new CodexAppServerClient(new CodexAppServerStdioTransport());
client.onNotification('item/agentMessage/delta', ({ params }) => {
  process.stdout.write(params.delta);
});

await client.start();
try {
  await client.initialize({
    clientInfo: { name: 'hello_codex', title: null, version: '1.0.0' },
    capabilities: null,
  });
  const { thread } = await client.request('thread/start', {});
  const finished = new Promise<void>(resolve => {
    client.onNotification('turn/completed', () => resolve());
  });
  await client.request('turn/start', {
    threadId: thread.id,
    input: [{ type: 'text', text: 'Say hello!', text_elements: [] }],
  });
  await finished;
} finally {
  await client.close();
}

Follow the full walkthrough β†’

Start from what you are building ​

If you want to…Read
Run your first turnFirst conversation
Render output as it streamsStream events
Choose how to reach CodexConnect to Codex
Answer approvals and expose your own toolsApprovals and tools
Load history and resume workThreads and turns
Survive crashes and dropped connectionsReconnect and recover
Sign users inAuthentication
Look up a method or typeProtocol inventory

Where it fits ​

One layer of three

Codex SDK is the raw protocol layer: typed JSON-RPC, transports, and executable discovery. multi-agent-sdk adds a provider-neutral agent API, and agent-ui-sdk adds Vue conversation components and Electron integration.

This is an independently maintained SDK, separate from OpenAI's official SDKs. The generated protocol targets codex-cli 0.167.0; the running server determines which features are available.

Released under the Apache License 2.0.