-
Notifications
You must be signed in to change notification settings - Fork 5k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
What feature would you like to see?
Proposal:
Introduce a Codex SDK (TypeScript and Python) that programmatically drives the existing codex CLI in a headless, JSON-event-stream mode. The SDK would expose the same tools, permissions, and MCP capabilities as the CLI, plus structured streaming for integration with IDEs, agents, CI/CD, and server apps.
Motivation:
- Make codex a first-class primitive for the community to build codex-powered agents and services, similar to how the Claude Code SDK enables wider ecosystem tooling.
- Unlock a parallel “subscription auth” path using ChatGPT subscriptions (like @ruvnet/claude-flow leverages Claude Code), alongside API-key auth.
- Enable programmatic embedding for IDEs, bots, CI/CD, agent orchestration, and enterprise governance.
Goals:
- Provide a stable SDK (TS + Python) that:
- Spawns and controls codex CLI in headless mode
- Streams structured JSON events (assistant messages, tool calls, permission prompts, results, usage)
- Surfaces the same tool and permission model as CLI
- Supports MCP configuration and project settings
- Supports API key and ChatGPT subscription login
Design Sketch:
- SDK spawns codex CLI, streams JSON events via stdout
- Typed events: session_started, user_message, assistant_message, tool_call, tool_result, permission_request, permission_decision, usage, session_finished
- TypeScript and Python SDKs with async iterator/stream APIs
- 1:1 mapping to CLI flags/options for discoverability
- Auth tracks: API key (metered), ChatGPT subscription, enterprise cloud
- Maintains sandboxing/safety in SDK-driven sessions
Ecosystem Impact:
- Unlocks new integrations (agents, IDEs, CI, enterprise workflows)
- Enables community projects (like @ruvnet/claude-flow for Claude Code)
- Makes codex embeddable and composable for advanced use-cases
Are you interested in implementing this feature?
No
Additional information
This feature is requested by multiple community members and is a common primitive for agentic workflows. Having a codex SDK with headless JSON streaming and dual-mode authentication (API key + ChatGPT subscription) would make codex a true agent platform and close feature parity with Claude Code SDK. See also @ruvnet/claude-flow for a parallel/related community project.
praneybehl, planger, jimobrien, yoqu, MaxnSter and 6 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request