Starting April 29, 2025, Gemini 1.5 Pro and Gemini 1.5 Flash models are not available in projects that have no prior usage of these models, including new projects. For details, see Model versions and lifecycle.
Optional. A list of Tools the model may use to generate the next response.
A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.
Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-27 UTC."],[],[],null,["# Method: publishers.models.countTokens\n\nPerform a token count in express mode. \n\n### Endpoint\n\npost `https:``/``/aiplatform.googleapis.com``/v1beta1``/{model}:countTokens`\n\n### Path parameters\n\n`model` `string` \nRequired. The name of the model requested to perform token counting. Format: `/publishers/google/models/*`\n\n### Request body\n\nThe request body contains data with the following structure:\nFields `model` `string` \nOptional. The name of the publisher model requested to serve the prediction. Format: `publishers/google/models/*`\n`instances[]` `value (`[Value](https://protobuf.dev/reference/protobuf/google.protobuf/#value)` format)` \nOptional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.\n`contents[]` `object (`[Content](/vertex-ai/generative-ai/docs/reference/rest/v1beta1/Content)`)` \nOptional. Input content.\n`tools[]` `object (`[Tool](/vertex-ai/generative-ai/docs/reference/rest/v1beta1/projects.locations.cachedContents#Tool)`)` \nOptional. A list of `Tools` the model may use to generate the next response.\n\nA `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.\n`systemInstruction` `object (`[Content](/vertex-ai/generative-ai/docs/reference/rest/v1beta1/Content)`)` \nOptional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.\n`generationConfig` `object (`[GenerationConfig](/vertex-ai/generative-ai/docs/reference/rest/v1beta1/GenerationConfig)`)` \nOptional. Generation config that the model will use to generate the response. \n\n### Response body\n\nIf successful, the response body contains an instance of [CountTokensResponse](/vertex-ai/generative-ai/docs/reference/rest/v1beta1/CountTokensResponse)."]]