Gemini Interactions API Format
Creates a Gemini interaction and returns the completed result.
Behavior
Synchronous: the HTTP call waits until the interaction finishes (including video generation, which can take minutes).
Optional
stream: truereturns Server-Sent Events while the interaction runs, then ends when complete.FastRouter rewrites catalogue model ids to bare Google ids, maps
previous_interaction_idfor sticky continuity, injectsusage.cost/usage.chat_id, and returns a client-facingfr_…id.Alias path:
/api/v1/interactions.
Modalities
Text / tools as usual.
Video generation & conversational editing via models such as
google/gemini-omni-flash-preview(seeresponse_modalities,response_format, andgeneration_config.video_config).Video tokens appear in
usage.output_tokens_by_modalityand are billed at the catalogue video rate.
Router-only fields (stripped before upstream): provider, request_tags.
FastRouter API Key. Get yours at https://fastrouter.ai
Format: Authorization: Bearer YOUR_API_KEY
Create Interaction request. Provide model (required) plus input. The model must exist in the FastRouter catalogue. Native Google Interactions fields are forwarded to Google AI Studio after FastRouter rewrites model / previous_interaction_id and strips router-only fields (provider, request_tags). Supports multimodal input (text, image, audio, video) and video models such as google/gemini-omni-flash-preview when listed in the catalogue.
Model to use. Must be a FastRouter catalogue id (e.g. google/gemini-3.5-flash) or bare Google id that resolves in the catalogue. Unknown models return 400.
google/gemini-3.5-flashInteraction input: plain string, Content, or an array of Content / Step / Turn objects (e.g. user_input with nested content). For video models, string prompts generate video; arrays can include text plus image/video (base64 data + mime_type, or uri) for image-to-video, video-to-video / reference, or edit flows.
Tell me a short joke.Simple text input
Single Content object
Continue a prior interaction. Pass the fr_… id returned by FastRouter (preferred) or an upstream id. Used for sticky routing / BYOK pin and rewritten to the provider-native id upstream.
fr_ID123System instruction for this interaction (interaction-scoped; re-send each turn).
Tool declarations the model may call (e.g. google_search, function calling).
Output format constraints. For video generation use type=video with optional aspect_ratio and delivery. Use delivery=inline so video is returned as base64 in the response (accessible via FastRouter without a Google API key).
Other Google response_format variants (text / image / audio / JSON schema).
Array of response format objects when supported.
When true, FastRouter streams Server-Sent Events while the interaction runs. The request still completes in this same call (not a separate async job).
falseWhether Google should store the interaction for later GET / previous_interaction_id. Defaults to true.
trueSafety settings for the interaction.
Service tier for the interaction. Forwarded upstream (unlike provider / request_tags).
Environment configuration or existing environment id.
Optional FastRouter tags for logging/analytics. Stripped before forwarding upstream.
["production","feature-chat"]Completed interaction. When stream=true, body is an SSE stream that ends with the completed interaction. id is FastRouter fr_…; usage includes cost.
Completed interaction resource. FastRouter rewrites id to a client-facing fr_… value and echoes previous_interaction_id when continuing a conversation.
Client-facing interaction id (fr_…). Pass this as previous_interaction_id to continue.
fr_ID123interactionInteraction status. Successful creates return completed.
completedUpstream model id used for the interaction.
gemini-3.5-flashCreation timestamp.
Last update timestamp.
Previous interaction id as sent by the client (fr_… when continuing).
fr_PREV123Execution steps (model_output, tool calls/results, etc.).
Convenience output payloads when present (may include video content blocks).
Bad request (missing/invalid model, invalid previous_interaction_id, unsupported provider.only, etc.)
Invalid Credentials - Your API key is invalid, missing, or disabled. Check your credentials.
Note: the 401 error body uses code, message, param, and type (there is no status field), and type is invalid_request_error.
Insufficient Credits - Your account or API key has run out of credits. Add more credits and retry the request.
Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.
Internal Error - Something went wrong on our side. Retry the request, and contact support if the issue persists.
Upstream / routing failure
POST /v1/interactions HTTP/1.1
Host: api.fastrouter.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 67
{
"model": "google/gemini-3.5-flash",
"input": "Tell me a short joke."
}{
"id": "fr_ID123",
"object": "interaction",
"status": "completed",
"model": "gemini-3.5-flash",
"created": "2025-11-26T12:25:15Z",
"updated": "2025-11-26T12:25:15Z",
"steps": [
{
"type": "model_output",
"content": [
{
"type": "text",
"text": "Why did the GPU go to therapy? Too many cores issues."
}
]
}
],
"usage": {
"total_input_tokens": 7,
"total_output_tokens": 20,
"total_thought_tokens": 22,
"total_tokens": 49,
"cost": 0.00012,
"chat_id": "fr_ID123"
}
}Retrieves a previously stored interaction by FastRouter fr_… id (or upstream id). Use the returned id with previous_interaction_id on a later create to continue the conversation (e.g. Omni video edits). Alias: /api/v1/interactions/{id}.
FastRouter API Key. Get yours at https://fastrouter.ai
Format: Authorization: Bearer YOUR_API_KEY
Interaction id returned by create (fr_…) or an upstream id.
fr_ID123Stored interaction resource. Same shape as a completed create response (FastRouter fr_… id and usage.cost / usage.chat_id when present).
Completed interaction resource. FastRouter rewrites id to a client-facing fr_… value and echoes previous_interaction_id when continuing a conversation.
Client-facing interaction id (fr_…). Pass this as previous_interaction_id to continue.
fr_ID123interactionInteraction status. Successful creates return completed.
completedUpstream model id used for the interaction.
gemini-3.5-flashCreation timestamp.
Last update timestamp.
Previous interaction id as sent by the client (fr_… when continuing).
fr_PREV123Execution steps (model_output, tool calls/results, etc.).
Convenience output payloads when present (may include video content blocks).
Bad request (missing/invalid model, invalid previous_interaction_id, unsupported provider.only, etc.)
Invalid Credentials - Your API key is invalid, missing, or disabled. Check your credentials.
Note: the 401 error body uses code, message, param, and type (there is no status field), and type is invalid_request_error.
Insufficient Credits - Your account or API key has run out of credits. Add more credits and retry the request.
Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.
Internal Error - Something went wrong on our side. Retry the request, and contact support if the issue persists.
Upstream / routing failure
GET /v1/interactions/{id} HTTP/1.1
Host: api.fastrouter.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"id": "fr_ID123",
"object": "interaction",
"status": "completed",
"model": "gemini-3.5-flash",
"created": "2025-11-26T12:25:15Z",
"updated": "2025-11-26T12:25:15Z",
"steps": [
{
"type": "model_output",
"content": [
{
"type": "text",
"text": "Why did the GPU go to therapy? Too many cores issues."
}
]
}
],
"usage": {
"total_input_tokens": 7,
"total_output_tokens": 20,
"total_thought_tokens": 22,
"total_tokens": 49,
"cost": 0.00012,
"chat_id": "fr_ID123"
}
}Deletes a stored interaction by id. Alias: /api/v1/interactions/{id}.
FastRouter API Key. Get yours at https://fastrouter.ai
Format: Authorization: Bearer YOUR_API_KEY
Interaction id (fr_… or upstream).
fr_ID123Upstream acknowledged deletion (body may be empty or a small status object).
Deleted with no response body.
Bad request (missing/invalid model, invalid previous_interaction_id, unsupported provider.only, etc.)
Invalid Credentials - Your API key is invalid, missing, or disabled. Check your credentials.
Note: the 401 error body uses code, message, param, and type (there is no status field), and type is invalid_request_error.
Insufficient Credits - Your account or API key has run out of credits. Add more credits and retry the request.
Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.
Internal Error - Something went wrong on our side. Retry the request, and contact support if the issue persists.
Upstream / routing failure
DELETE /v1/interactions/{id} HTTP/1.1
Host: api.fastrouter.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"id": "fr_ID123",
"object": "interaction",
"deleted": true
}Last updated
