OpenAI Chat Completion API

使用 OpenAI 兼容格式 创建聊天补全。支持流式(stream:true,SSE)与非流式两种返回。

POSThttps://api.longcat.chat/openai/v1/chat/completions

Authorizations

Authorizationstringheader必选

身份验证密钥,需以 Bearer YOUR_API_KEY 形式置于请求头。

Bodyapplication/json

modelstring必选

模型标识符。目前支持 LongCat-2.5。

messagesarray必选

消息对象数组。

rolestring必选

消息作者角色,必须为 system · user · assistant 之一。

contentstring必选

消息内容,纯文本字符串。

streamboolean可选默认值: false

是否以 SSE 流式返回响应。

max_tokensinteger可选

生成的最大 Token 数。上限分模型,见模型参数参考。

temperaturenumber可选默认值: 1.0

采样温度。开启思考时固定为 1.0,关闭思考时固定为 0.7,传入其他值将被覆盖为对应默认值。

top_pnumber可选默认值: 0.95

核采样(nucleus sampling)参数,范围 (0, 1]。

thinkingobject可选

是否开启思考。{"type":"enabled"} 开启思考,{"type":"disabled"} 关闭思考。