Generations(Image generation)
Create image based on text promptPrice:
Text input :5 PTC/1M
Image output: 40 PTC/1M Request
Example:Bearer {{YOUR_API_KEY}}
Body Params application/json
Text description of the required image. Maximum length is 1000 characters.
Size of the generated image. Must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait).
transparent, opaque or auto
auto, high, medium and low
{
"prompt": "A cute baby sea otter",
"model": "gpt-image-1",
"size": "1024x1024"
}
Request samples
curl --location --request POST 'https://api.302.ai/v1/images/generations?response_format=url' \
--header 'Authorization: Bearer sk-jls4AaVBGoe1GwZD64qZA1qyKTN1MPHa4NmvH1cT68z7K1Zz' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "A cute baby sea otter",
"model": "gpt-image-1",
"size": "1024x1024"
}'
Responses
application/json {
"data": [
{
"url": "",
"b64_json": ""
}
],
"created": 1745694920,
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 4172,
"prompt_tokens_details": {
"cached_tokens_details": {}
},
"completion_tokens_details": {},
"input_tokens": 12,
"output_tokens": 4160,
"input_tokens_details": {
"text_tokens": 12,
"cached_tokens_details": {}
}
}
}
Modified at 2025-05-15 07:17:32