Skip to main content
POST
Buat Chat Completion (OpenAI-compatible)
Generates a completion for the supplied conversation. Set stream: true to receive Server-Sent Events. Every response carries a UUID v4 x-request-id header for lookup in Logs. Retry 429 and 5xx responses with exponential backoff and jitter. Prefer retry-after when provided. Do not retry 400, 401, 402, or 404. A 429 means one of your three per-minute budgets (requests, input tokens, or output tokens) is temporarily exhausted. See Rate limits for details.

Authorizations

Authorization
string
header
required

Kunci API workspace CerasAI (format OpenAI: Authorization: Bearer $CERASAI_API_KEY).

Body

application/json
model
string
required

Model ID persis dari endpoint GET /v1/models.

Example:

"zai-org/GLM-5.3-Flash"

messages
object[]
required
stream
boolean
default:false

Aktifkan Server-Sent Events (SSE) streaming.

temperature
number
Required range: 0 <= x <= 2
Example:

0.7

top_p
number
Required range: 0 <= x <= 1
Example:

1

max_tokens
integer
Required range: x >= 1
Example:

2048

tools
object[]

Definisi function/tool calling diteruskan apa adanya ke model.

tool_choice
response_format
object
stop
seed
integer

Response

Respons inferensi berhasil (JSON atau text/event-stream saat stream=true).

id
string
object
string
Example:

"chat.completion"

created
integer
model
string
Example:

"zai-org/GLM-5.3-Flash"

choices
object[]
usage
object