Chat Completions

Create a chat completion using the OpenAI-compatible format. Text input only; supports both streaming (stream:true, SSE) and non-streaming responses.

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

Authorizations

Authorizationstringheaderrequired

Authentication key, passed in the request header as Bearer YOUR_API_KEY.

default: false

Bodyapplication/json

modelstringrequired

Model identifier. Currently supports LongCat-2.0-Preview.

default: false
messagesarrayrequired

Array of message objects. Text input only.

default: false
rolestringrequired

Author role, one of system · user · assistant.

default: false
contentstringrequired

Message content as a plain-text string.

default: false
streambooleanoptional

Whether to stream the response as SSE.

default: false
max_tokensintegeroptional

Maximum number of tokens to generate. LongCat-2.0-Preview max is 131072 (128K).

default: 32768
temperaturenumberoptional

Sampling temperature, range 0 ~ 1.

default: false
top_pnumberoptional

Nucleus sampling parameter.

default: false
thinkingobjectoptional

Whether to enable thinking. {"type":"enabled"} turns thinking on, {"type":"disabled"} turns it off.

default: false