Integration guides · 2026-10-17
reasoning_effort and max_tokens on K2 Horizon
ifm/k2-horizon-375b-a23b reasons before every answer: choosing between medium and high, catching a max_tokens cut and the daily token allowance, with Python.
Short answer: choose medium or high and leave room in max_tokens
LLMTR is a gateway that gives access to language models from different providers through one OpenAI-compatible API. You call K2 Horizon with the id ifm/k2-horizon-375b-a23b on the /v1/chat/completions endpoint at https://llmtr.com/v1. The model reasons before every answer and reasoning cannot be turned off; reasoning_effort selects medium or high.
IFM's model card recommends high at all times and does not recommend the medium and low settings except for research on reasoning levels. All results the card reports were obtained with high. On LLMTR, medium can be used for jobs where shorter reasoning is enough; low is not accepted on this row.
How do you set reasoning_effort and max_tokens on K2 Horizon?
Reasoning tokens and the answer share the same max_tokens limit. The model reasons first and then writes the answer; if the limit fills up before reasoning ends, the response comes back with an empty content and finish_reason length. So choose max_tokens for reasoning and answer combined, not for the length of the answer alone.
The Python example below asks a question and, when finish_reason is length, doubles max_tokens and tries again, at most three times. The starting value is 8,192 tokens; a response cut on the first try is repeated with 16,384 and then 32,768. The function takes medium or high through its effort parameter.
To see which level is enough for your job, send the same question with medium and with high and compare usage.completion_tokens in the responses. The reasoning itself is in the response's reasoning_content field.
An OpenAI Python SDK helper that asks ifm/k2-horizon-375b-a23b a question with the chosen reasoning_effort and, when finish_reason is length, doubles max_tokens and retries at most three times.
import os
from openai import OpenAI
client = OpenAI(base_url="https://llmtr.com/v1", api_key=os.environ["LLMTR_API_KEY"])
def ask(question: str, effort: str = "high", max_tokens: int = 8192) -> str:
for _ in range(3):
response = client.chat.completions.create(
model="ifm/k2-horizon-375b-a23b",
messages=[{"role": "user", "content": question}],
reasoning_effort=effort,
max_tokens=max_tokens,
)
choice = response.choices[0]
if choice.finish_reason != "length":
return choice.message.content or ""
# Reasoning used the budget before the answer was finished.
max_tokens *= 2
raise RuntimeError("answer still cut at max_tokens=" + str(max_tokens))
print(ask("List three risks of storing API keys in a mobile app.", effort="medium"))
Accepted values and error cases
The table shows how LLMTR answers each reasoning setting on this row. Refused values return 400 invalid_request before the request reaches the model, and the error message names the accepted levels or the level to use.
| Setting | Result |
|---|---|
| reasoning_effort high | Accepted; the level IFM recommends |
| reasoning_effort medium | Accepted; shorter reasoning |
| No field | The model still reasons |
| reasoning_effort low, none, minimal | 400 invalid_request |
| reasoning: { enabled: false } | 400 invalid_request; use medium |
Streaming, timeouts and what the cost buys
For requests that reason at length, stream true keeps the client from sitting silent for a long time: the reasoning chunks arrive first in the reasoning_content field, then the answer in content. If you do not stream, set your client's read timeout for long reasoning.
Until 5 November 2026, 23:59 (TRT), reasoning tokens count against the daily allowance rather than money. Choosing the level to fit the job is still the right habit: when you later move to a paid model, the same setting shows up directly on the bill.
Comparing medium and high on your own job
Do not choose the level from a single question. Pick about twenty typical questions from your application whose answers you know, and send each once with medium and once with high. For every response, write down in a table whether the answer is right, the usage.completion_tokens value and the response time.
If the share of right answers is the same at both levels, you can choose medium; it spends fewer tokens and finishes sooner. If wrong answers increase at medium, stay on high. Once you have decided, keep the level as a fixed setting in code, and repeat the comparison when the kind of questions you ask changes.
The comparison counts toward the daily allowance too: twenty questions at two levels make forty requests. If you work with long questions, spread the comparison over a few days.
Free period, daily allowance and the data note
The row is free until 5 November 2026, 23:59 (TRT), and every account has an allowance of 200,000 tokens a day for this model, and new accounts start with a smaller allowance on their first day; input and output are added up, and reasoning tokens count as output. A retry that doubles max_tokens counts toward the allowance too. When the allowance is used up the API returns 429, the Retry-After header tells you when you can try again, and the allowance renews at 00:00 (TRT). From 6 November 2026, 00:00 the model returns 410 model_retired.
According to the data note on the LLMTR model page, prompts and completions may be logged by the provider and used to improve the model; do not send sensitive, personal or customer data.
Set the reasoning level and max_tokens on K2 Horizon
Choose the level, give max_tokens for reasoning and answer combined, and retry with a higher limit when finish_reason is length.
- Level. Start with high for reasoning_effort; try medium if shorter reasoning is enough.
- Limit. Give max_tokens at least 8,192 tokens; reasoning and the answer share this limit.
- Catch the cut. If finish_reason is length, double max_tokens and repeat the request, with a limit on the number of tries.
Frequently asked questions
Can I turn reasoning off on K2 Horizon?
No. The model reasons before every answer. reasoning_effort low, none and reasoning enabled false return 400; use medium for the shortest reasoning.
Why does the response come back with an empty content?
Reasoning tokens filled the max_tokens limit before the answer was written, so finish_reason is length. Raise max_tokens and repeat the request.
Which level is recommended for K2 Horizon?
IFM's model card recommends high at all times. LLMTR also accepts medium; try the same question at both levels and choose by comparing completion_tokens and the answer.