Estimate token count
estimate_tokensEstimate a text's token count to plan API usage and costs. Uses Claude's count_tokens endpoint when an API key is present; otherwise falls back to a character-based approximation.
Instructions
テキストのトークン数を見積もる。API キーがあれば本文を Claude API の count_tokens に送る(外部通信)。無ければ文字数ベースの概算。 / Estimate a text's token count. With an API key the text is sent to the Claude count_tokens endpoint (outbound call); otherwise a rough character-based approximation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | 出力言語 / Output language | both |
| text | Yes | 対象テキスト / The text to measure |