feat: add OpenAI Codex CLI provider (#6263)
Signed-off-by: RamXX <ramxx@ramirosalas.com> Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
@@ -49,6 +49,7 @@ goose also supports special "pass-through" providers that work with existing CLI
|
||||
| Provider | Description | Requirements |
|
||||
|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [Claude Code](https://www.anthropic.com/claude-code) (`claude-code`) | Uses Anthropic's Claude CLI tool with your Claude Code subscription. Provides access to Claude with 200K context limit. | Claude CLI installed and authenticated, active Claude Code subscription |
|
||||
| [OpenAI Codex](https://developers.openai.com/codex/cli) (`codex`) | Uses OpenAI's Codex CLI tool with your ChatGPT Plus/Pro subscription. Provides access to GPT-5 models with up to 400K context limit. | Codex CLI installed and authenticated, active ChatGPT Plus/Pro subscription |
|
||||
| [Cursor Agent](https://docs.cursor.com/en/cli/overview) (`cursor-agent`) | Uses Cursor's AI CLI tool with your Cursor subscription. Provides access to GPT-5, Claude 4, and other models through the cursor-agent command-line interface. | cursor-agent CLI installed and authenticated |
|
||||
| [Gemini CLI](https://ai.google.dev/gemini-api/docs) (`gemini-cli`) | Uses Google's Gemini CLI tool with your Google AI subscription. Provides access to Gemini with 1M context limit. | Gemini CLI installed and authenticated |
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
sidebar_position: 45
|
||||
title: CLI Providers
|
||||
sidebar_label: CLI Providers
|
||||
description: Use Claude Code, Cursor Agent, or Gemini CLI subscriptions in goose
|
||||
description: Use Claude Code, Codex, Cursor Agent, or Gemini CLI subscriptions in goose
|
||||
---
|
||||
|
||||
# CLI Providers
|
||||
|
||||
goose can make use of pass-through providers that integrate with existing CLI tools from Anthropic, Cursor, and Google. These providers allow you to use your existing Claude Code, Cursor Agent, and Google Gemini CLI subscriptions through goose's interface, adding session management, persistence, and workflow integration capabilities to these tools.
|
||||
goose can make use of pass-through providers that integrate with existing CLI tools from Anthropic, OpenAI, Cursor, and Google. These providers allow you to use your existing Claude Code, Codex, Cursor Agent, and Google Gemini CLI subscriptions through goose's interface, adding session management, persistence, and workflow integration capabilities to these tools.
|
||||
|
||||
:::warning Limitations
|
||||
These providers don’t fully support all goose features, may have platform or capability limitations, and can sometimes require advanced debugging if issues arise. They’re included here purely as a convenience.
|
||||
@@ -17,7 +17,7 @@ These providers don’t fully support all goose features, may have platform or c
|
||||
|
||||
CLI providers are useful if you:
|
||||
|
||||
- already have a Claude Code, Cursor, or Google Gemini CLI subscription and want to use it through goose instead of paying per token
|
||||
- already have a Claude Code, Codex, Cursor, or Google Gemini CLI subscription and want to use it through goose instead of paying per token
|
||||
- need session persistence to save, resume, and export conversation history
|
||||
- want to use goose recipes and scheduled tasks to create repeatable workflows
|
||||
- prefer unified commands across different AI providers
|
||||
@@ -61,6 +61,23 @@ The Claude Code provider integrates with Anthropic's [Claude CLI tool](https://c
|
||||
- Active Claude Code subscription
|
||||
- CLI tool authenticated with your Anthropic account
|
||||
|
||||
### OpenAI Codex
|
||||
|
||||
The Codex provider integrates with OpenAI's [Codex CLI tool](https://developers.openai.com/codex/cli), allowing you to use OpenAI models through your existing ChatGPT Plus/Pro subscription or API credits.
|
||||
|
||||
**Features:**
|
||||
- Uses OpenAI's GPT-5 series models (gpt-5.2-codex, gpt-5.2, gpt-5.1-codex-max, gpt-5.1-codex-mini)
|
||||
- Configurable reasoning effort levels (low, medium, high)
|
||||
- Optional skills support for enhanced capabilities
|
||||
- JSON output parsing for structured responses
|
||||
- Automatic filtering of goose extensions from system prompts
|
||||
|
||||
**Requirements:**
|
||||
- Codex CLI tool installed (`npm i -g @openai/codex` or `brew install --cask codex`)
|
||||
- Active ChatGPT Plus/Pro subscription or OpenAI API credits
|
||||
- CLI tool authenticated with your OpenAI account
|
||||
- By default, Codex requires running from a git repository. Set `CODEX_SKIP_GIT_CHECK=true` to bypass this requirement
|
||||
|
||||
### Cursor Agent
|
||||
|
||||
The Cursor provider integrates with Cursor's [CLI agent](https://docs.cursor.com/en/cli/installation), providing access to through your existing subscription.
|
||||
@@ -121,7 +138,46 @@ The Gemini CLI provider integrates with Google's [Gemini CLI tool](https://ai.go
|
||||
◇ Enter a model from that provider:
|
||||
│ default
|
||||
```
|
||||
## Cursor Agent
|
||||
### OpenAI Codex
|
||||
|
||||
1. **Install Codex CLI Tool**
|
||||
|
||||
Install the Codex CLI using npm or Homebrew:
|
||||
```bash
|
||||
npm i -g @openai/codex
|
||||
# or
|
||||
brew install --cask codex
|
||||
```
|
||||
|
||||
2. **Authenticate with OpenAI**
|
||||
|
||||
Run `codex` and follow the authentication prompts. You can use your ChatGPT account or API key.
|
||||
|
||||
3. **Configure goose**
|
||||
|
||||
Set the provider environment variable:
|
||||
```bash
|
||||
export GOOSE_PROVIDER=codex
|
||||
```
|
||||
|
||||
Or configure through the goose CLI using `goose configure`:
|
||||
|
||||
```bash
|
||||
┌ goose-configure
|
||||
│
|
||||
◇ What would you like to configure?
|
||||
│ Configure Providers
|
||||
│
|
||||
◇ Which model provider should we use?
|
||||
│ OpenAI Codex CLI
|
||||
│
|
||||
◇ Model fetch complete
|
||||
│
|
||||
◇ Enter a model from that provider:
|
||||
│ gpt-5.2-codex
|
||||
```
|
||||
|
||||
### Cursor Agent
|
||||
|
||||
1. **Install Cursor agent Tool**
|
||||
|
||||
@@ -136,7 +192,7 @@ The Gemini CLI provider integrates with Google's [Gemini CLI tool](https://ai.go
|
||||
Set the provider environment variable:
|
||||
|
||||
```bash
|
||||
export goose_provider=cursor-agent
|
||||
export GOOSE_PROVIDER=cursor-agent
|
||||
```
|
||||
|
||||
Or configure through the goose CLI using `goose configure`:
|
||||
@@ -145,7 +201,7 @@ The Gemini CLI provider integrates with Google's [Gemini CLI tool](https://ai.go
|
||||
┌ goose-configure
|
||||
│
|
||||
◇ What would you like to configure?
|
||||
│ configure providers
|
||||
│ Configure Providers
|
||||
│
|
||||
◇ Which model provider should we use?
|
||||
│ Cursor Agent
|
||||
@@ -221,8 +277,24 @@ goose session
|
||||
| Environment Variable | Description | Default |
|
||||
|---------------------|-------------|---------|
|
||||
| `GOOSE_PROVIDER` | Set to `claude-code` to use this provider | None |
|
||||
| `GOOSE_MODEL` | Model to use (only `sonnet` or `opus` are passed to CLI) | `claude-sonnet-4-20250514` |
|
||||
| `CLAUDE_CODE_COMMAND` | Path to the Claude CLI command | `claude` |
|
||||
|
||||
**Known Models:**
|
||||
|
||||
The following models are recognized and passed to the Claude CLI via the `--model` flag. If `GOOSE_MODEL` is set to a value not in this list, no model flag is passed and Claude Code uses its default:
|
||||
|
||||
- `sonnet`
|
||||
- `opus`
|
||||
|
||||
**Permission Modes (`GOOSE_MODE`):**
|
||||
|
||||
| Mode | Claude Code Flag | Behavior |
|
||||
|------|------------------|----------|
|
||||
| `auto` | `--dangerously-skip-permissions` | Bypasses all permission prompts |
|
||||
| `smart-approve` | `--permission-mode acceptEdits` | Auto-accepts edits, prompts for other actions |
|
||||
| `approve` | Not supported | Returns an error |
|
||||
| `chat` | (none) | Default Claude Code behavior |
|
||||
|
||||
### Cursor Agent Configuration
|
||||
|
||||
@@ -231,6 +303,39 @@ goose session
|
||||
| `GOOSE_PROVIDER` | Set to `cursor-agent` to use this provider | None |
|
||||
| `CURSOR_AGENT_COMMAND` | Path to the Cursor Agent command | `cursor-agent` |
|
||||
|
||||
### OpenAI Codex Configuration
|
||||
|
||||
| Environment Variable | Description | Default |
|
||||
|---------------------|-------------|---------|
|
||||
| `GOOSE_PROVIDER` | Set to `codex` to use this provider | None |
|
||||
| `GOOSE_MODEL` | Model to use (only known models are passed to CLI) | `gpt-5.2-codex` |
|
||||
| `CODEX_COMMAND` | Path to the Codex CLI command | `codex` |
|
||||
| `CODEX_REASONING_EFFORT` | Reasoning effort level: `low`, `medium`, or `high` | `high` |
|
||||
| `CODEX_ENABLE_SKILLS` | Enable Codex skills: `true` or `false` | `true` |
|
||||
| `CODEX_SKIP_GIT_CHECK` | Skip git repository requirement: `true` or `false` | `false` |
|
||||
|
||||
**Known Models:**
|
||||
|
||||
The following models are recognized and passed to the Codex CLI via the `-m` flag. If `GOOSE_MODEL` is set to a value not in this list, no model flag is passed and Codex uses its default:
|
||||
|
||||
- `gpt-5.2-codex` (400K context, auto-compacting)
|
||||
- `gpt-5.2` (400K context, auto-compacting)
|
||||
- `gpt-5.1-codex-max` (256K context)
|
||||
- `gpt-5.1-codex-mini` (256K context)
|
||||
|
||||
:::note Legacy Models
|
||||
These are the default models supported by Codex CLI v0.77.0. To access older or legacy models, you can run `codex -m <model_name>` directly or configure them in Codex's `config.toml`. See the [Codex CLI documentation](https://developers.openai.com/codex/cli) for details.
|
||||
:::
|
||||
|
||||
**Permission Modes (`GOOSE_MODE`):**
|
||||
|
||||
| Mode | Codex Flag | Behavior |
|
||||
|------|------------|----------|
|
||||
| `auto` | `--yolo` | Bypasses all approvals and sandbox restrictions |
|
||||
| `smart-approve` | `--full-auto` | Workspace-write sandbox, approvals only on failure |
|
||||
| `approve` | (none) | Interactive approvals (Codex default behavior) |
|
||||
| `chat` | `--sandbox read-only` | Read-only sandbox mode |
|
||||
|
||||
### Gemini CLI Configuration
|
||||
|
||||
| Environment Variable | Description | Default |
|
||||
@@ -247,12 +352,14 @@ The CLI providers automatically filter out goose's extension information from sy
|
||||
### Message Translation
|
||||
|
||||
- **Claude Code**: Converts goose messages to Claude's JSON message format, handling tool calls and responses appropriately
|
||||
- **Codex**: Converts messages to simple text prompts with role prefixes (Human:/Assistant:), similar to Gemini CLI
|
||||
- **Cursor Agent**: Converts goose messages to Cursor's JSON message format, handling tool calls and responses appropriately
|
||||
- **Gemini CLI**: Converts messages to simple text prompts with role prefixes (Human:/Assistant:)
|
||||
|
||||
### Response Processing
|
||||
|
||||
- **Claude Code**: Parses JSON responses to extract text content and usage information
|
||||
- **Codex**: Parses newline-delimited JSON events to extract text content and usage information
|
||||
- **Cursor Agent**: Parses JSON responses to extract text content and usage information
|
||||
- **Gemini CLI**: Processes plain text responses from the CLI tool
|
||||
|
||||
@@ -263,6 +370,7 @@ CLI providers depend on external tools, so ensure:
|
||||
- CLI tools are properly installed and in your PATH
|
||||
- Authentication is maintained and valid
|
||||
- Subscription limits are not exceeded
|
||||
- For Codex: you're in a git repository, or set `CODEX_SKIP_GIT_CHECK=true`
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -160,7 +160,8 @@ goose works with [supported LLM providers](/docs/getting-started/providers) that
|
||||
│ ○ Anthropic
|
||||
│ ○ Azure OpenAI
|
||||
│ ○ Amazon Bedrock
|
||||
│ ○ Claude Code
|
||||
│ ○ Claude Code
|
||||
│ ○ Codex CLI
|
||||
│ ○ Databricks
|
||||
│ ○ Gemini CLI
|
||||
| ● Tetrate Agent Router Service (Enterprise router for AI models)
|
||||
|
||||
Reference in New Issue
Block a user