跳转到主要内容
POST
POST /v1beta/models/{model}:countTokens

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

路径参数

model
string
必填

请求体

application/json

Body for POST .../{model=models/*}:countTokens; model is the path resource.

contents
object[] | null
generateContentRequest
object | null

Full GenerateContentRequest object accepted inside CountTokens. Its model is part of this embedded Batch API object; standalone REST generation keeps model in its path.

响应

Successful protocol response

cacheTokensDetails
object[] | null
cachedContentTokenCount
integer<int64> | null
promptTokensDetails
object[] | null
totalTokens
integer<int64> | null