Building a realtime voice assistant on the Live API (BidiGenerateContent,
gemini-3.1-flash-live-preview), used by real users in India.
Our BidiGenerateContentSetup carries a large system instruction plus ~120
function declarations. It is byte-identical on every session, and it measures
about 28,000 input tokens. We can see it clearly in our own usage logs: two
sessions that lasted 8 and 11 seconds each still recorded 28,186 input tokens,
so that is the fixed cost of opening a connection.
Four questions:
-
Does the Live API support context caching (or any equivalent) for the
system instruction and function declarations in the setup message, so that
repeated sessions are not billed the full input price each time? The
context-caching documentation does not say whether it applies to the Live
API, and the Live API pages do not mention caching at all. -
Can function declarations or the system instruction be updated mid-session
without reconnecting? The docs say all functions must be declared at setup,
and that configuration can be changed when pausing and resuming via session
resumption — I would like to confirm that is the only supported route. -
When a session is resumed with a resumption token, is the original setup
(system instruction + function declarations) re-billed as input tokens, or
is it carried over? This is the one that decides whether a
small-toolset-then-resume-with-a-larger-one design saves anything. -
What is the actual validity window for a session resumption token? One
page says 2 hours and another says 24 hours.
Happy to share usage numbers if useful. Thanks.