docs(openai): clarify codex oauth image generation

This commit is contained in:
Peter Steinberger
2026-04-23 21:47:27 +01:00
parent 59cffb43f7
commit 8af3d91668
2 changed files with 66 additions and 15 deletions

View File

@@ -183,14 +183,17 @@ Choose your preferred auth method and follow the setup steps.
## Image generation
The bundled `openai` plugin registers image generation through the `image_generate` tool.
It supports both OpenAI API-key image generation and Codex OAuth image
generation.
| Capability | Value |
| ------------------------- | ---------------------------------- |
| Default model | `openai/gpt-image-2` |
| Max images per request | 4 |
| Edit mode | Enabled (up to 5 reference images) |
| Size overrides | Supported, including 2K/4K sizes |
| Aspect ratio / resolution | Not forwarded to OpenAI Images API |
| Capability | OpenAI API key | Codex OAuth |
| ------------------------- | ---------------------------------- | ---------------------------------- |
| Model ref | `openai/gpt-image-2` | `openai-codex/gpt-image-2` |
| Auth | `OPENAI_API_KEY` | OpenAI Codex OAuth sign-in |
| Max images per request | 4 | 4 |
| Edit mode | Enabled (up to 5 reference images) | Enabled (up to 5 reference images) |
| Size overrides | Supported, including 2K/4K sizes | Supported, including 2K/4K sizes |
| Aspect ratio / resolution | Not forwarded to OpenAI Images API | Mapped to supported size when safe |
```json5
{
@@ -202,6 +205,18 @@ The bundled `openai` plugin registers image generation through the `image_genera
}
```
Use Codex OAuth instead:
```json5
{
agents: {
defaults: {
imageGenerationModel: { primary: "openai-codex/gpt-image-2" },
},
},
}
```
<Note>
See [Image Generation](/tools/image-generation) for shared tool parameters, provider selection, and failover behavior.
</Note>
@@ -213,7 +228,9 @@ OpenAI image workflows should use `openai/gpt-image-2`.
The `openai-codex` provider also exposes `gpt-image-2` for image generation and
reference-image editing through OpenAI Codex OAuth. Use
`openai-codex/gpt-image-2` when the agent is signed in with Codex OAuth but does
not have an `OPENAI_API_KEY`.
not have an `OPENAI_API_KEY`. OpenClaw resolves the stored Codex OAuth access
token for `openai-codex` and sends image requests through the Codex Responses
backend, so this path works without the public OpenAI Images API key.
Generate:
@@ -227,6 +244,12 @@ Generate with Codex OAuth:
/tool image_generate model=openai-codex/gpt-image-2 prompt="A polished launch poster for OpenClaw on macOS" size=3840x2160 count=1
```
Edit with Codex OAuth:
```
/tool image_generate model=openai-codex/gpt-image-2 prompt="Preserve the object shape, change the material to translucent glass" image=/path/to/reference.png size=1024x1536
```
Edit:
```