Skip to main content
POST
/
api
/
ai
/
chat
/
completions
OpenAI Chat
curl --request POST \
  --url https://aitoearn.cn/api/ai/chat/completions \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "role": "<string>",
      "content": "<unknown>"
    }
  ],
  "model": "<string>"
}
'
{}

Authorizations

Authorization
string
header
required

Used by OpenAI-compatible endpoints. Example: Bearer .

Body

application/json
messages
object[]
required

Message list

Minimum array length: 1
model
string
required

Model ID. First call the "Conversation Model List" interface (GET /api/ai/models/chat) and pass in the data[n].name returned by it.

stream
boolean

Whether to stream the return

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.