{"version":"2.1.261","anchor":"counttokens-now-falls-back-to-gateway-sampling-only-on-http","canonical_anchor":"counttokens-now-falls-back-to-gateway-sampling-only-on-http","heading":"countTokens now falls back to gateway sampling only on HTTP 501","tier":"notice","area":"Elsewhere","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.261\/e\/counttokens-now-falls-back-to-gateway-sampling-only-on-http","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.261","markdown":"### countTokens now falls back to gateway sampling only on HTTP 501\n\nToken counting now only falls back to gateway sampling on a specific HTTP 501 error.\n\nWhen the direct `beta.messages.countTokens` call fails, Claude Code now checks that the failure is specifically an HTTP 501 before falling back to the gateway sample-count path. If that fallback itself fails, a new error is logged with the underlying failure message.\n\n- Area: Elsewhere\n- Tier: You'll notice\n- Useful: 1\/5\n- Signal: 1\/5"}