---
title: "Token Counter"
method: POST
path: "/utils/token_counter"
tags: ["llm utils"]
---

# Token Counter

`POST /utils/token_counter`

## Request

- Base URL: `https://api.vibebrowser.app` (the document declares no server; this is the origin it was published from)
- URL: `https://api.vibebrowser.app/utils/token_counter`
- Auth: one of:
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`

Args:
    request: TokenCountRequest
    call_endpoint: bool - When set to "True" it will call the token counting endpoint - e.g Anthropic or Google AI Studio Token Counting APIs.

Returns:
    TokenCountResponse

## Query parameters

- `call_endpoint` boolean

## Request body

- TokenCountRequest
  - `model` string, required
  - `prompt` string, nullable
  - `messages` object[], nullable
  - `contents` object[], nullable
  - `tools` object[], nullable
  - `system` unknown

## Response `200`

Successful Response

- TokenCountResponse
  - `total_tokens` integer, required
  - `request_model` string, required
  - `model_used` string, required
  - `tokenizer_type` string, required
  - `original_response` object, nullable
  - `error` boolean
  - `error_message` string, nullable
  - `status_code` integer, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/vibebrowser/apis/litellm-api.md) · [All operations](https://skmtc.dev/vibebrowser/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/vibebrowser/apis/litellm-api/revisions/eea0b7e7b167?raw)
