# Codex Imagem — how to use (mcp.ai)

Generate images with your own ChatGPT subscription (Plus, Pro or Team), without spending API credits. Connect your Codex login once and ask for the image in plain language, the file is saved to your mcp.ai account.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_codex_image?ms=1786693920000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `codex_image_generate`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/codex-image`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/codex-image/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/codex-image/generate` — Gera uma imagem a partir de um texto, usando a cota de imagens da assinatura ChatGPT conectada (não consome créditos de API). Retorna um link de download do PNG, que também fica na aba Arquivos do mcp
  - body: { prompt: string, account?: string }
- `POST https://api.mcp.ai/api/codex-image/subscription` — Mostra qual assinatura ChatGPT está conectada (e-mail e plano). Não gera imagem nem consome cota.
  - body: { account?: string }

## Example prompts
- "Generate a flat-style fox mascot image for my brand"
- "Create a product photo of a ceramic mug on a light background"
- "Which ChatGPT subscription is connected here?"

## More
- Page: https://mcp.ai/codex_image
- Agent spec (llms.txt): https://mcp.ai/codex_image/llms.txt
- Postman collection: https://mcp.ai/codex_image/postman.json
