The whole hunk
from line 790, old and new numbered
/
lines
from line 790
790790 -H "content-type: application/json" \
791791 -H "anthropic-version: 2023-06-01" \
792792 -d '{
793 "model": "claude-sonnet-4-6",
793 "model": "claude-opus-5",
794794 "thinking": {
795 "type": "enabled",
796 "budget_tokens": 16000
795 "type": "adaptive"
797796 },
798797 "messages": [
799798 {
from line 823
824823
825824 ```bash CLI
826825 ant messages count-tokens <<'YAML'
827 model: claude-sonnet-4-6
826 model: claude-opus-5
828827 thinking:
829 type: enabled
830 budget_tokens: 16000
828 type: adaptive
831829 messages:
832830 - role: user
833831 content: Are there an infinite number of prime numbers such that n mod 4 == 3?
from line 847
849847 client = anthropic.Anthropic()
850848
851849 response = client.messages.count_tokens(
852 model="claude-sonnet-4-6",
853 thinking={"type": "enabled", "budget_tokens": 16000},
850 model="claude-opus-5",
851 thinking={"type": "adaptive"},
854852 messages=[
855853 {
856854 "role": "user",
from line 879
881879 const client = new Anthropic();
882880
883881 const response = await client.messages.countTokens({
884 model: "claude-sonnet-4-6",
885 thinking: {
886 type: "enabled",
887 budget_tokens: 16000
888 },
882 model: "claude-opus-5",
883 thinking: { type: "adaptive" },
889884 messages: [
890885 {
891886 role: "user",
from line 923
928923
929924 var parameters = new MessageCountTokensParams
930925 {
931 Model = Model.ClaudeSonnet4_6,
932 Thinking = new ThinkingConfigEnabled(budgetTokens: 16000),
926 Model = Model.ClaudeOpus5,
927 Thinking = new ThinkingConfigAdaptive(),
933928 Messages =
934929 [
935930 new()
from line 970
975970 )
976971
977972 response, err := client.Messages.CountTokens(context.TODO(), anthropic.MessageCountTokensParams{
978 Model: anthropic.ModelClaudeSonnet4_6,
979 Thinking: anthropic.ThinkingConfigParamOfEnabled(16000),
973 Model: anthropic.ModelClaudeOpus5,
974 Thinking: anthropic.ThinkingConfigParamUnion{
975 OfAdaptive: &anthropic.ThinkingConfigAdaptiveParam{},
976 },
980977 Messages: []anthropic.MessageParam{
981978 anthropic.NewUserMessage(anthropic.NewTextBlock("Are there an infinite number of prime numbers such that n mod 4 == 3?")),
982979 anthropic.NewAssistantMessage(thinkingBlock, textBlock),
from line 992
995992 import com.anthropic.models.messages.MessageTokensCount;
996993 // ...
997994 import com.anthropic.models.messages.ThinkingBlockParam;
995 import com.anthropic.models.messages.ThinkingConfigAdaptive;
998996 // ...
999997 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1000998
from line 1015
10171015 );
10181016
10191017 MessageCountTokensParams params = MessageCountTokensParams.builder()
1020 .model(Model.CLAUDE_SONNET_4_6)
1021 .enabledThinking(16000)
1018 .model(Model.CLAUDE_OPUS_5)
1019 .thinking(ThinkingConfigAdaptive.builder().build())
10221020 .addUserMessage("Are there an infinite number of prime numbers such that n mod 4 == 3?")
10231021 .addAssistantMessageOfBlockParams(assistantBlocks)
10241022 .addUserMessage("Can you write a formal proof?")
from line 1054
10561054 'content' => 'Can you write a formal proof?'
10571055 ]
10581056 ],
1059 model: 'claude-sonnet-4-6',
1060 thinking: [
1061 'type' => 'enabled',
1062 'budget_tokens' => 16000
1063 ],
1057 model: 'claude-opus-5',
1058 thinking: ['type' => 'adaptive'],
10641059 );
10651060
10661061 echo json_encode($response);
from line 1065
10701065 client = Anthropic::Client.new
10711066
10721067 response = client.messages.count_tokens(
1073 model: "claude-sonnet-4-6",
1068 model: "claude-opus-5",
10741069 thinking: {
1075 type: "enabled",
1076 budget_tokens: 16000
1070 type: "adaptive"
10771071 },
10781072 messages: [
10791073 {