security 1 credit · ~$0.015 <10ms

Token Counter

POST /v1/tokens/count

BPE-approximate token counting with per-model cost estimates. Know your spend and check context-window fit before you make the call.

Capabilities

  • Text or chat-messages input
  • GPT-4, GPT-3.5, Claude, Gemini, generic
  • Per-message breakdown plus context-window remaining
  • USD cost estimate

Use cases

  • Budget and guard token spend
  • Decide when to distill
  • Cost dashboards and quotas
example
curl -X POST https://api.agent-toolbox.ai/v1/tokens/count \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello world", "model": "gpt-4"}'
response shape
{
  "verdict": "PASS" | "FLAG" | "BLOCK",
  // tool-specific findings…
  "certificate": "sha256:..."
}