---
title: "Token Counter & Context-Window Fit Calculator"
method: POST
path: "/api/v1/tools/token-counter-calculator"
tags: ["ai"]
---

# Token Counter & Context-Window Fit Calculator

`POST /api/v1/tools/token-counter-calculator`

## Request

- Base URL: `https://calcfleet.com`
- URL: `https://calcfleet.com/api/v1/tools/token-counter-calculator`
- Auth: none declared

Estimate the token count of any text with the chars/4 words/0.75 heuristic, check if it fits 8k, 128k, 200k, or 1M context windows, and gauge API cost.

## Request body

- object
  - `chars` number, required
  - `words` number, required
  - `pricePerMillion` number, required

## Response `200`

Successful calculation result.

- object
  - `result` object, required: Structured calculation output (fields vary per calculator).

## Other responses

- `400`: Invalid input — the issues array contains Zod validation errors.
- `403`: Forbidden — an Authorization: Bearer cf_… key was supplied but is invalid.
- `404`: Unknown tool slug.

---

[API](https://skmtc.dev/calcfleet/apis/calcfleet-financial-calculators-api.md) · [All operations](https://skmtc.dev/calcfleet/apis/calcfleet-financial-calculators-api/llms.txt) · [OpenAPI document](https://skmtc.dev/calcfleet/apis/calcfleet-financial-calculators-api/revisions/cd9abd595bbe?raw)
