Text Chat

Request Fields

FieldTypeRequiredNotes
modelstringYesModel name, copied from the Model Plaza (case-sensitive); naming conventions in Models
messagesarrayYesConversation messages; each has a role (system / user / assistant) and content
temperaturenumberNoSampling temperature, 0–2; higher is more random; 0.7 is a common choice
max_tokensintegerNoMaximum number of tokens in the reply
streambooleanNotrue for streaming (SSE); defaults to false

Basic Call

cURL
Python (openai)
Node.js (openai)
curl https://api-model.shuntianchuang.cn/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-your-token" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      { "role": "user", "content": "Explain what an API gateway is in one sentence" }
    ],
    "temperature": 0.7
  }'

Streaming

With "stream": true, the server pushes content incrementally over SSE (Server-Sent Events) — good for typewriter-style output. Each chunk starts with data: , and you receive data: [DONE] when the stream finishes.

cURL
Python (openai)
Node.js (openai)
# -N disables curl buffering so you see streamed output in real time
curl -N https://api-model.shuntianchuang.cn/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-your-token" \
  -d '{
    "model": "deepseek-v4-flash",
    "stream": true,
    "messages": [
      { "role": "user", "content": "Write a two-line poem about spring" }
    ]
  }'
TIP

Your client or proxy must support SSE (no response buffering), otherwise streamed output stalls until timeout — see FAQ.

Multi-turn Conversation

Multi-turn chat needs no new parameters: just append prior messages to the messages array in order. Include the assistant's previous replies verbatim — the model continues from the full context:

{
  "model": "deepseek-v4-flash",
  "messages": [
    { "role": "system", "content": "You are a concise assistant" },
    { "role": "user", "content": "What is an API gateway?" },
    { "role": "assistant", "content": "An API gateway is..." },
    { "role": "user", "content": "How is it different from a reverse proxy?" }
  ]
}
NOTE

Every turn bills all input tokens again: the longer the conversation, the higher the input cost. Trim history messages promptly, or use a model with cached pricing to control costs — see Billing & Top-up.