API
Chat completions
Send messages and process an OpenAI-compatible completion response.
Request
model and a non-empty messages array are required.
{
"model": "pro",
"messages": [
{"role": "system", "content": "Answer with short, direct sentences."},
{"role": "user", "content": "Review this deployment plan."}
],
"temperature": 0.2,
"max_tokens": 1200
}
Use max_tokens to set the maximum output. Do not send both max_tokens and max_completion_tokens in the same request. MaxLabs may lower the effective output limit when the account has limited quota left. Your request can still succeed with a shorter answer.
Response
{
"id": "completion-id",
"object": "chat.completion",
"model": "pro",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "..."},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 84,
"completion_tokens": 42,
"total_tokens": 126
}
}
Check finish_reason. A value of length means the response reached an output limit. Increase the limit only if your model and remaining quota allow it. Keep the public model value from the response; do not depend on any provider-specific identity.
