---
title: "Count Tokens Endpoint"
method: POST
path: "/api/tokens/count"
tags: ["Inference"]
---

# Count Tokens Endpoint

`POST /api/tokens/count`

Count tokens in text for cost estimation.

## Request body

- TokenCountRequest
  - `prompt` string, required — Text to count
  - `model` string, nullable — Model for tokenizer

## Response `200`

Successful Response

- TokenCountResponse
  - `tokens` integer, required
  - `model` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/compresr/apis/compresr-platform-api.md) · [All operations](https://skmtc.net/compresr/apis/compresr-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/compresr/compresr-platform-api/revisions/93ee959dfa51/schema)
