mlx-optiq

API reference

The API follows OpenAI's chat completions format at one base URL. You authenticate with a key from the dashboard.

Base URL https://cloud.mlx-optiq.com/api/v1

Authentication

Create a key on the dashboard and send it as a bearer token: Authorization: Bearer sk-optiq-cloud-…. A key is shown once, when it is made. Each key has its own limits.

Endpoints

MethodPathWhat it does
POST/chat/completionsA chat completion, in OpenAI's format, streamed or not.
GET/modelsThe models, with their prices and context windows. No key needed.

Examples

With curl, and with OpenAI's Python client:

$ curl https://cloud.mlx-optiq.com/api/v1/chat/completions \
    -H "Authorization: Bearer $OPTIQ_CLOUD_API_KEY" -H "Content-Type: application/json" \
    -d '{"model": "glm-5.3-flash", "messages": [{"role": "user", "content": "Hello"}]}'
from openai import OpenAI

client = OpenAI(base_url="https://cloud.mlx-optiq.com/api/v1", api_key=OPTIQ_CLOUD_API_KEY)
reply = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Hello"}],
    reasoning_effort="low",
)

Request fields

A request is OpenAI's chat completions body. These fields are used:

FieldWhat it does
modelA model id from GET /models, optionally with :think or :no-think (see Reasoning).
messagesThe conversation. Required.
tools, tool_choice, parallel_tool_callsFunction calling, as in OpenAI's API.
streamServer-sent events; see Streaming.
max_tokens or max_completion_tokensThe reply's cap, thinking included. Lowered to the model's own limit if higher; no cap is sent if you set none.
reasoning_effortHow much the model thinks before it answers. Also accepted as reasoning: {"effort": …}. The values each model takes are under Reasoning.
response_format{"type": "json_object"} or a JSON schema.
temperature, top_pSampling. Left out, they are the values the model was tested with.
stop, seed, frequency_penalty, presence_penaltyAs in OpenAI's API.

Some fields are refused with a 400, because they ask for something no model here does and dropping them would hide that: thinking, enable_thinking, reasoning.enabled and reasoning.max_tokens. The messages are listed under Reasoning errors.

Any other field is accepted and ignored, including n, user, logprobs, logit_bias and stream_options. chat_template_kwargs is ignored too: optiq serve sends it when an Anthropic client such as Claude Code asks to think, and it has no effect on these models. Each reply's usage says what the call cost and the balance left.

Reasoning

Every model here can think before it answers, and you are billed for thinking as output. There are two ways to control it. Use reasoning_effort, OpenAI's field. Or add a suffix to the model id: :think asks for the model's default, the same as sending no effort, and :no-think turns thinking off where the model can. Use one or the other, not both.

Modelreasoning_effortThinking offDefault
glm-5.3-flashminimal, low, medium, high, xhighNot available: none and :no-think are refusedThinks fully
glm-5.3minimal, low, medium, high, xhighNot availableThinks fully
minimax-m3.1-flashminimal, low, medium, high, xhighNot availableThinks fully
deepseek-v4.1-flashnone, minimal, low, medium, high, xhighnone or :no-thinkThinks fully
deepseek-v4-pronone, minimal, low, medium, high, xhighnone or :no-thinkThinks fully
mimo-v2.6-flashnone, minimal, low, medium, high, xhighnone or :no-thinkThinks briefly
minimax-m3none, minimal, low, medium, high, xhighnone or :no-thinkDoes not think unless you set an effort
qwen3.8-27bnone, minimal, low, medium, high, xhighnone or :no-thinkThinks

An effort is a request, not a budget: the model decides how much a task needs. What we measured in October 2026, on a logic puzzle and on a 16k-token JSON task:

  • GLM 5.3 Flash and GLM 5.3: minimal to medium think briefly, a few hundred tokens, and often under 200 on an easy task. high and xhigh think somewhat more. With no effort set, the model thinks fully, from about 1,000 tokens to over 8,000 on a hard problem. There is no middle setting between the two.
  • MiniMax M3.1 Flash: thinking grows with the effort, from about 1,000 tokens at low to over 4,000 at xhigh on the puzzle.
  • DeepSeek V4.1 Flash: none answers without thinking. Every other effort thinks a similar amount, about 700 to 1,200 tokens on the JSON task and 2,500 to 5,000 on the puzzle.
  • DeepSeek V4 Pro (measured November 2026, on the puzzle): none answers without thinking, low thinks about 140 tokens, and the default and high about 500 to 560.
  • MiMo V2.6 Flash: thinks little at every effort, under 100 tokens on the puzzle.
  • MiniMax M3: answers without thinking unless you set an effort; low thinks about 200 tokens and high about 270.
  • Qwen3.8 27B: about 120 to 190 tokens at every effort; none turns it off.

To answer fastest on a model that always thinks, use minimal or low. A thinking budget in tokens is not offered: providers treat one as a rough level, not a limit, so reasoning.max_tokens is refused rather than quietly ignored.

Reasoning errors

Each is a 400 with code invalid_request, before the model runs, so nothing is charged.

You sendMessage
reasoning_effort: "none" on a model that always thinksGLM 5.3 Flash always thinks, so reasoning_effort "none" is not available. "minimal" or "low" thinks least.
glm-5.3-flash:no-think (and the other models that always think)glm-5.3-flash:no-think is not available: GLM 5.3 Flash always thinks. Use reasoning_effort "minimal" or "low" for the least thinking.
A suffix and reasoning_effort togetherSet either the :think suffix or reasoning_effort, not both.
An effort that is not in the model's list, such as "max"reasoning effort must be one of minimal, low, medium, high, xhigh
thinking (Anthropic's field)`thinking` is Anthropic's field and is not supported. Use reasoning_effort, one of …
enable_thinking`enable_thinking` is a chat-template setting and is not supported. Use reasoning_effort, one of …
reasoning: {"enabled": …}reasoning.enabled is not supported. Use reasoning_effort, one of …
reasoning: {"max_tokens": …}reasoning.max_tokens is not supported: providers do not keep to it. Use reasoning_effort, one of …

Streaming, usage and sessions

Set "stream": true for server-sent events in OpenAI's chunk format. The last chunk carries usage, with the call's cost in dollars and your remaining balance in usage.optiq_cloud; a reply that is not streamed carries the same usage.

Send an x-session-id header with the same value on every call of one task. Calls with the same session keep the conversation's prompt cache, which keeps cached input high, and the dashboard groups them into one task.

Rate-limit headers

Every response carries x-ratelimit-limit-requests, x-ratelimit-remaining-requests and x-ratelimit-reset-requests for the key's per-minute limit. A refused call (429) also carries Retry-After, in seconds.

Errors

Each case comes back as a plain message in the client's own format, and nothing is charged for a call that did not run.

CaseHTTPCode
No key, or a revoked or unknown key401invalid_token
Expired key401key_expired
Balance empty402insufficient_balance
Key at its monthly spending limit403key_spend_limit_reached
Model not allowed for this key403model_not_allowed
A request field or value the model cannot take (see Reasoning errors)400invalid_request
Model not on the list404model_not_found
Too many requests, or too many at once429rate_limit_exceeded, concurrency_limit_exceeded
The model is unavailable right now503model_unavailable
Not signed in, through optiq serve401run optiq cloud login
Another machine, through optiq serve403refused by optiq serve