# Codex — OpenGen Setup

> Add a Streamable HTTP server and use OAuth login with read/generate scopes.

- **Client kind:** Local agent
- **Integration approach:** Native MCP OAuth or OpenGen CLI
- **Verification status:** LIVE GENERATION VERIFIED
- **Reviewed:** 2026-11-30
- **Canonical HTML:** https://opengen.dev/docs/clients/codex
- **Source reference:** [Official OpenAI command reference](https://learn.chatgpt.com/docs/developer-commands)

## Agent Prompt

```text
Walk the user through connecting Codex to OpenGen (https://opengen.dev/mcp for authenticated read+generate OAuth, https://opengen.dev/mcp/readonly for zero-auth catalog discovery, or @opengen-dev/cli for shell workflows) following https://opengen.dev/docs/clients/codex.md. Review configuration commands before running them, keep credentials out of prompts and version control, and verify read-only access (balance / find_models / opengen doctor) before proposing any paid generation.
```

## Setup Steps

1. Review the commands below. Adding a server changes the MCP configuration shared by the Codex CLI and IDE.
2. Run the login command in an interactive terminal and review OpenGen’s consent in your browser.
3. Inspect MCP status and ask for catalog discovery. A saved server definition alone does not establish a successful connection.

## Configuration & Commands

### Client configuration commands · review before running

```bash
codex mcp add opengen --url https://opengen.dev/mcp
codex mcp login opengen --scopes read,generate --oauth-client-registration dcr
```

## Verification Evidence & Cautions

**Recorded evidence (2026-11-30):** codex-cli 0.155.1 (2026-11-30, 484d99f): verified live OAuth refresh-token rotation (POST /oauth/token 200 on 2026-11-27 grant), fresh OAuth DCR + PKCE login, 6/6 MCP tools discovered, read-only balance/catalog_get/pricing.list, bounded live openai/gpt-image-2 text-to-image (1K, low quality; $0.00598 settled), and first-party /media PNG delivery (with ?utm_source=test) against https://opengen.dev/mcp. Other models/operations, upload/edit flows, and other Codex versions remain separately unverified.

**Important boundaries:** codex-cli 0.155.1 completed live OAuth refresh-token rotation (POST /oauth/token 200 on its 2026-11-27 grant), fresh OAuth DCR + PKCE login, 6/6 MCP tool discovery, read-only balance/catalog_get/pricing.list calls, a bounded live openai/gpt-image-2 text-to-image generation (1K, low quality; $0.00598 settled), and first-party /media PNG delivery (?utm_source=test resilient) against https://opengen.dev/mcp (484d99f) on 2026-11-30. Other models/operations, upload/edit flows, and other Codex versions remain separately unverified.

## Related Links

- [All Agent Clients & Support Matrix](https://opengen.dev/docs/clients.md)
- [MCP Integration Guide](https://opengen.dev/docs/mcp.md)
- [Quickstart Guide](https://opengen.dev/docs/quickstart.md)
- [Installable Skill (skill.md)](https://opengen.dev/skill.md)
- [AI Index (llms.txt)](https://opengen.dev/llms.txt)
