**Full name**: projects.locations.publishers.models.computeTokens

Return a list of tokens based on the input text.

### Endpoint

post `https://{service-endpoint}/v1beta1/{endpoint}:computeTokens`   
Where `{service-endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest#rest_endpoints).

### Path parameters

`endpoint` `string` Required. The name of the Endpoint requested to get lists of tokens and token ids.

### Request body

The request body contains data with the following structure:
Fields `instances[]` ``value (`https://protobuf.dev/reference/protobuf/google.protobuf#value` format)`` Optional. The instances that are the input to token computing API call. Schema is identical to the prediction schema of the text model, even for the non-text models, like chat models, or Codey models.
`model` `string` Optional. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/\*/models/\*
`contents[]` ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest/Shared.Types/Content`)`` Optional. Input content.

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest/v1beta1/ComputeTokensResponse`.

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `endpoint` resource:

- `aiplatform.endpoints.predict`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).