Skip to main content
POST
/
api
/
ai
/
images
/
generations
OpenAI Image Generation
curl --request POST \
  --url https://aitoearn.cn/api/ai/images/generations \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "model": "<string>"
}
'
{}

Authorizations

Authorization
string
header
required

Used by OpenAI-compatible endpoints. Example: Bearer .

Body

application/json
prompt
string
required

prompt word

model
string
required

Image generation model name. First call the "Image Generation Model" interface (GET /api/ai/models/image/generation) and pass in the data[n].name returned by it; the size, quality, style and price supported by each model shall be subject to the return of this interface.

n
integer

Generate quantity

Required range: 1 <= x <= 9007199254740991
quality
string

Image quality. The optional values ​​vary from model to model, and are subject to the data[n].qualities returned by the "Image Generation Model" interface.

response_format
enum<string>

Return format

Available options:
url,
b64_json
size
string

Image size. The optional values ​​vary with the model, and are subject to the data[n].sizes returned by the "Image Generation Model" interface; the prices for different sizes are different, see data[n].pricing.

style
string

Image style. The optional values ​​vary with the model, and are subject to the data[n].styles returned by the "Image Generation Model" interface; returning empty means that the model does not support style parameters.

Response

Native third-party protocol response or SSE data, not wrapped in the AiToEarn common response envelope.

Native third-party protocol response, not wrapped in the AiToEarn common response envelope.