diff --git a/common/parsers/k2-horizon.cpp b/common/parsers/k2-horizon.cpp
index 1afd578c8..e688cd919 100644
--- a/common/parsers/k2-horizon.cpp
+++ b/common/parsers/k2-horizon.cpp
@@ -48,6 +48,11 @@ common_chat_params common_chat_params_init_k2_horizon(const common_chat_template
data.thinking_start_tag = THINK_START;
data.thinking_end_tags = { THINK_END };
+ // The models sometimes close medium/low reasoning with the generic
+ if (think != "ifm|think") {
+ data.thinking_end_tags.push_back("");
+ }
+
data.preserved_tokens = data.thinking_end_tags;
data.preserved_tokens.insert(data.preserved_tokens.end(), {
THINK_START, SECTION_START, SECTION_END, CALL_START, CALL_END,
diff --git a/tests/test-chat.cpp b/tests/test-chat.cpp
index 2c59d1222..7752015c8 100644
--- a/tests/test-chat.cpp
+++ b/tests/test-chat.cpp
@@ -5206,6 +5206,25 @@ static void test_template_output_peg_parsers(bool detailed_debug) {
.expect_reconstruction()
.run();
+ tst.test("I'm\nthinkingHello, world!\nWhat's up?")
+ .reasoning_format(COMMON_REASONING_FORMAT_AUTO)
+ .chat_template_kwargs({ { "reasoning_effort", R"("low")" } })
+ .expect(message_assist_thoughts)
+ .run();
+
+ tst.test(
+ "I'm\nthinking\n"
+ "special_function\n"
+ "arg1\n"
+ "1\n"
+ "\n"
+ "")
+ .reasoning_format(COMMON_REASONING_FORMAT_AUTO)
+ .tools({ special_function_tool })
+ .chat_template_kwargs({ { "reasoning_effort", R"("medium")" } })
+ .expect(message_assist_call_thoughts)
+ .run();
+
tst.test(
"I'm\nthinking\n"
"{\"name\": \"special_function\", \"arguments\": {\"arg1\": 1}}\n"