Chat completions
Send a conversation and get the model’s next reply. Copy a text model ID from
GET /v1/models into the model field.
To see which features we tested, check the model capability table. For examples of streaming, function calls, and JSON replies, see chat recipes.
meikaiTokenAuthorizationBearer <token>Enter your personal Meikai API token.
application/json- body
model?stringCopy a text model ID from GET /v1/models. If you leave this out, Meikai uses zai-org/GLM-5.2, which may be unavailable.
messages*array<>Send the messages in order, oldest first. After running a tool, include the original tool call and its result in your next request.
1 <= itemsmax_tokens?integerThe most tokens the model can use to produce the reply. A token is a small piece of text. Some models use part of this limit to work out the answer.
1 <= valuemax_completion_tokens?integerAnother way to set the output limit, including any reasoning tokens. Use this or max_tokens, whichever your model supports.
1 <= valuereasoning_effort?stringAdjust how much work the model does before answering. Accepted values vary. GPT OSS 20B accepted low in our tests.
temperature?numberLower values make replies more predictable. Higher values allow more variety. Support varies by model.
0 <= value <= 2top_p?numberLimit the choice of the next token to the most likely ones. For example, 0.9 keeps the smallest set whose probabilities add up to at least 90%. Omit this field on models that do not support it.
0 <= value <= 1stop?|array<string>Tell the model to stop when it reaches one of these strings. Support varies by model.
stream?booleanSend the reply in pieces as the model writes it. Each piece arrives as a server-sent event.
falsestream_options?To use these options, set stream to true.
tools?array<>Describe the functions your app can run. The model can ask for a function by name. Your app checks the arguments, runs the function, and sends back the result.
tool_choice?|Let the model choose a tool (auto), prevent tool calls (none), require a tool call (required), or name a specific function. Support varies by model.
response_format?Describe the JSON you want back, including the fields it must contain. Use a model that supports this option and check its reply in your app.
The full reply, or a stream that delivers the reply in pieces.
- response
id?stringobject?stringcreated?integerTime the model created the reply, in seconds since January 1, 1970 (UTC). Some models omit this field.
model?stringchoices?array<>usage?|Token counts for the messages you sent and the reply the model generated. Some models also report cached or reasoning tokens.
curl -X POST 'https://example.com/v1/chat/completions' \ -H 'Authorization: Bearer YOUR_MEIKAI_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "model": "meta-llama/Llama-3.3-70B-Instruct", "messages": [ { "role": "user", "content": "Explain DNS in two sentences." } ], "max_tokens": 2048}'{ "id": "chatcmpl-example", "object": "chat.completion", "model": "meta-llama/Llama-3.3-70B-Instruct", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "DNS translates domain names into IP addresses." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 18, "completion_tokens": 12, "total_tokens": 30 }}