Create image
/model/v1/images/generations● SupportedRequest body
modelstringrequiredImage model id; list candidates with listModels?type=image. Router support (supported): Verified to take effect.
Verified to take effect.
response_formatstringoptional◐ Partially supportedImage response encoding. Only b64_json is accepted; url returns 400.
gpt-image-2 supports b64_json; url returns 400.
promptstringrequiredText description of the image to generate. Router support (supported): Verified to take effect.
Verified to take effect.
nintegeroptionalNumber of images to generate, from 1 to 10; defaults to 1. Router support (supported): Controls image count; zero returns 400 and values 1–10 are accepted.
Controls image count; zero returns 400 and values 1–10 are accepted.
sizestringoptional◐ Partially supportedSize of the generated images. Router support (partial): gpt-image-2 supports tested 1024x1024 and 1024x1536 sizes; 512x512 returns 400.
gpt-image-2 supports tested 1024x1024 and 1024x1536 sizes; 512x512 returns 400.
qualitystringoptionalQuality of the generated images. Router support (supported): Verified to take effect.
Verified to take effect.
backgroundstringoptionaltransparent returns a transparent PNG on gpt-image-2.
output_formatstringoptionaljpeg returns JPEG on gpt-image-2.
Returns
200
Platform errors (auth, rate limits, validation) and OCR errors use problem+json; other model call errors follow the endpoint's own format (OpenAI or Anthropic) — see error codes
Request
curl
curl https://api.deepraxis.com/model/v1/images/generations \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-image-2","prompt":"一只在书桌上打盹的猫","size":"1024x1024","quality":"low"}'Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.deepraxis.com/model/v1",
api_key="$PRAXIS_API_KEY",
)
image = client.images.generate(
model="gpt-image-2",
prompt="一只在书桌上打盹的猫",
size="1024x1024",
quality="low",
)TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.deepraxis.com/model/v1",
apiKey: "$PRAXIS_API_KEY",
});
const image = await client.images.generate({
model: "gpt-image-2",
prompt: "一只在书桌上打盹的猫",
size: "1024x1024",
quality: "low",
});Response 200
{
"created": 1790305639,
"background": "opaque",
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAABJ7WNhQlgAAEntanVt…(采样时截断:原图 base64 共 2044340 字符,此处保留前 64)"
}
],
"output_format": "png",
"quality": "low",
"size": "1024x1024",
"usage": {
"input_tokens": 17,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 17
},
"output_tokens": 196,
"output_tokens_details": {
"image_tokens": 196,
"text_tokens": 0
},
"total_tokens": 213
}
}Response
HTTP 200
Image generation response
application/json
| Name | Type | Description |
|---|---|---|
| created | integer | Unix time in seconds at which the images were created. |
| data | array<object> | Generated images. |
| data[].url | string | URL of the image; present when response_format is url. |
| data[].b64_json | string | Base64-encoded image; present when response_format is b64_json. |
| data[].revised_prompt | string | Prompt after the image model rewrote it, when the model reports it. |