Skip to main content
POST
/
genai
/
v1beta
/
models
/
{model}
:countTokens
Error
A valid request URL is required to generate request examples
{
  "totalTokens": 123,
  "cachedContentTokenCount": 123,
  "promptTokensDetails": [
    {
      "modality": "<string>",
      "tokenCount": 123
    }
  ],
  "cacheTokensDetails": [
    {
      "modality": "<string>",
      "tokenCount": 123
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.getbifrost.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your provider API key or Bifrost authentication token. Virtual keys (prefixed with sk-bf-) can also be passed here.

Path Parameters

model
string
required

Model name with action (e.g., gemini-pro:countTokens)

Body

application/json
contents
object[]
generateContentRequest
object

Response

Successful response

totalTokens
integer

Number of tokens that the model tokenizes the prompt into

cachedContentTokenCount
integer

Number of tokens in the cached part of the prompt

promptTokensDetails
object[]

Modalities processed in the request input

cacheTokensDetails
object[]

Modalities in the cached content