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.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
project_id GCP project id (overrides connection). | string | No | — | — | — |
region Region (default us-central1). | string | No | — | — | — |
model Model id, e.g. gemini-1.5-flash-002. | string | Yes | — | — | — |
prompt Prompt text. Supports {{ }}. | string | Yes | — | — | — |
Output
One shape.
result
| Field | Type | Example |
|---|---|---|
total_tokens | number | — |
total_billable_characters | number | — |
model | string | — |
{
"model": "",
"total_billable_characters": 0,
"total_tokens": 0
}Related Google Vertex AI nodes
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.