Sweep 22 Sep 2026 · 17:19Z Build v2.1.280 501 read Stable v2.1.267 Latest v2.1.280 Next v2.1.280 Feeds RSS JSON llms.txt Unofficial
One change · api

Count tokens in a Message changed

api/beta/messages/count_tokens

Nearest release: v2.1.274, published 7 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+144added
Lines−1removed
From line 21 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits10to this page, all time

The whole hunk

from line 21, old and new numbered
/
lines
from line 21
2121 
2222 - `string`
2323 
24 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
24 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`
2525 
2626 - `"message-batches-2024-09-24"`
2727 
from line 113
113113 
114114 - `"mid-conversation-system-clear-at-2026-08-21"`
115115 
116 - `"compact-2026-09-04"`
117 
116118- `"anthropic-user-profile-id": optional string`
117119 
118120 The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header.
from line 1273
12711273 
12721274 Opaque metadata from prior compaction, to be round-tripped verbatim
12731275 
1276 - `signature: optional string or null`
1277 
1278 The block's signature as returned, to be sent back verbatim
1279 
12741280 - `BetaRequestToolAdditionBlock object`
12751281 
12761282 Mid-conversation directive to surface a declared tool.
from line 1517
15111517 
15121518 Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
15131519 
1520- `compaction: optional BetaCompactionConfig or null`
1521 
1522 Compact the whole conversation and return a signed `compaction` block,
1523 alone, that a later request sends back first in `messages`, in place of
1524 the messages it summarizes. There is no trigger and no pause flag: sending
1525 the parameter compacts, and nothing is sampled after the block.
1526 
1527 The summarization prompt is the server's own unless `instructions` are
1528 given, which then replace it for this request; a value that is empty or
1529 only whitespace counts as absent.
1530 
1531 - `type: "summarize"`
1532 
1533 - `instructions: optional string or null`
1534 
1535 Replaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.
1536 
1537 maxLength: 16384
1538 
15141539- `context_management: optional BetaContextManagementConfig or null`
15151540 
15161541 Context management configuration.
from line 3280
32553280 
32563281 When true, guarantees schema validation on tool names and inputs
32573282 
3283 - `url_sources: optional BetaWebFetchURLSources or null`
3284 
3285 Which sources contribute to the set of URLs web fetch may fetch.
3286 
3287 Each key is a tagged variant: `user_input` is `all` or `none`; the
3288 two tool filters are `all`, `none`, `only` (only the named tools'
3289 results) or `except` (every result but the named tools'). A named tool
3290 must be declared in this request's `tools[]`.
3291 
3292 - `client_tool_results: optional BetaWebFetchURLSourceAll or BetaWebFetchURLSourceNone or BetaWebFetchURLSourceOnly or BetaWebFetchURLSourceExcept`
3293 
3294 Which client tools' results contribute fetchable URLs: "all", "none", or an only or except list of client tool names from tools[].
3295 
3296 - `BetaWebFetchURLSourceAll object`
3297 
3298 The `url_sources` variant under which a source contributes in
3299 full: every result of the tool filter's source, or all user input.
3300 
3301 - `type: "all"`
3302 
3303 - `BetaWebFetchURLSourceNone object`
3304 
3305 The `url_sources` variant under which a source contributes nothing:
3306 no result of the tool filter's source, or no user input.
3307 
3308 - `type: "none"`
3309 
3310 - `BetaWebFetchURLSourceOnly object`
3311 
3312 The tool filter variant under which only the named tools' results
3313 contribute.
3314 
3315 - `type: "only"`
3316 
3317 - `tools: array of BetaWebFetchURLSourceToolReference`
3318 
3319 - `type: "tool_reference"`
3320 
3321 - `name: string`
3322 
3323 - `BetaWebFetchURLSourceExcept object`
3324 
3325 The tool filter variant under which every result but the named
3326 tools' contributes.
3327 
3328 - `type: "except"`
3329 
3330 - `tools: array of BetaWebFetchURLSourceToolReference`
3331 
3332 - `type: "tool_reference"`
3333 
3334 - `name: string`
3335 
3336 - `server_tool_results: optional BetaWebFetchURLSourceAll or BetaWebFetchURLSourceNone or BetaWebFetchURLSourceOnly or BetaWebFetchURLSourceExcept`
3337 
3338 Which server tools' results contribute fetchable URLs: "all", "none", or an only or except list of server tool names from tools[]; only web_search and web_fetch results ever contribute.
3339 
3340 - `BetaWebFetchURLSourceAll object`
3341 
3342 The `url_sources` variant under which a source contributes in
3343 full: every result of the tool filter's source, or all user input.
3344 
3345 - `BetaWebFetchURLSourceNone object`
3346 
3347 The `url_sources` variant under which a source contributes nothing:
3348 no result of the tool filter's source, or no user input.
3349 
3350 - `BetaWebFetchURLSourceOnly object`
3351 
3352 The tool filter variant under which only the named tools' results
3353 contribute.
3354 
3355 - `BetaWebFetchURLSourceExcept object`
3356 
3357 The tool filter variant under which every result but the named
3358 tools' contributes.
3359 
3360 - `user_input: optional BetaWebFetchURLSourceAll or BetaWebFetchURLSourceNone`
3361 
3362 Whether URLs in user messages are fetchable: "all" or "none".
3363 
3364 - `BetaWebFetchURLSourceAll object`
3365 
3366 The `url_sources` variant under which a source contributes in
3367 full: every result of the tool filter's source, or all user input.
3368 
3369 - `BetaWebFetchURLSourceNone object`
3370 
3371 The `url_sources` variant under which a source contributes nothing:
3372 no result of the tool filter's source, or no user input.
3373 
32583374 - `BetaWebSearchTool20260209 object`
32593375 
32603376 - `type: "web_search_20260209"`
from line 3477
33613477 
33623478 When true, guarantees schema validation on tool names and inputs
33633479 
3480 - `url_sources: optional BetaWebFetchURLSources or null`
3481 
3482 Which sources contribute to the set of URLs web fetch may fetch.
3483 
3484 Each key is a tagged variant: `user_input` is `all` or `none`; the
3485 two tool filters are `all`, `none`, `only` (only the named tools'
3486 results) or `except` (every result but the named tools'). A named tool
3487 must be declared in this request's `tools[]`.
3488 
33643489 - `BetaWebFetchTool20260309 object`
33653490 
33663491 Web fetch tool with use_cache parameter for bypassing cached content.
from line 3544
34193544 
34203545 When true, guarantees schema validation on tool names and inputs
34213546 
3547 - `url_sources: optional BetaWebFetchURLSources or null`
3548 
3549 Which sources contribute to the set of URLs web fetch may fetch.
3550 
3551 Each key is a tagged variant: `user_input` is `all` or `none`; the
3552 two tool filters are `all`, `none`, `only` (only the named tools'
3553 results) or `except` (every result but the named tools'). A named tool
3554 must be declared in this request's `tools[]`.
3555 
34223556 - `use_cache: optional boolean`
34233557 
34243558 Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
from line 3678
35443678 - `strict: optional boolean`
35453679 
35463680 When true, guarantees schema validation on tool names and inputs
3681 
3682 - `url_sources: optional BetaWebFetchURLSources or null`
3683 
3684 Which sources contribute to the set of URLs web fetch may fetch.
3685 
3686 Each key is a tagged variant: `user_input` is `all` or `none`; the
3687 two tool filters are `all`, `none`, `only` (only the named tools'
3688 results) or `except` (every result but the named tools'). A named tool
3689 must be declared in this request's `tools[]`.
35473690 
35483691 - `use_cache: optional boolean`
35493692