On this page
- The current high-level split
- Interactions are turn resources
- Stateful conversations use previous_interaction_id
- Stateful continuation does not automatically carry every setting
- Stateless mode is still possible
- Tool steps can carry integrity/context metadata
- The generateContent API uses Content objects
- Streaming uses a separate method
- Gemini is deeply multimodal
- Model capability differs by model
- Function calling is an execution loop
- Built-in tools are a different trust boundary
- Search and URL grounding should preserve provenance
- Structured output belongs to the capability layer
- Context caching has implicit and explicit forms
- Prefix stability still matters
- Model listing can expose useful metadata
- Safety settings are provider-specific request policy
- Thinking controls should not be globalized blindly
- Server-side state changes privacy and deletion semantics
- Background execution changes lifecycle handling
- A clean Gemini adapter
- Test both state models
- Where BYOKchat fits
- Further reading
Google’s Gemini API is not just “another Chat Completions endpoint.”
For client developers, there are now two important API families to understand:
- the Interactions API, which Google recommends for new Gemini and agentic applications;
- the older generateContent API, which remains supported and is still widely used.
Both can power chat, but they expose state, tools, streaming, and multimodal content differently.
A multi-provider client should support Gemini as a native provider instead of pretending every request is OpenAI-shaped.
The current high-level split
Google’s current documentation describes the Interactions API as the recommended interface for new projects, while the original generateContent API remains supported.
That gives client developers a choice:
Interactions API
→ unified interaction resource
→ optional server-side conversation state
→ execution steps
→ background work and agentic workflows
generateContent
→ explicit Content history
→ stateless request/response style
→ streamGenerateContent for SSE streaming
→ mature direct generation path
The app can support one or both, but the adapter should make the distinction explicit.
Interactions are turn resources
An Interaction represents a completed or in-progress model turn with a chronological sequence of steps.
Those steps can include concepts such as:
- user input;
- model thoughts/summaries;
- function calls;
- function results;
- server-tool activity;
- final model output.
This is richer than a single assistant text field.
A product database should therefore store a portable semantic conversation while the Gemini adapter preserves native interaction metadata when it matters.
Stateful conversations use previous_interaction_id
The Interactions API can continue from prior server-side state by referencing a previous interaction ID.
Conceptually:
interaction A
↓ id
interaction B(previous_interaction_id=A)
↓ id
interaction C(previous_interaction_id=B)
This can save the client from resending the entire history.
But it creates provider-owned continuation state, so the application should not make that ID the only representation of the conversation.
See Stateful vs Stateless AI Conversations.
Stateful continuation does not automatically carry every setting
Google documents that interaction-scoped settings such as tools, system instructions, and generation configuration must be specified for the current interaction as needed.
That means this assumption is unsafe:
previous_interaction_id
→ all prior request configuration is automatically active
Your context/request builder should still construct the desired settings for each turn.
Stateless mode is still possible
You can also manage history yourself and send the relevant prior steps again.
This is useful when:
- provider-side storage is undesirable;
- portability matters;
- your product owns branching/editing;
- you need deterministic backup/restore;
- a chat may switch providers.
For stateless workflows, preserve the native fields that Gemini requires for continuity rather than reducing everything to visible text.
Tool steps can carry integrity/context metadata
Current Gemini tool workflows can include IDs and signatures on model/tool steps. Google documents that stateful mode can manage these automatically, while stateless clients need to preserve the relevant fields when replaying history.
This matters because a tool call is not just:
name + JSON arguments
Provider-native metadata may be necessary to prove continuity or preserve reasoning/tool context.
The durable architecture should therefore keep:
portable tool-call record
+ Gemini-native continuation metadata
The generateContent API uses Content objects
The legacy generation path sends a GenerateContentRequest with a contents array.
For multi-turn chat, that array contains prior content and the latest request.
Conceptually:
{
"contents": [
{
"role": "user",
"parts": [
{ "text": "What is a semaphore?" }
]
},
{
"role": "model",
"parts": [
{ "text": "A semaphore is..." }
]
},
{
"role": "user",
"parts": [
{ "text": "Show an example." }
]
}
]
}
Again, the core abstraction is typed parts, not one text string.
Streaming uses a separate method
The generateContent family exposes streamGenerateContent for streamed responses.
The request semantics are closely related, but the response arrives incrementally.
A client should normalize the stream into semantic events instead of wiring Gemini response chunks directly to the renderer.
Gemini is deeply multimodal
Gemini models can support combinations of:
- text;
- images;
- audio;
- video;
- documents;
- generated media, depending on model and endpoint.
Do not model an attachment as “a string URL pasted into the prompt.”
A portable attachment record should preserve media type, source, local identity, provider upload/reference metadata, and lifecycle.
The Gemini adapter then chooses the correct native representation for the selected model.
Model capability differs by model
The fact that the Gemini API supports a feature does not mean every Gemini model supports it.
Capability checks can include:
input modalities
output modalities
context limits
function calling
structured output
thinking controls
built-in tools
caching
background execution
Use model metadata and current documentation rather than inferring from family names.
Function calling is an execution loop
Gemini can emit a function call that your application must validate and execute.
A safe loop is:
The model proposes the call. The application owns authorization.
Built-in tools are a different trust boundary
Google also provides provider-hosted tools such as search, URL context, maps, or file search depending on current model/API support.
These execute inside Google’s service rather than your app.
That changes:
- data flow;
- privacy boundary;
- latency;
- provenance metadata;
- billing/accounting;
- failure recovery.
Do not present a provider-hosted search tool as equivalent to a local MCP tool just because both supply context to the model.
Search and URL grounding should preserve provenance
When Gemini returns grounding/source metadata, the client should preserve it structurally.
Do not flatten:
source URL
retrieval status
search query
citation span
into prose if the UI can render sources separately.
This improves auditability and helps distinguish model claims from retrieved evidence.
Structured output belongs to the capability layer
Gemini supports structured response formats on compatible models/APIs.
The client should still:
- validate the requested schema locally;
- map it to the selected Gemini API correctly;
- wait for response completion;
- parse and validate the final result;
- apply business rules separately.
Native constraints improve reliability but do not make semantic values automatically correct.
Context caching has implicit and explicit forms
Google currently documents implicit caching for modern Gemini models and explicit cache objects for the generateContent family where supported.
The Interactions API uses implicit caching rather than explicit cache-object management.
For client architecture, the important point is:
cache behavior is provider/request metadata
not part of the user's canonical conversation
Store usage/cached-token data for analytics, but do not make the chat depend on cache existence.
Prefix stability still matters
Caching generally benefits when repeated large prefixes remain stable.
A context builder should therefore avoid unnecessary churn in:
- system instructions;
- tool definitions;
- project files;
- repeated reference material.
But correctness wins over cache hits. Never reorder instructions merely to chase caching if semantics change.
Model listing can expose useful metadata
The Gemini API includes model-list/get methods that can return model information such as token limits and other metadata.
Use this when available, but do not assume the catalog fully describes every feature toggle.
Maintain your own normalized capability profile and allow unknown states.
See How AI Model Discovery APIs Work.
Safety settings are provider-specific request policy
Gemini exposes safety settings as part of its request model.
A provider-neutral app should not pretend that every provider has identical safety knobs.
Keep them in a Gemini-specific advanced settings layer unless your product has a carefully defined cross-provider abstraction.
Thinking controls should not be globalized blindly
Gemini models can expose thinking-related controls, but the exact field names and accepted levels depend on API/model generation.
A generic UI can expose an intent such as:
Reasoning: Off / Low / Medium / High / Auto
only if the adapter maps those choices accurately.
Otherwise expose the provider-native control with capability-aware labels.
See Reasoning Effort Explained.
Server-side state changes privacy and deletion semantics
If you use stored Interactions, the provider maintains resources that may have retention and deletion behavior separate from your local chat database.
A “Delete Chat” implementation should know whether it also created remote resources that can or should be deleted.
Do not assume deleting a local conversation automatically deletes provider-side state.
Background execution changes lifecycle handling
The Interactions API can support background work for applicable workflows.
Once a request can outlive the foreground connection, the client needs durable operation state:
local operation ID
provider interaction/job ID
status
created/updated timestamps
last known progress
completion/failure payload
See How Long-Running AI Tasks Work.
A clean Gemini adapter
The adapter decides:
- which API family is being used;
- stateful vs stateless continuation;
- native parts/steps;
- tool metadata;
- streaming normalization;
- grounding/source metadata;
- provider-specific settings.
Test both state models
Important fixtures include:
stateful continuation
stateless replay
missing native signature/id in tool history
function call/result round trip
stream interruption
structured output
multimodal input
built-in tool result
provider-side stored interaction deletion
unsupported model capability
legacy generateContent path
A Gemini integration is not complete because one text prompt returned successfully.
Where BYOKchat fits
A multi-provider BYOK client can preserve a portable conversation while supporting Gemini-native Interactions, generateContent, tool steps, grounding, multimodal parts, and caching metadata inside its provider adapter.
That keeps the user free to switch providers without throwing away Gemini-specific depth.