Bug with Interactions API for Input Token Counting

Hi there,

I’m using the interactions API with gemini 3 flash preview. The input token count is always 0. Other fields are accurate, it’s just that one. No matter if I send an image or text, the input token count always returns 0.

if event.get('event_type') == 'interaction.complete':
                                u = event.get('interaction', {}).get('usage', {})
                                usage_tracker.update({
                                    "input": u.get('total_input_tokens', 0),
                                    "cached": u.get('total_cached_tokens', 0),
                                    "output": u.get('total_output_tokens', 0),
                                    "thought": u.get('total_thought_tokens', 0),
                                    "tool": u.get('total_tool_use_tokens', 0)
                                })

Let me know if this is reproduceable on your end.

Thanks,

Omkar

Thank you so much for flagging this.

I managed to reproduce it, this seems to be a bug with streaming mode. We’ll prioritise a fix after holidays.

1 Like