Codex CLI (App Server)
The ai-sdk-provider-codex-app-server community provider enables using OpenAI's GPT-5 series models through the Codex CLI app-server mode. Unlike the standard Codex CLI provider, it supports mid-execution message injection and persistent threads.
Key Features
- Mid-execution injection: Send additional instructions while the agent is working
- Persistent threads: Maintain conversation context across multiple calls
- Session control: Interrupt running turns, inject messages at checkpoints
- Tool streaming: Real-time visibility into command executions and file changes
Version Compatibility
| Provider Version | AI SDK Version | Status |
|---|---|---|
| 1.x | v6 | Stable |
Setup
$ pnpm add ai-sdk-provider-codex-app-server
$ npm install ai-sdk-provider-codex-app-server
$ yarn add ai-sdk-provider-codex-app-server
$ bun add ai-sdk-provider-codex-app-server
Provider Instance
Import the default provider instance:
Mid-Execution Injection
The killer feature of this provider is the ability to inject messages while the agent is actively working:
Session API
The session object provides control over active turns:
Model Discovery
Discover available models and their capabilities:
Settings
Thread Modes
- persistent (default): Reuses the same thread across calls, maintaining context
- stateless: Creates a fresh thread for each call
Per-Call Overrides
Override settings per call using providerOptions:
Model Capabilities
| Model | Image Input | Object Generation | Tool Streaming | Mid-Execution |
|---|---|---|---|---|
gpt-5.3-codex | ||||
gpt-5.2-codex | ||||
gpt-5.1-codex-max | ||||
gpt-5.1-codex-mini |
Comparison with Codex CLI Provider
| Feature | Codex CLI Provider | Codex App Server |
|---|---|---|
| Mid-execution inject | ||
| Persistent threads | ||
| Session control | ||
| Tool streaming | ||
| One-shot execution |
Use the Codex CLI provider for simple one-shot tasks. Use the Codex App Server provider when you need human-in-the-loop workflows, real-time course correction, or collaborative coding.
Requirements
- Node.js 22 or higher
- Codex CLI installed globally (v0.60.0+ recommended)
- ChatGPT Plus/Pro subscription or OpenAI API key
For more details, see the provider documentation.