Run a paired Claude token-count test, keep the code and tools fixed, then convert the difference to dollars before changing your team’s working language.
Should a team translate coding tickets into English to save money? A characters-per-token shortcut is a poor guide when a prompt mixes Russian prose, an English stack trace and source code. Translation changes just one part of the bill.
Measure a small pair first
The command below calls the native Anthropic count_tokens method. Set ANTHROPIC_API_KEY and a model ID available to that key in ANTHROPIC_MODEL. Only the message language changes between calls. Counting estimates input without generating an answer. On a short prompt, message overhead can noticeably affect the ratio.
python3 - <<'PYTHON'
import json, os, urllib.request
url = "https://api.anthropic.com/v1/messages/count_tokens"
for text in ("Исправь тест и объясни причину.", "Fix the test and explain the cause."):
body = {"model": os.environ["ANTHROPIC_MODEL"],
"messages": [{"role": "user", "content": text}]}
req = urllib.request.Request(url, data=json.dumps(body).encode(),
headers={"x-api-key": os.environ["ANTHROPIC_API_KEY"],
"anthropic-version": "2023-06-01", "Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=30) as response:
print(text, json.load(response)["input_tokens"])
PYTHON
Repeat on real tickets
Take five sanitized task descriptions and make equivalent translations. Keep the code, system message and tool definitions identical. Divide total Russian tokens by total English tokens across all five pairs. This weights a large ticket according to its actual contribution. Record the model version and date alongside the result.
Convert the difference into money
Saving 3,000 uncached input tokens across five tasks at a hypothetical $2 per million saves $0.006. One unnecessary agent turn may cost more. Before changing the team’s workflow, compare accepted patches and total spend with retries included. Use the cache-read rate for content billed as a cache hit.
Anthropic token counting · Claude API
- Codex Auto Review pricing: what does one pull request cost?
Estimate small, medium and large reviews at current CheapAI rates. Include the follow-up pass and compare the bill with findings your team can reproduce.
- Claude Fable API pricing for a 100k-token document
Price an initial Fable response and five follow-up questions. Separate uncached input, cache reads and output and check the exact model version.
- Opus vs Sonnet for coding: when does the higher price pay off?
Compare cost per accepted patch, include failed runs and calculate a break-even point before choosing a Claude model for your repository.
- Codex 401 with a custom API key: check the host before buying credits
Diagnose invalid_api_key with the request URL, a catalog check and three provider settings. Keep the key out of terminal output and support tickets.
- An AI stream ended after HTTP 200. Did the response finish?
Inspect the final stream event, distinguish an output limit from a disconnect, and decide whether retrying a tool call could duplicate work.
- What can a pelican SVG tell you about a coding model?
Evaluate rendering, instruction following and animation separately. Then compare the result with a reproducible patch in your own repository.
- How much does a Codex coding task cost through the API?
Estimate the cost of one bug fix and a batch of twenty using live API rates. Compare models by the cost of a passing patch, including retries.
- Claude wrote the prompt cache. Why did the next request read zero?
Read Claude usage fields, price a cache miss and run a controlled two-request check before changing your prompts or your API provider.
- How to check Gemini input token counts on long requests
Compare countTokens with usageMetadata on the same Gemini payload. Isolate chat history, tools, cached input and multilingual text before disputing a bill.