tokenpiazza
cn
  • cn
  • en
Home
Home
cn
  • cn
  • en
cn
  • cn
  • en
  1. Chat
  • 🦊一分钟,了解 Apifox !
  • Chat
    • 创建聊天补全 (流式)
      POST
  1. Chat

创建聊天补全 (流式)

POST
https://www.tokenpiazza.ai/api//v1/chat/completions
给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。
为提供的提示和参数创建完成
官方文档:https://platform.openai.com/docs/api-reference/chat/create

Request

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢200成功
application/json
Body

Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://www.tokenpiazza.ai/api//v1/chat/completions' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "gpt-5-mini",
  "max_tokens": 1000,
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "你好"
    }
  ],
  "temperature": 1.0,
  "stream": true,
  "stream_options": {
    "include_usage": true
  }
}'
Response Response Example
{
    "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
    }
}
Modified at 2026-04-08 03:46:45
Previous
🦊一分钟,了解 Apifox !
Built with