[PR #13692] [MERGED] anthropic: allow non-thinking models when using Anthropic API #14343

Closed
opened 2026-04-13 00:51:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13692
Author: @ParthSareen
Created: 1/12/2026
Status: Merged
Merged: 1/12/2026
Merged by: @ParthSareen

Base: mainHead: parth/claude-code-allow-non-thinking-models


📝 Commits (2)

  • 728874a Allow non-thinking models when using Anthropic API interface
  • 1405f8b refactor: rename anthropic_api flag to relax_thinking for clarity

📊 Changes

3 files changed (+34 additions, -2 deletions)

View changed files

📝 middleware/anthropic.go (+3 -0)
📝 middleware/anthropic_test.go (+23 -0)
📝 server/routes.go (+8 -2)

📄 Description

Set anthropic_api flag in middleware context and modify ChatHandler to gracefully ignore the 'think' parameter for requests originating from the Anthropic API. This allows tools like claude code to work with models that don't support thinking without errors.

Changes:

  • Add anthropic_api flag to context in AnthropicMessagesMiddleware
  • Add test for anthropic_api flag setting
  • Update ChatHandler to check anthropic_api flag and set req.Think=nil
  • Log warnings when thinking is ignored for non-thinking models

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13692 **Author:** [@ParthSareen](https://github.com/ParthSareen) **Created:** 1/12/2026 **Status:** ✅ Merged **Merged:** 1/12/2026 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parth/claude-code-allow-non-thinking-models` --- ### 📝 Commits (2) - [`728874a`](https://github.com/ollama/ollama/commit/728874a306a55680f4edd807d7aff510b0eeef01) Allow non-thinking models when using Anthropic API interface - [`1405f8b`](https://github.com/ollama/ollama/commit/1405f8beb0ea0d0ce25abfa2afb4a4915dd4894b) refactor: rename anthropic_api flag to relax_thinking for clarity ### 📊 Changes **3 files changed** (+34 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `middleware/anthropic.go` (+3 -0) 📝 `middleware/anthropic_test.go` (+23 -0) 📝 `server/routes.go` (+8 -2) </details> ### 📄 Description Set anthropic_api flag in middleware context and modify ChatHandler to gracefully ignore the 'think' parameter for requests originating from the Anthropic API. This allows tools like claude code to work with models that don't support thinking without errors. Changes: - Add anthropic_api flag to context in AnthropicMessagesMiddleware - Add test for anthropic_api flag setting - Update ChatHandler to check anthropic_api flag and set req.Think=nil - Log warnings when thinking is ignored for non-thinking models --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:51:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#14343