How Gemini tokenization works
Gemini uses a SentencePiece-derived tokenizer that is not available for exact offline counting; the Gemini API provides a countTokens method for exact numbers.
Google documents roughly 4 characters per token for English text, similar to other modern models.
Gemini context windows are among the largest available, up to about 1 million tokens, enough for entire codebases or several books in one request.
Some Gemini models use tiered pricing where prompts beyond a token threshold bill at higher rates; the counter applies the correct tier automatically.