- 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
Chat
POST
https://api.cometapi.com/v1/messages
POST /v1/messages#
Request
Header Params
Authorization
string
required
Example:
Bearer {{api-key}}
Body Params application/json
model
string
required
max_tokens
integer
required
messages
array [object {2}]
required
role
string
optional
content
string
optional
Example
{
"model": "claude-3-5-sonnet-20240620",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, world"
}
]
}
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/messages' \
--header 'Authorization: Bearer {{api-key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-3-5-sonnet-20240620",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, world"
}
]
}'
Responses
🟢200Successful Response
text/plain
Body
id
string
required
type
string
required
role
string
required
content
array [object {2}]
required
type
string
optional
text
string
optional
model
string
required
stop_reason
string
required
stop_sequence
null
required
usage
object
required
input_tokens
integer
required
output_tokens
integer
required
cache_creation_input_tokens
integer
required
cache_read_input_tokens
integer
required
Example
{
"id": "chatcmpl-a1568ee22c7a4f31848f3dc16c2f3",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! It's nice to meet you. I'm Claude, an AI assistant. How can I help you today? Feel free to ask me anything you'd like - I'm happy to assist with a wide range of topics and tasks."
}
],
"model": "claude-3-5-sonnet-20240620",
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 3,
"output_tokens": 52,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}