Chat completions
Send messages to a chat model and read the assistant reply.
text
POST https://uni.sointech.com.cn/v1/chat/completionsRequest
Headers:
| Header | Value |
|---|---|
Authorization | Bearer sk-your-token |
Content-Type | application/json |
Common body fields:
| Field | Meaning |
|---|---|
model | Model name the token is allowed to call |
messages | Array of messages. Each has role (system, user, or assistant) and content |
stream | Optional. true returns server-sent events. The default is one JSON body |
temperature | Optional. 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.
