{"version":"2.1.282","anchor":"count-tokens-calls-honour-a-client-supplied-fetch","canonical_anchor":"count-tokens-calls-honour-a-client-supplied-fetch","heading":"Token counting requests now use a custom fetch function when one is set","tier":"internal","area":"SDK","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.282\/e\/count-tokens-calls-honour-a-client-supplied-fetch","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.282","markdown":"### Token counting requests now use a custom fetch function when one is set\n\nRequests to count tokens now go through the client's own fetch function when one is configured, rather than always the default\n\n**Unclear.** Where the custom fetch function comes from, and so which setups are affected, is not settled.\n\n**What**\n\nClaude Code can ask the API how many tokens a message would use, through `\/v1\/messages\/count_tokens`. Tokens are the units of text the model reads. That request now uses a custom fetch function from the client's configuration when one is set, instead of always using the default. A fetch function is the code that sends web requests.\n\n**Why**\n\nWhen a custom fetch is configured, token counting can follow the same route as other requests, such as through a proxy or an authentication wrapper.\n\n- Area: SDK\n- Tier: Under the hood\n- Useful: 1\/5\n- Signal: 1\/5"}