[GH-ISSUE #8749] Support for R1 CoT tokens from the API #15238

Closed
opened 2026-04-19 21:30:36 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @peter-ch on GitHub (Jan 22, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8749

I think I commented in the wrong thread, this should be a separate issue. The CoT could be optional or collapsible. I like to see it.

The DeepSeek API does output the thinking tokens, can you please render them? It's really frustrating not to be able to see any activity and wait like 5 minutes for a response. I don't know whether that's a problem or a long CoT.

From the API docs:

for chunk in response:
    if chunk.choices[0].delta.reasoning_content:
        reasoning_content += chunk.choices[0].delta.reasoning_content
    else:
        content += chunk.choices[0].delta.content

Originally posted by @peter-ch in #8706

Originally created by @peter-ch on GitHub (Jan 22, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/8749 I think I commented in the wrong thread, this should be a separate issue. The CoT could be optional or collapsible. I like to see it. > The DeepSeek API does output the thinking tokens, can you please render them? It's really frustrating not to be able to see any activity and wait like 5 minutes for a response. I don't know whether that's a problem or a long CoT. > > From the API docs: > > ```python > for chunk in response: > if chunk.choices[0].delta.reasoning_content: > reasoning_content += chunk.choices[0].delta.reasoning_content > else: > content += chunk.choices[0].delta.content > ``` _Originally posted by @peter-ch in [#8706](https://github.com/open-webui/open-webui/issues/8706#issuecomment-2606494641)_
Author
Owner

@silentoplayz commented on GitHub (Jan 22, 2025):

Already added to the dev branch!

Image

<!-- gh-comment-id:2607677631 --> @silentoplayz commented on GitHub (Jan 22, 2025): Already added to the dev branch! ![Image](https://github.com/user-attachments/assets/4c49724d-863a-4c08-a788-2c3586439529)
Author
Owner

@tjbck commented on GitHub (Jan 22, 2025):

API responses should be handled by a Pipe Function.

<!-- gh-comment-id:2607801961 --> @tjbck commented on GitHub (Jan 22, 2025): API responses should be handled by a Pipe Function.
Author
Owner

@peter-ch commented on GitHub (Jan 22, 2025):

I don't see any thinking from the DeepSeek R1 API, why? I use the latest 5.5.

<!-- gh-comment-id:2608120213 --> @peter-ch commented on GitHub (Jan 22, 2025): I don't see any thinking from the DeepSeek R1 API, why? I use the latest 5.5.
Author
Owner

@peter-ch commented on GitHub (Jan 22, 2025):

What do you mean pipe function, am I supposed to create it myself?

<!-- gh-comment-id:2608122086 --> @peter-ch commented on GitHub (Jan 22, 2025): What do you mean pipe function, am I supposed to create it myself?
Author
Owner

@tjbck commented on GitHub (Jan 22, 2025):

Yes, anything that deviates from the standard OpenAI API specs are unlikely to be supported by default and should be supported as a custom Pipe function. With that being said, once this becomes the standard, I'd be happy to revisit this decision!

<!-- gh-comment-id:2608126791 --> @tjbck commented on GitHub (Jan 22, 2025): Yes, anything that deviates from the standard OpenAI API specs are unlikely to be supported by default and should be supported as a custom Pipe function. With that being said, once this becomes the standard, I'd be happy to revisit this decision!
Author
Owner

@linkcharger commented on GitHub (Feb 6, 2025):

Getting the reasoning tokens requires setting a new parameter in your requests to the API, I have made a 'function' that calls it accordingly and displays the reasoning in the collapsible card:

https://pastebin.com/LVLyR4mn

Input your API key (can also make it a Pipe), save, refresh, and now you should be able to select the model from the dropdown menu of a new chat as "deepseek/deepseek-r1-thoughts"

<!-- gh-comment-id:2639401490 --> @linkcharger commented on GitHub (Feb 6, 2025): Getting the reasoning tokens requires setting a new parameter in your requests to the API, I have made a 'function' that calls it accordingly and displays the reasoning in the collapsible card: https://pastebin.com/LVLyR4mn Input your API key (can also make it a Pipe), save, refresh, and now you should be able to select the model from the dropdown menu of a new chat as "deepseek/deepseek-r1-thoughts"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#15238