[GH-ISSUE #15029] /v1/chat/completions not support think:true #9654

Closed
opened 2026-04-12 22:32:41 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @dallisx on GitHub (Mar 24, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15029

What is the issue?

When invoking the deepseek-r1 model via the /v1/chat/completions endpoint, enabling the "think" feature is not possible. In the ollama source code, it is explicitly defined that "think" cannot be set to true, whereas the deepseek-r1 model exclusively supports "think=true". The relevant ollama source code is as follows:
var think *api.ThinkValue
var effort string

if r.Reasoning != nil {
	effort = r.Reasoning.Effort
} else if r.ReasoningEffort != nil {
	effort = *r.ReasoningEffort
}

if effort != "" {
	if !slices.Contains([]string{"high", "medium", "low", "none"}, effort) {
		return nil, fmt.Errorf("invalid reasoning value: '%s' (must be \"high\", \"medium\", \"low\", or \"none\")", effort)
	}

	if effort == "none" {
		think = &api.ThinkValue{Value: false}
	} else {
		think = &api.ThinkValue{Value: effort}
	}
}

return &api.ChatRequest{
	Model:           r.Model,
	Messages:        messages,
	Format:          format,
	Options:         options,
	Stream:          &r.Stream,
	Tools:           r.Tools,
	Think:           think,
	Logprobs:        r.Logprobs != nil && *r.Logprobs,
	TopLogprobs:     r.TopLogprobs,
	DebugRenderOnly: r.DebugRenderOnly,
}, nil

Relevant log output


OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @dallisx on GitHub (Mar 24, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15029 ### What is the issue? When invoking the deepseek-r1 model via the /v1/chat/completions endpoint, enabling the "think" feature is not possible. In the ollama source code, it is explicitly defined that "think" cannot be set to true, whereas the deepseek-r1 model exclusively supports "think=true". The relevant ollama source code is as follows: var think *api.ThinkValue var effort string if r.Reasoning != nil { effort = r.Reasoning.Effort } else if r.ReasoningEffort != nil { effort = *r.ReasoningEffort } if effort != "" { if !slices.Contains([]string{"high", "medium", "low", "none"}, effort) { return nil, fmt.Errorf("invalid reasoning value: '%s' (must be \"high\", \"medium\", \"low\", or \"none\")", effort) } if effort == "none" { think = &api.ThinkValue{Value: false} } else { think = &api.ThinkValue{Value: effort} } } return &api.ChatRequest{ Model: r.Model, Messages: messages, Format: format, Options: options, Stream: &r.Stream, Tools: r.Tools, Think: think, Logprobs: r.Logprobs != nil && *r.Logprobs, TopLogprobs: r.TopLogprobs, DebugRenderOnly: r.DebugRenderOnly, }, nil ### Relevant log output ```shell ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-12 22:32:41 -05:00
Author
Owner

@rick-github commented on GitHub (Mar 24, 2026):

"true" is not a supported value in the OpenAI API for reasoning_effort. Instead, use one of "low", "medium" or "high", which will enable reasoning. Note that thinking is enabled by default, so explictly enabling thinking (think:true or reasoning_effort:medium) is not necessary for models that support thinking.

$ for t in none low medium high ; do r="$(curl -s localhost:11434/v1/chat/completions -d '{"model":"deepseek-r1","messages":[{"role":"user","content":"why is the sky blue"}],"reasoning_effort":"'$t'","stream":false,"seed":0}' | jq -r '.choices[0].message.reasoning//""')" ; printf "%-7s %4d %s\n" $t ${#r} "${r::100}" ; done
none       0 
low     3497 Okay, the user is asking "why is the sky blue." This is a classic question that people often wonder 
medium  3497 Okay, the user is asking "why is the sky blue." This is a classic question that people often wonder 
high    3497 Okay, the user is asking "why is the sky blue." This is a classic question that people often wonder 
<!-- gh-comment-id:4117890232 --> @rick-github commented on GitHub (Mar 24, 2026): "true" is not a supported value in the [OpenAI API](https://developers.openai.com/api/docs/guides/reasoning#:~:text=to%20medium.-,Effort,-Start%20here%20when) for `reasoning_effort`. Instead, use one of "low", "medium" or "high", which will enable reasoning. Note that thinking is enabled by default, so explictly enabling thinking (`think:true` or `reasoning_effort:medium`) is not necessary for models that support thinking. ```console $ for t in none low medium high ; do r="$(curl -s localhost:11434/v1/chat/completions -d '{"model":"deepseek-r1","messages":[{"role":"user","content":"why is the sky blue"}],"reasoning_effort":"'$t'","stream":false,"seed":0}' | jq -r '.choices[0].message.reasoning//""')" ; printf "%-7s %4d %s\n" $t ${#r} "${r::100}" ; done none 0 low 3497 Okay, the user is asking "why is the sky blue." This is a classic question that people often wonder medium 3497 Okay, the user is asking "why is the sky blue." This is a classic question that people often wonder high 3497 Okay, the user is asking "why is the sky blue." This is a classic question that people often wonder ```
Author
Owner

@dallisx commented on GitHub (Mar 24, 2026):

这是来自QQ邮箱的假期自动回复邮件。
 
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

<!-- gh-comment-id:4117894305 --> @dallisx commented on GitHub (Mar 24, 2026): 这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#9654