Integration guides · 2026-10-17
The K2 Horizon API: a 375B-parameter open-weight model
Call ifm/k2-horizon-375b-a23b through an OpenAI-compatible API: it reasons before every answer, 524,288-token context, tool calling, free until 5 November 2026.
Short answer: call K2 Horizon with the OpenAI SDK
LLMTR is a gateway that gives access to language models from different providers through one OpenAI-compatible API. You call K2 Horizon there with the model id ifm/k2-horizon-375b-a23b on the /v1/chat/completions endpoint at https://llmtr.com/v1. With the OpenAI SDK only base_url and the model id change.
K2 Horizon is a model family developed by the Institute of Foundation Models (IFM) at MBZUAI. According to IFM's model card, 375B-A23B stores 375 billion parameters and runs 23 billion of them per token. Its context window is 524,288 tokens and the weights are open under Apache 2.0. The family's models adapted to Arabic carry the name Jais 3.
How do you use the K2 Horizon API?
Create an API key on LLMTR and keep it in the LLMTR_API_KEY environment variable. Set the OpenAI client's base_url to https://llmtr.com/v1 and pass ifm/k2-horizon-375b-a23b as the model. The Python example below sends a question with the settings IFM recommends in its model card: reasoning_effort high, temperature 1.0 and top_p 0.95.
The model reasons before every answer, and that cannot be turned off. The reasoning comes back in the response's reasoning_content field and the answer in content. Reasoning tokens count toward max_tokens; a short limit cuts reasoning off before the answer is written, and the response comes back with an empty content and finish_reason length. That is why the example gives 16,384 tokens and checks for the cut.
When you send the request with stream true, the reasoning chunks arrive first in the reasoning_content field, followed by the answer chunks in content. If you send include_usage true in stream_options, the last chunk of the stream carries the token usage.
An OpenAI Python SDK example that sends a question to ifm/k2-horizon-375b-a23b with the reasoning_effort, temperature and top_p settings IFM recommends, checks for a max_tokens cut and prints the token usage.
import os
from openai import OpenAI
client = OpenAI(base_url="https://llmtr.com/v1", api_key=os.environ["LLMTR_API_KEY"])
response = client.chat.completions.create(
model="ifm/k2-horizon-375b-a23b",
messages=[
{"role": "system", "content": "You are a careful senior engineer. Answer briefly."},
{
"role": "user",
"content": "A cron job runs at 02:30 every day in Europe/Istanbul. "
"What UTC time is that, and does it change with daylight saving time?",
},
],
reasoning_effort="high",
temperature=1.0,
top_p=0.95,
max_tokens=16384,
)
choice = response.choices[0]
print(choice.message.content)
if choice.finish_reason == "length":
print("Cut at max_tokens: raise the limit, reasoning counts toward it.")
print(response.usage)
K2 Horizon's values on LLMTR
The table shows the row's values in the catalog. Messages with an image or audio part return 400 unsupported_input. For tool calling, tool_choice auto, required, a named function and none are all supported.
| Property | Value |
|---|---|
| Model id | ifm/k2-horizon-375b-a23b |
| Endpoint | /v1/chat/completions |
| Price (per 1M tokens) | $0 input / $0 output, until 5 November 2026, 23:59 (TRT) |
| Daily allowance | 200,000 tokens per model (input + output); smaller on a new account's first day |
| Context window | 524,288 tokens |
| Input | text only |
| Reasoning | always on; reasoning_effort medium or high |
| Tool calling and JSON | every tool_choice form; json_object and json_schema |
Working with long context and tools
The 524,288-token window is shared by the prompt and the answer. If you send a long document in the prompt, leave room for the reasoning and the answer; usage.prompt_tokens in the response tells you the prompt's real size.
K2 Horizon calls tools in the OpenAI format and also supports required and a named function for tool_choice, so it works with tools that rely on forced tool calls, such as LangChain's structured output helpers. In a multi-turn conversation you do not need to send reasoning_content back when you add earlier assistant messages to the history.
IFM's model card lists English as the language. For Arabic, the same family's Jais 3 model was built.
Error cases and what to do
400 invalid_request says the request carries a value this row does not accept: reasoning_effort low or none, or a reasoning field that turns reasoning off. 400 unsupported_input is for a message with an image or audio part. These errors come back before the request reaches the model; read the message and fix the request instead of repeating it as it is.
429 comes in two cases. If Retry-After is a few seconds, the short-term request limit is full; wait that long and repeat. If Retry-After is measured in hours, the daily allowance is used up; try again after 00:00 (TRT). 503 model_unavailable reports a temporary problem; if Retry-After is present, try again after that time.
The 410 model_retired that arrives from 6 November 2026, 00:00 (TRT) is permanent. Read the model id from configuration in your code; then moving to another model means changing a single setting.
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; input and output are added up, and reasoning tokens count as output. This allowance is counted apart from Jais 3's. 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). New accounts start with a smaller allowance on their first day. From 6 November 2026, 00:00 the model returns 410 model_retired, and requests are not routed to another model.
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.
Send a first request to K2 Horizon
Create an API key, set base_url to https://llmtr.com/v1 and send a question with ifm/k2-horizon-375b-a23b.
- API key. Create an account at llmtr.com, create a key under Dashboard > API Keys and keep it in the LLMTR_API_KEY environment variable.
- Set up the client. In the OpenAI SDK, set base_url to https://llmtr.com/v1 and use ifm/k2-horizon-375b-a23b as the model.
- Request. Send the question with reasoning_effort high and a max_tokens that leaves room for reasoning, and check the finish_reason value.
Frequently asked questions
Can reasoning be turned off on K2 Horizon?
No. The model reasons before every answer. reasoning_effort selects medium or high; low, none and reasoning enabled false return 400.
What context does ifm/k2-horizon-375b-a23b support?
524,288 tokens. The window is shared by the prompt and the answer, and reasoning tokens are part of the answer.
Does K2 Horizon support tool calling?
Yes. It calls tools in the OpenAI format; auto, required, a named function and none are supported for tool_choice. json_object and json_schema are open in response_format too.