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

Applies to mimo/mimo-v2-pro, mimo/mimo-v2-omni, mimo/mimo-v2-flash.

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
429rate_limit_exceededRate limit hit
500internal_errorGateway internal error
502provider_errorUpstream provider failure

See Errors for the full list.