myt AI Cloud

By Mauritius Telecom

Beta
⌘K
API reference

Chat completions

POST /v1/chat/completions — multi-turn chat and instruction calls.

POST

/v1/chat/completions

Creates a chat completion for the given messages. Supports streaming via stream: true.

Request (selected fields)

FieldTypeRequiredNotes
modelstringYesModel id from /v1/models.
messagesarrayYesOpenAI-style chat messages (system, user, assistant).
streambooleanNotrue to receive tokens as server-sent events.
temperaturenumberNoSampling temperature (0–2).
top_pnumberNoNucleus sampling threshold.
max_tokensintegerNoMaximum tokens to generate.
stopstring or arrayNoStop sequence(s).
response_formatobjectNo{ "type": "json_object" } or { "type": "json_schema", "json_schema": {...} }.

Response (non-streaming)

{
"id": "chatcmpl-example",
"object": "chat.completion",
"created": 1710000000,
"model": "myt/qwen3.6-35b-a3b",
"choices": [
  {
    "index": 0,
    "finish_reason": "stop",
    "message": { "role": "assistant", "content": "Hello!" }
  }
],
"usage": {
  "prompt_tokens": 10,
  "completion_tokens": 5,
  "total_tokens": 15
}
}

Streaming

With stream: true, the response uses server-sent events; each chunk mirrors OpenAI streaming semantics.

Errors

{
  "error": {
    "message": "Invalid model: unknown-model",
    "type": "invalid_request_error",
    "code": null
  }
}

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":"Hello"}]}'

Try it

On this page