Core features
Reasoning
Use reasoning-optimised models for complex multi-step problems.
POST
/v1/chat/completions
Reasoning-optimised models use extended internal deliberation before responding, trading latency for higher accuracy on complex tasks.
Request body
Reasoning models share the standard chat completions request shape. Some models also accept the optional fields below — treat them as best-effort and confirm support per model.
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | Yes | A reasoning-capable model id from /v1/models. |
messages | array | Yes | user and assistant turns. System prompts may be limited on some reasoning models. |
max_completion_tokens | integer | No | Where supported, controls the total token budget (reasoning tokens + output tokens). Some models use max_tokens instead. |
reasoning_effort | string | No | low, medium, or high where supported. Higher effort = more thorough reasoning at greater cost. Unsupported models ignore or reject it. |
Example request
{
"model": "myt/qwen3.6-35b-a3b",
"messages": [
{
"role": "user",
"content": "What is the fastest sorting algorithm for nearly-sorted arrays and why?"
}
],
"max_completion_tokens": 2048
}Response
{
"id": "chatcmpl-reason123",
"object": "chat.completion",
"created": 1749366600,
"model": "myt/qwen3.6-35b-a3b",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "For nearly-sorted arrays, Insertion Sort is the fastest in practice with O(n + d) time complexity, where d is the number of inversions..."
}
}
],
"usage": {
"prompt_tokens": 22,
"completion_tokens": 312,
"total_tokens": 334
}
}When a model reports its internal reasoning usage, it appears under usage.completion_tokens_details.reasoning_tokens. Those tokens count against your budget but are not returned in the message content. Not every model reports this field.
Errors
| Status | When |
|---|---|
400 | Unsupported parameter for the chosen model (e.g. temperature, stream, reasoning_effort) |
401 | API key missing or invalid |
403 | Model not enabled for your project |
429 | Rate limit or budget exceeded |
Code examples
curl -sS --request "POST" \
--url "$MYT_BASE_URL/chat/completions" \
--header "Authorization: Bearer $MYT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"model":"myt/qwen3.6-35b-a3b","messages":[{"role":"user","content":"What is the fastest sorting algorithm for nearly-sorted arrays and why?"}],"max_completion_tokens":2048}'Full parameter reference: Chat completions.