ZBStream

Multi-Turn Chat

The Chat Completions API is stateless. The client must include the history it wants the model to consider in every request.

Assembling Message History

const messages = [
  { role: "system", content: "你是一个简洁的技术助手。" },
  { role: "user", content: "什么是 API 网关?" },
  { role: "assistant", content: "API 网关是统一的请求入口。" },
  { role: "user", content: "它如何做鉴权?" }
]

Context Management

  • Keep only the history needed for the task at hand.
  • Summarize long conversations before continuing to prevent unbounded context growth.
  • The server records usage but does not persist full conversations on the client's behalf.