Create Chat Completions
该接口用于根据用户提供的对话上下文,调用语言模型生成一个或多个聊天回复。它是实现问答、对话、内容创作等功能的核心端点。支持流式(逐字返回)和非流式(一次性返回)两种模式。
Authorization
bearer In: header
Header Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
text/event-stream
curl -X POST "https://example.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -H "Authorization: Bearer {{YOUR_API_KEY}}" \ -H "Content-Type: application/json" \ -d '{ "model": "Qwen3-30B-A3B-Instruct-2507", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ], "top_k": 0, "min_p": 0, "stream": true }'{ "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "choices": [ { "index": 0, "message": { "role": "assistant", "content": "\n\nHello there, how may I assist you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }}