Count Tokens

vertex_ai.count_tokens
ActionGoogle Cloudconnection required

Calls the Vertex AI publishers/google/models/{model}:countTokens endpoint.

Count the tokens a Gemini model would consume for a prompt (no generation).

Connection

Required
Yes — the node will not save without one
Auth type
OAuth 2.0
Providers
Google Vertex AI
Secret shape
{"client_id", "client_secret", "refresh_token"}
Config it needs
project_id, region
Resolved by
config.connection_id, else node.connection_id

Configuration

4 fields, 2 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
project_id
GCP project id (overrides connection).
stringNo———
region
Region (default us-central1).
stringNo———
model
Model id, e.g. gemini-1.5-flash-002.
stringYes———
prompt
Prompt text. Supports {{ }}.
stringYes———

Output

One shape.

result

FieldTypeExample
total_tokens
number—
total_billable_characters
number—
model
string—
{
  "model": "",
  "total_billable_characters": 0,
  "total_tokens": 0
}

See Count Tokens run in a workflow.

In a technical demo we add the Google Vertex AI connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.