Skip to content

Chat Completions

The LLMTR gateway is compatible with the OpenAI Chat Completions API. All requests POST to https://llmtr.com/v1/chat/completions.

POST /v1/chat/completions
Authorization: Bearer llmtr-your_key
Content-Type: application/json
FieldTypeRequiredDescription
modelstringyesCanonical model ID (e.g. openai/gpt-4o)
messagesarrayyesOpenAI messages format
streambooleannotrue enables SSE stream
temperaturenumberno0-2 range, model-specific default
max_tokensintegernoOutput token cap
top_pnumbernoNucleus sampling
frequency_penaltynumberno-2 to 2
presence_penaltynumberno-2 to 2
stopstring/arraynoStop sequences
response_formatobjectno{ "type": "json_object" } on supported models
toolsarraynoFunction calling (supported models)
tool_choicestring/objectnoauto, none or specific tool
Terminal window
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
}'

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
}
}

Models are always referenced as provider/model:

  • openai/gpt-4o
  • anthropic/claude-sonnet-4.5
  • google/gemini-2.5-flash
  • deepseek/deepseek-v4-flash
  • mistral/mistral-large-latest

Use the dashboard model list or /api/models for the full catalog.

Some providers support extra body fields or custom options. You can include supported fields directly in the request body.

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/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/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.

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 IDReplacement model IDTransition behavior
mimo/mimo-v2-promimo/mimo-v2.5-proAutomatically forwarded by LLMTR starting 2026-06-01
mimo/mimo-v2-omnimimo/mimo-v2.5Automatically forwarded by LLMTR starting 2026-06-01
mimo/mimo-v2-flashmimo/mimo-v2.5Automatically 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"
HTTPerror.typeMeaning
400invalid_request_errorInvalid parameter / missing field
401auth_errorInvalid or expired API key
403forbiddenNo access to the model
410model_retiredModel retired; use the replacement model ID from the error message
429rate_limit_exceededRate limit hit
500internal_errorGateway internal error
502provider_errorUpstream provider failure

See Errors for the full list.