Gemini

Count tokens (Gemini-compatible)

Counts tokens using the native Gemini CountTokens contract. Unknown fields and either official ProtoJSON field-name spelling are forwarded best-effort.

post/v1beta/models/{model}:countTokens

Request

  • Base URL: https://api.tokenlab.sh
  • URL: https://api.tokenlab.sh/v1beta/models/{model}:countTokens
  • Auth: HTTP bearer

Path parameters

modelstring required

Query parameters

keystring

Request body

contentsobject[]
generateContentRequestobject
generate_content_requestobject

Response

Gemini-native token count response

object required

Changes

No recorded changes to this operation across all 1 revision of this API.