Perform a token counting.
HTTP request
POST https://{service-endpoint}/v1/{endpoint}:countTokens
Where {service-endpoint}
is one of the supported service endpoints.
Path parameters
Parameters | |
---|---|
endpoint |
Required. The name of the Endpoint requested to perform token counting. Format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"model": string,
"instances": [
value
],
"contents": [
{
object ( |
Fields | |
---|---|
model |
Optional. The name of the publisher model requested to serve the prediction. Format: |
instances[] |
Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model. |
contents[] |
Optional. Input content. |
Response body
If successful, the response body contains an instance of CountTokensResponse
.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the endpoint
resource:
aiplatform.endpoints.predict
For more information, see the IAM documentation.