Skip to content

Chat completions ​

Send messages to a chat model and read the assistant reply.

text
POST https://uni.sointech.com.cn/v1/chat/completions

Request ​

Headers:

HeaderValue
AuthorizationBearer sk-your-token
Content-Typeapplication/json

Common body fields:

FieldMeaning
modelModel name the token is allowed to call
messagesArray of messages. Each has role (system, user, or assistant) and content
streamOptional. true returns server-sent events. The default is one JSON body
temperatureOptional. Whether the upstream model honors it depends on that model
bash
curl https://uni.sointech.com.cn/v1/chat/completions \
  -H "Authorization: Bearer sk-your-token" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"qwen-plus\",\"messages\":[{\"role\":\"user\",\"content\":\"Introduce yourself in one sentence\"}]}"

Response ​

In a non-streaming response, the text is choices[0].message.content. usage.prompt_tokens and usage.completion_tokens are the usage counts. Per-call and dynamic prices are not those two counts times one flat rate. See Billing.

Add "stream": true for a stream. The body is text/event-stream. Each line starts with data: , and the last line is data: [DONE].

When not to use this API ​

Video and music models are often billed by duration, count, or another task field. Sending them here can fail before any charge, because the site cannot price the call. Use Image generation for pictures, and the Claude-compatible API for Claude SDKs. Check the model's billing rule in the catalog first.

Prices are whatever the model catalog shows at request time.