Skip to content

Conversation

@voodoohop
Copy link

  • completion_tokens now includes thoughtsTokenCount for Gemini thinking models
  • Fixes both streaming and non-streaming responses
  • Aligns with OpenAI format where completion_tokens is the total (reasoning + output)
  • completion_tokens_details.reasoning_tokens provides the breakdown

Problem:

  • Gemini returns candidatesTokenCount (output) and thoughtsTokenCount (reasoning) separately
  • OpenAI format expects completion_tokens to be the sum of both
  • Previously only candidatesTokenCount was used

Changes:

  • src/providers/google/chatComplete.ts
  • src/providers/google-vertex-ai/chatComplete.ts

- Non-streaming and streaming responses now sum candidatesTokenCount + thoughtsTokenCount
- Aligns with OpenAI format where completion_tokens includes reasoning tokens
- completion_tokens_details.reasoning_tokens provides the breakdown
voodoohop added a commit to pollinations/pollinations that referenced this pull request Nov 27, 2025
voodoohop added a commit to pollinations/pollinations that referenced this pull request Nov 27, 2025
* feat: add Portkey gateway deployment automation

* fix: use pollinations fork with Gemini token counting fix

PR: Portkey-AI/gateway#1458

* fix: improve deploy script reliability

- Use fetch-based approach to get exact commit (no depth issues)
- Add commit verification after checkout
- Use npm ci for faster CI builds (fallback to npm install)
- Suppress cd - output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant