- GET START
- OpenAI Compatiable Endpoint
- Audio
- Anthropic Compatiable Endpoint
- Music Generation Endpoint
- Image Generation Endpoint
- Video Generation Ednpoint
- Software Integration Guide
- cometapi Site API Call Testing
- OpenManus
- Chatbox
- CherryStudio
- Cursor
- ChatHub
- cline
- dify
- gptme
- Immersive Translation
- Lobe-Chat
- Zotero
- LangChain
- AnythingLLM
- Eudic Translation
- OpenAI Translator
- ChatAll Translation
- Pot Translation
- GPT Academic Optimization (gpt_academic)
- NEXT CHAT (ChatGPT Next Web)
- Obsidian's Text Generator Plugin
- Open WebUI
- avante.nvim
- librechat
- Lazy Customer Service
- utools-ChatGPT Friend
- IntelliJ Translation Plugin
- n8n
gpt-4o-image generates image
POST
https://api.cometapi.com/v1/chat/completions
Maintainer:Not configured
Request
Header Params
Authorization
string
required
Example:
{{api-key}}
Body Params application/json
model
string
required
messages
array [object {2}]
required
role
string
optional
content
string
optional
stream
boolean
optional
temperature
integer
optional
top_p
integer
optional
n
integer
optional
stop
string
optional
max_tokens
integer
optional
presence_penalty
number
optional
frequency_penalty
number
optional
logit_bias
null
optional
user
string
optional
Examples
{
"model": "gpt-4o-image",
"messages": [
{
"role": "user",
"content": "Generate a cute kitten sitting on a cloud, cartoon style"
}
]
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST 'https://api.cometapi.com/v1/chat/completions' \
--header 'Authorization: {{api-key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4o-image",
"messages": [
{
"role": "user",
"content": "Generate a cute kitten sitting on a cloud, cartoon style"
}
]
}'
Responses
🟢200Successful Response
text/plain
Body
id
string
required
object
string
required
created
integer
required
model
string
required
system_fingerprint
string
required
choices
array [object {3}]
required
index
integer
optional
message
object
optional
finish_reason
string
optional
usage
object
required
completion_tokens
integer
required
completion_tokens_details
object
required
prompt_tokens
integer
required
prompt_tokens_details
object
required
total_tokens
integer
required
Example
{
"id": "chatcmpl-89DrEm9HUEuAk2JUN4tmIi5TEwVam",
"object": "chat.completion",
"created": 1744696747,
"model": "gpt-4o-image",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "```\n{\n \"prompt\": \"A cute kitten sitting on a cloud, in a cartoon style.\",\n \"ratio\": \"1:1\"\n}\n```\n\n>🕐 Queuing.\n\n>⚡ Generating..\n\n>🏃 Progress 14...37...61...74..[100](https://videos.openai.com/vg-assets/assets%2Ftask_01jrw0e6vwez5sh16h25kn0xn2%2Fsrc_0.png?st=2025-04-15T04%3A40%3A06Z&se=2025-04-21T05%3A40%3A06Z&sks=b&skt=2025-04-15T04%3A40%3A06Z&ske=2025-04-21T05%3A40%3A06Z&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skoid=aa5ddad1-c91a-4f0a-9aca-e20682cc8969&skv=2019-02-02&sv=2018-11-09&sr=b&sp=r&spr=https%2Chttp&sig=tVdhsKmI14ibIK%2BKuwhSrCphnrSBZX0d%2FXtqjLVTF08%3D&az=oaivgprodscus)\n\n> ✅ Generation complete\n\n\n"
},
"finish_reason": "stop"
}
],
"data": null,
"usage": {
"prompt_tokens": 21,
"completion_tokens": 373,
"total_tokens": 394,
"prompt_tokens_details": {
"CachedCreationTokens": 0,
"text_tokens": 14,
"cached_tokens_details": {}
},
"completion_tokens_details": {}
},
"error": {}
}