1. Quick Start Guides
AnyRoute English
  • AnyRoute User Guide
  • Frequently Asked Questions
  • AnyRoute Support Group
  • Supported Models
  • Environment Setup
    • Node.js Installation Guide
    • CC Switch Introduction
  • Quick Start Guides
    • Codex CLI Quick Start
    • Claude Code Quick Start
    • OpenClaw Quick Start
    • Hermes Quick Start
    • Cherry Studio Quick Start
    • Claude Desktop Quick Start
    • Codex Desktop Quick Start
    • GPT Image 2 Guide
    • Claude Code in VS Code
  • Advanced Guides
    • Personal AGENTS.md Global Rules
    • Claude Code and Codex Collaboration Guide
  1. Quick Start Guides

GPT Image 2 Guide

gpt-image-2 is the AnyRoute model ID for image generation and editing through an OpenAI-compatible Images API. Usage and charges appear in the AnyRoute console.

Prerequisites#

Confirm that:
1.
You can sign in to AnyRoute.
2.
You created an API key in a group that supports gpt-image-2.
3.
Your application can reach https://cc.anyroute.io.
Treat the API key as a password. Never commit it to a repository or publish it.

Generate an image from text#

Endpoint:
POST /v1/images/generations
Minimal request:
Request with common options:
The response commonly contains b64_json, which is Base64-encoded image data. Decode it and save it using the requested output format.

Image size#

Use a supported preset rather than an arbitrary width and height.
Common image sizes include:
auto
1024x1024 — square
1536x1024 — landscape
1024x1536 — portrait
AnyRoute may also expose recommended 1K, 2K, and 4K presets in its image test page. Those presets are intended to reduce validation errors and are not necessarily the complete set of upstream-supported sizes.

Pixel budget#

The current AnyRoute guidance keeps recommended high-resolution requests within:
8,294,400 pixels
Examples within that budget:
3840 × 2160 = 8,294,400
2880 × 2880 = 8,294,400
2160 × 3840 = 8,294,400
3264 × 2448 = 7,990,272
2448 × 3264 = 7,990,272
Example above the budget:
3328 × 2496 = 8,306,688
An oversized request can return:
Requested resolution exceeds the current pixel budget
Test your selected size before using it in production because upstream limits can change.

Edit a reference image#

Endpoint:
POST /v1/images/edits
Send multipart/form-data with at least model, prompt, and image:
For localized edits, add a mask. State explicitly which people, products, logos, or brand elements must remain unchanged.

Prompt structure#

A useful commercial-image prompt often follows:
subject + scene + composition + lighting + material/style + intended use + constraints
Example:
A premium skincare product photo. One frosted-glass serum bottle on a white marble surface, natural window light from the left, shallow depth of field, clean background, empty copy space on the right, suitable for an ecommerce landing-page hero. No watermark, no text, and no extra bottles.
Specify:
Subject count and position
Aspect ratio and intended use
Lighting direction
Background complexity
Required empty space
Whether text is allowed
Whether the background must be transparent

FAQ#

Why are high-resolution images slower?#

They contain more pixels and require more generation and transfer time. Actual latency depends on load, requested quality, and resolution.

Why does 3328x2496 fail?#

It contains 8,306,688 pixels, which exceeds the pixel budget in the current AnyRoute guidance. Use a supported preset such as 3264x2448.

Should I request response_format: "url"?#

Prefer the Base64 response returned in b64_json unless the active model documentation explicitly supports URL output.

How do I request a transparent background?#

{
  "background": "transparent",
  "output_format": "png"
}
WebP can also preserve transparency. JPEG cannot.

How do I generate multiple images?#

The API may accept n, but start with n: 1. For batch generation, separate requests are easier to retry and track.
See Supported Models for other image-model IDs.

Join AnyRoute WeChat Group

To get support for AnyRoute

scan QR code
Modified at 2026-07-24 19:04:54
Previous
Codex Desktop Quick Start
Next
Claude Code in VS Code
Built with