Skip to content

Add thinking effort to the Anthropic provider#147

Merged
andreynering merged 3 commits intocharmbracelet:mainfrom
coder:main
Feb 26, 2026
Merged

Add thinking effort to the Anthropic provider#147
andreynering merged 3 commits intocharmbracelet:mainfrom
coder:main

Conversation

@kylecarbs
Copy link
Copy Markdown
Contributor

@kylecarbs kylecarbs commented Feb 23, 2026

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

This changes Fantasy to use the upstream Anthropic Go SDK rather than the Charm fork. There seemed to be no differences in the versions, other than it being slightly behind main (80 commits at the time of writing).

@andreynering
Copy link
Copy Markdown
Member

Hey @kylecarbs,

FYI, the fixes we made on the fork were done on the fantasy branch:

It's a good reminder to revisit that, tho. I made these fixes at the time and never checked if these are still needed in the new version nor I updated the fork.

@kylecarbs
Copy link
Copy Markdown
Contributor Author

Thanks for the quick response @andreynering. My bad - shoulda checked the ref.

Would it be alright if I submitted a PR updating that branch on the fork then? Seems much safer than pinning to main here and merging a change.

@andreynering
Copy link
Copy Markdown
Member

@kylecarbs Yes. Let's do that in steps: update the fork first and add reasoning effort in a separate PR.

@andreynering
Copy link
Copy Markdown
Member

@kylecarbs
Copy link
Copy Markdown
Contributor Author

PR here: charmbracelet/anthropic-sdk-go#1. Just doing some testing.

@kylecarbs kylecarbs force-pushed the main branch 2 times, most recently from e776cf2 to 5a87b67 Compare February 23, 2026 14:34
andreynering added a commit that referenced this pull request Feb 23, 2026
The `fantasy` branch was updated from upstream.

See:

* charmbracelet/anthropic-sdk-go#1
* #147
andreynering added a commit that referenced this pull request Feb 23, 2026
The `fantasy` branch was updated from upstream.

See:

* charmbracelet/anthropic-sdk-go#1
* #147
@andreynering
Copy link
Copy Markdown
Member

@kylecarbs I pushed the update to main. Can you rebase?

Also, I'd just like to understand your motivation to add reasoning effort.

I'm reading the docs and looks like this + adaptive thinking replaces budget_tokens. Good!

Do you want this on Crush on you're using Fantasy yourself? Also, Anthropic models or another Anthropic-compatible API?

@kylecarbs
Copy link
Copy Markdown
Contributor Author

@andreynering updated!

I'm using Fantasy myself - lovely library y'all have made. We're using Anthropic models directly.

@andreynering
Copy link
Copy Markdown
Member

@kylecarbs There is a failing test. Otherwise, it looks good!

@kylecarbs
Copy link
Copy Markdown
Contributor Author

@andreynering fixing now!

@kylecarbs
Copy link
Copy Markdown
Contributor Author

@andreynering should be good now, also rebased on main.

@andreynering
Copy link
Copy Markdown
Member

@kylecarbs Still failing:

--- FAIL: TestGenerate_InvalidEffortReturnsFantasyError (0.00s)
    anthropic_test.go:520: 
        	Error Trace:	/Users/runner/work/fantasy/fantasy/providers/anthropic/anthropic_test.go:520
        	Error:      	An error is expected but got nil.
        	Test:       	TestGenerate_InvalidEffortReturnsFantasyError

@kylecarbs
Copy link
Copy Markdown
Contributor Author

@andreynering should be fixed now, sorry about that!

Copy link
Copy Markdown
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kylecarbs!

I made some changes to this PR, mostly cosmetical.

The most relevant behavior change is that I removed the enum validation because I prefer to let the API handle it.

I also opened two PRs on Catwalk and Crush to make this usable in Crush:

Image

Thanks for your contribution! This all should be shipped still today.

@andreynering andreynering merged commit 8a1457c into charmbracelet:main Feb 26, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants