Skip to content

Add OpenAI Codex CLI as third engine #4

Closed

Description

@dominicnunez

Summary

Add Codex CLI (@openai/codex) as a third engine option alongside Claude and OpenCode.

Why

  • Codex is included with ChatGPT Plus/Pro plans (no separate API billing)
  • Written in Rust, fast startup
  • Has both CLI headless mode and TypeScript SDK

Codex CLI Headless Mode

codex exec "task"                    # non-interactive
codex exec --json "task"             # JSONL streaming output
codex exec resume --last "continue"  # resume sessions

TypeScript SDK (preferred approach)

import { Codex } from "@openai/codex-sdk";
const codex = new Codex();
const thread = codex.startThread();
const result = await thread.run("task");

npm i @openai/codex-sdk — native async, no subprocess management.

Key Details

  • Auth: ChatGPT login or OPENAI_API_KEY env var
  • Default model: gpt-5.3-codex
  • Approval modes: auto (default), read-only, full-access
  • Config: ~/.codex/config.toml
  • Sessions persist and can resume via thread ID
  • Built-in multi-agent support

Implementation Plan

  1. Add CodexEngine class (prefer SDK over shelling out)
  2. Config support: [engine] type = codex + [models] codex = gpt-5.3-codex
  3. CLI flag: sfk --codex
  4. Auth: read OPENAI_API_KEY from env or delegate to codex login flow
  5. Map sfk progress tracking to Codex thread model

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions