Chat Completions
The LLMTR gateway is compatible with the OpenAI Chat Completions API. All requests POST to https://llmtr.com/v1/chat/completions.
Request
Section titled “Request”POST /v1/chat/completionsAuthorization: Bearer llmtr-your_keyContent-Type: application/jsonBody parameters
Section titled “Body parameters”| Field | Type | Required | Description |
|---|---|---|---|
model | string | yes | Canonical model ID (e.g. openai/gpt-4o) |
messages | array | yes | OpenAI messages format |
stream | boolean | no | true enables SSE stream |
temperature | number | no | 0-2 range, model-specific default |
max_tokens | integer | no | Output token cap |
top_p | number | no | Nucleus sampling |
frequency_penalty | number | no | -2 to 2 |
presence_penalty | number | no | -2 to 2 |
stop | string/array | no | Stop sequences |
response_format | object | no | { "type": "json_object" } on supported models |
tools | array | no | Function calling (supported models) |
tool_choice | string/object | no | auto, none or specific tool |
Basic example
Section titled “Basic example”curl https://llmtr.com/v1/chat/completions \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-4o", "messages": [ {"role": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "What is LLMTR?"} ], "temperature": 0.3, "max_tokens": 200 }'Response
Section titled “Response”Successful response mirrors OpenAI’s format exactly:
{ "id": "chatcmpl-xxx", "object": "chat.completion", "created": 1739200000, "model": "openai/gpt-4o", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "LLMTR is a unified gateway..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 24, "completion_tokens": 52, "total_tokens": 76 }}Model identifier format
Section titled “Model identifier format”Models are always referenced as provider/model:
openai/gpt-4oanthropic/claude-sonnet-4.5google/gemini-2.5-flashdeepseek/deepseek-v4-flashmistral/mistral-large-latest
Use the dashboard model list or /api/models for the full catalog.
Provider-specific behaviors
Section titled “Provider-specific behaviors”Some providers support extra body fields or custom options. You can include supported fields directly in the request body.
Tencent Hy3
Section titled “Tencent Hy3”tencent/hy3 keeps thinking disabled by default. Enable it with either a canonical suffix or the standard body field:
{ "model": "tencent/hy3:low", "messages": [{ "role": "user", "content": "Analyze this code." }] }{ "model": "tencent/hy3", "reasoning": { "effort": "high" }, "messages": [{ "role": "user", "content": "Analyze this code." }] }Only low and high are supported. Low requests that contain tools run as high upstream because of Hy3’s adaptive-thinking behavior. Responses may include reasoning_content, usage.completion_tokens_details.reasoning_tokens, and usage.prompt_tokens_details.cached_tokens after a cache hit. Reasoning tokens are already included in completion_tokens and are not billed twice.
During multi-step tool calling, append the returned assistant message with its tool_calls, content, and reasoning_content fields intact. Dropping the field breaks the reasoning context for the next turn.
LLMTR Qwen 3.5 4B (Turkey)
Section titled “LLMTR Qwen 3.5 4B (Turkey)”llmtr/qwen3-5-4b is hosted in Turkey: requests are never forwarded to a third-party provider. It offers a 64K context window (prompt and completion together) and supports tool calling.
Thinking is off by default. Enable it with the canonical suffix or the body field:
{ "model": "llmtr/qwen3-5-4b:think", "messages": [{ "role": "user", "content": "Solve this step by step." }], "max_tokens": 2048 }{ "model": "llmtr/qwen3-5-4b", "reasoning": true, "messages": [{ "role": "user", "content": "Solve this step by step." }], "max_tokens": 2048 }With thinking on, the model produces a long reasoning pass before answering; it is returned in message.reasoning_content. That reasoning is spent from the max_tokens budget: if the budget is small it is consumed entirely by reasoning, content comes back empty, and finish_reason is length. Set max_tokens to at least 2048 whenever you enable thinking. With thinking off, no extra reasoning tokens are spent and responses are noticeably faster.
The model supports prompt caching. Re-sending the same prompt prefix (for example a fixed system prompt) hits the cache; the number of tokens served from it is returned in usage.prompt_tokens_details.cached_tokens and those tokens are billed at the discounted cache-read rate. To lower cost in RAG and chatbot flows with long system prompts, keep the fixed content at the start of the message array and the varying content at the end.
The model is text-only; sending image, audio, or video input returns a 400 unsupported_input.
Moonshot AI (Kimi)
Section titled “Moonshot AI (Kimi)”moonshot/kimi-k3, moonshot/kimi-k2.7-code, moonshot/kimi-k2.6, and moonshot/kimi-k2.5 run with thinking enabled by default. moonshot/kimi-k2.7-code does not support non-thinking mode; omit thinking or use { "type": "enabled" }. thinking: { "type": "disabled" } returns 400 invalid_request.
For moonshot/kimi-k3, thinking can be turned off: send "reasoning": false in the request body or append the :fast suffix to the model name (moonshot/kimi-k3:fast). The :think suffix keeps thinking on; without a suffix or reasoning field the default is thinking on. With thinking off, the response carries no reasoning_content and no reasoning tokens are produced. Reasoning tokens are billed as output, so keep max_tokens generous even for short answers (at least 1024 recommended).
Kimi K3, K2.7 Code, K2.6, and K2.5 have fixed sampling values: temperature=1, top_p=0.95, n=1, presence_penalty=0, and frequency_penalty=0. Unsupported n, presence/frequency penalties, or unsupported Kimi tool_choice forms are rejected with 400 before the upstream call. The K2 family accepts only auto or none for tool_choice; kimi-k3 additionally supports required. The {"type": "function", ...} form that forces a specific function is not supported on any Kimi model.
kimi-k3 does not support web search; requests containing $web_search return 400. Use kimi-k2.7-code or kimi-k2.6 for flows that need web search.
During multi-step tool calling, Kimi may return reasoning_content on the assistant tool-call message. Preserve that assistant message with both tool_calls and reasoning_content before sending the following tool-result turn. LLMTR preserves this provider-specific field across the round trip.
For media input, use base64 data URLs instead of remote URLs. Image and video parts must be sent as data: URLs; remote media URLs return 400 unsupported_input.
Xiaomi MiMo
Section titled “Xiaomi MiMo”Active chat model identifiers: mimo/mimo-v2.5-pro, mimo/mimo-v2.5.
Legacy MiMo V2 model identifiers return model_retired (HTTP 410) after 2026-06-30 00:00 Beijing time. The endpoint and API key do not change; update only the model ID to the replacement below.
| Legacy model ID | Replacement model ID | Transition behavior |
|---|---|---|
mimo/mimo-v2-pro | mimo/mimo-v2.5-pro | Automatically forwarded by LLMTR starting 2026-06-01 |
mimo/mimo-v2-omni | mimo/mimo-v2.5 | Automatically forwarded by LLMTR starting 2026-06-01 |
mimo/mimo-v2-flash | mimo/mimo-v2.5 | Automatically routed by MiMo upstream starting 2026-06-18; the legacy ID is no longer accepted after 2026-06-30 |
MiMo TTS is not currently exposed through LLMTR. TTS/ASR support will be documented separately when those operations are available.
Enabling web search. Both forms are accepted:
// Option 1: Via the tools field{ "tools": [{ "type": "web_search" }] }
// Option 2: Via the body field{ "webSearchEnabled": true }Search-enabled requests may carry extra provider-side charges. Check the current model pricing before sending production traffic.
Thinking control. On supported models, add thinking to the body to control this behavior:
{ "thinking": { "type": "enabled" } } // or "disabled"Error codes
Section titled “Error codes”| HTTP | error.type | Meaning |
|---|---|---|
| 400 | invalid_request_error | Invalid parameter / missing field |
| 401 | auth_error | Invalid or expired API key |
| 403 | forbidden | No access to the model |
| 410 | model_retired | Model retired; use the replacement model ID from the error message |
| 429 | rate_limit_exceeded | Rate limit hit |
| 500 | internal_error | Gateway internal error |
| 502 | provider_error | Upstream provider failure |
See Errors for the full list.