API reference
The API follows OpenAI's chat completions format at one base URL. You authenticate with a key from the dashboard.
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
| Method | Path | What it does |
|---|---|---|
| POST | /chat/completions | A chat completion, in OpenAI's format, streamed or not. |
| GET | /models | The 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:
| Field | What it does |
|---|---|
model | A model id from GET /models, optionally with :think or :no-think (see Reasoning). |
messages | The conversation. Required. |
tools, tool_choice, parallel_tool_calls | Function calling, as in OpenAI's API. |
stream | Server-sent events; see Streaming. |
max_tokens or max_completion_tokens | The reply's cap, thinking included. Lowered to the model's own limit if higher; no cap is sent if you set none. |
reasoning_effort | How 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_p | Sampling. Left out, they are the values the model was tested with. |
stop, seed, frequency_penalty, presence_penalty | As 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.
| Model | reasoning_effort | Thinking off | Default |
|---|---|---|---|
glm-5.3-flash | minimal, low, medium, high, xhigh | Not available: none and :no-think are refused | Thinks fully |
glm-5.3 | minimal, low, medium, high, xhigh | Not available | Thinks fully |
minimax-m3.1-flash | minimal, low, medium, high, xhigh | Not available | Thinks fully |
deepseek-v4.1-flash | none, minimal, low, medium, high, xhigh | none or :no-think | Thinks fully |
deepseek-v4-pro | none, minimal, low, medium, high, xhigh | none or :no-think | Thinks fully |
mimo-v2.6-flash | none, minimal, low, medium, high, xhigh | none or :no-think | Thinks briefly |
minimax-m3 | none, minimal, low, medium, high, xhigh | none or :no-think | Does not think unless you set an effort |
qwen3.8-27b | none, minimal, low, medium, high, xhigh | none or :no-think | Thinks |
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:
minimaltomediumthink briefly, a few hundred tokens, and often under 200 on an easy task.highandxhighthink 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
lowto over 4,000 atxhighon the puzzle. - DeepSeek V4.1 Flash:
noneanswers 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):
noneanswers without thinking,lowthinks about 140 tokens, and the default andhighabout 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;
lowthinks about 200 tokens andhighabout 270. - Qwen3.8 27B: about 120 to 190 tokens at every effort;
noneturns 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 send | Message |
|---|---|
reasoning_effort: "none" on a model that always thinks | GLM 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 together | Set 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.
| Case | HTTP | Code |
|---|---|---|
| No key, or a revoked or unknown key | 401 | invalid_token |
| Expired key | 401 | key_expired |
| Balance empty | 402 | insufficient_balance |
| Key at its monthly spending limit | 403 | key_spend_limit_reached |
| Model not allowed for this key | 403 | model_not_allowed |
| A request field or value the model cannot take (see Reasoning errors) | 400 | invalid_request |
| Model not on the list | 404 | model_not_found |
| Too many requests, or too many at once | 429 | rate_limit_exceeded, concurrency_limit_exceeded |
| The model is unavailable right now | 503 | model_unavailable |
Not signed in, through optiq serve | 401 | run optiq cloud login |
Another machine, through optiq serve | 403 | refused by optiq serve |