API Doc-CometAPI
HomeDashBoardModel_Price
HomeDashBoardModel_Price
Discord_Support
  1. OpenAI Compatiable Endpoint
  • GET START
    • Model New Release Announcement
    • Help Center
    • Quick Start
    • About Pricing
    • About Grouping
    • Interface Stability
    • Privacy policy
    • Terms of service
    • Error code description
    • Code example
    • Must see for use
    • Common Misconceptions
    • Confusion about use
    • Best Practices
      • Retry Logic Documentation for CometAPI and OpenAI Official API
      • Midjourney Best Practices
      • Runway Best Practices
  • OpenAI Compatiable Endpoint
    • gpt-4o-image generates image
      POST
    • Chat
      POST
    • Recognizing Images
      POST
    • Models
      GET
    • Embeddings
      POST
    • Realtime
      POST
    • Images
      POST
    • Image Editing (gpt-image-1)
      POST
  • Audio
    • Create speech
      POST
    • Create transcription
      POST
    • Create translation
      POST
  • Anthropic Compatiable Endpoint
    • Chat
      POST
  • Music Generation Endpoint
    • Suno
      • Setting suno Version
      • Generate lyrics
      • Generate music clip
      • Upload clip
      • Submit concatenation
      • Single task query
      • Batch task fetch
    • Udio(Temporarily unavailable)
      • Generate music
      • Task query
  • Image Generation Endpoint
    • Midjourney(images)
      • Task Fetching API
        • List by Condition
        • Fetch Single Task (most recommended)
      • Imagine
      • Change (UPSCALE; VARIATION; REROLL)
      • Action (UPSCALE; VARIATION; REROLL; ZOOM, etc.)
      • Blend (image -> image)
      • Describe (image -> text)
      • Modal (Area Redesign & Zoom)
    • Ideogram(images)
      • Official documentation (updated in real time)
      • ideogram Text Raw Image
      • ideogram Hybrid image
      • ideogram enlargement HD
      • ideogram describes the image
      • ideogram Edit image
    • Flux(images)
      • Generate image (replicate format)
      • flux fine-tune images(Temporarily unavailable)
      • flux generate image(Temporarily unavailable)
      • flux query
    • Replicate(image)
      • replicate Generate
      • replicate query
    • Recraft(images)
      • Appendix
      • Recraft Generate Image
      • Recraft Vectorize Image
      • Recraft Remove Background
      • Recraft Clarity Upscale
      • Recraft Create style
      • Recraft Generative Upscale
  • Video Generation Ednpoint
    • runway(video)
      • official format
        • runway images raw video
        • runway to get task details
      • Reverse Format
        • generate(text)
        • generate(Reference images)
        • Video to Video Style Redraw
        • Act-one Expression Migration
        • feed-get task
    • PIKA(video)
      • pika feed
      • PIKA Reference Video Generation
      • PIKA Reference Image Generation
      • PIKA reference text generation
    • luma (video)
      • Official api interface format
        • luma generate
        • luma search
    • kling (video)
      • callback_url
      • Generating images
      • Text Generation Video
      • Image Generation Video
      • Video Extension
      • virtual try-on
      • lip sync
      • Query tasks (images)
      • Individual queries (videos)
    • MiniMax Conch(video)
      • MiniMax Conch Official Documentation
      • MiniMax Conch Generation
      • MiniMax Conch Query
      • MiniMax Conch Download
    • sora
      • Official Format
        • Create Video
        • Query Video Task
      • Reverse Format
        • Create Video
  • 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
  1. OpenAI Compatiable Endpoint

Chat

POST
https://api.cometapi.com/v1/chat/completions
Maintainer:Not configured
The endpoint POST https://api.cometapi.com/v1/chat/completions is used to send a request to generate chat completions. The request should include a model parameter specifying the model to use, a list of messages containing the role and content of the messages, and a stream parameter to indicate whether to stream the response.

Request Body#

model (string): Specifies the model to use for generating completions.
messages (array): Contains the role and content of the messages for which completions are to be generated.
role (string): Specifies the role of the message (e.g., "user", "assistant", "system").
content (string): The content of the message for which completions are to be generated.
stream (boolean): Indicates whether to stream the response.

Request

Header Params
Authorization
string 
required
Example:
Bearer {{api-key}}
Body Params application/json
model
string 
required
messages
array [object {2}] 
required
role
string 
optional
content
string 
optional
stream
boolean 
required
Example
{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "stream": false
}

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 --location --request POST 'https://api.cometapi.com/v1/chat/completions' \
--header 'Authorization: Bearer {{api-key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-4o",
    "messages": [
        {
            "role": "user",
            "content": "Hello!"
        }
    ],
    "stream": false
}'

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-AreYSBEwmzB0kY3GxzBEhE1Olct83",
  "object": "chat.completion",
  "created": 1737350640,
  "model": "gpt-4o-2024-08-06",
  "system_fingerprint": "fp_f3927aa00d",
  "choices": [
    {
      "index": 0,
      "message": {
        "content": "Hello! How can I assist you today?",
        "role": "assistant"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "completion_tokens": 9,
    "completion_tokens_details": {},
    "prompt_tokens": 9,
    "prompt_tokens_details": {},
    "total_tokens": 18
  }
}
Previous
gpt-4o-image generates image
Next
Recognizing Images
Built with