File Analysis
The Gemini Interactions API supports multimodal input via content blocks in the input array. Upload files via the Files API first, then reference the returned uri in your request.
Endpoint and authentication are the same as Text Generation.
Route prerequisite
These are Interactions protocol examples. The current local gateway registers Gemini generateContent, not /v1beta/interactions; run these examples only if your deployment separately provides that route. See Gemini CLI for native clients and Nano Banana for image generation. On 404, do not change only the URL: the request and response schemas differ.
Content Block Types
| Type | Description |
|---|---|
text | Text prompt accompanying the media input |
image | Image with uri and mime_type (e.g. image/jpeg, image/png) |
document | PDF document with uri and mime_type: "application/pdf" |
video | Video with uri and mime_type (e.g. video/mp4) |
audio | Audio with uri and mime_type (e.g. audio/wav, audio/mp3) |
Obtain an Accessible File URI
Obtain a uri through an upload flow confirmed to be supported by Tokatlas, then replace YOUR_FILE_URI below. This page does not specify the upload endpoint or request format; confirm these with the service administrator first. URIs from other providers or accounts may not be accessible. Wait for any file processing to finish before creating the interaction.
Image Analysis
{
"model": "gemini-3.7-flash",
"input": [
{"type": "text", "text": "Tell me about this instrument"},
{
"type": "image",
"uri": "YOUR_FILE_URI",
"mime_type": "image/jpeg"
}
]
}Video Analysis
{
"model": "gemini-3.7-flash",
"input": [
{"type": "text", "text": "Summarize what happens in this video."},
{
"type": "video",
"uri": "YOUR_FILE_URI",
"mime_type": "video/mp4"
}
]
}Audio Analysis
{
"model": "gemini-3.7-flash",
"input": [
{"type": "text", "text": "Transcribe and summarize this audio."},
{
"type": "audio",
"uri": "YOUR_FILE_URI",
"mime_type": "audio/wav"
}
]
}Document Analysis
For PDF and other documents, upload via the Files API and reference the URI:
{
"model": "gemini-3.7-flash",
"input": [
{"type": "text", "text": "Summarize the key points in this document."},
{
"type": "document",
"uri": "YOUR_FILE_URI",
"mime_type": "application/pdf"
}
]
}Request Example
See language setup. Set API_KEY and replace model, file URL, and ID placeholders first. Each version displays the raw response to the same request.
curl --fail-with-body --silent --show-error --max-time 180 \
--request POST \
--url "https://api.tokatlas.ai/v1beta/interactions" \
--header "x-goog-api-key: $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "gemini-3.7-flash",
"input": [
{
"type": "text",
"text": "Describe this image in detail."
},
{
"type": "image",
"uri": "YOUR_FILE_URI",
"mime_type": "image/jpeg"
}
]
}'import os
import requests
headers = {
'x-goog-api-key': os.environ["API_KEY"],
'Content-Type': 'application/json',
}
payload = {'model': 'gemini-3.7-flash',
'input': [{'type': 'text', 'text': 'Describe this image in detail.'},
{'type': 'image', 'uri': 'YOUR_FILE_URI', 'mime_type': 'image/jpeg'}]}
response = requests.request(
'POST', 'https://api.tokatlas.ai/v1beta/interactions', headers=headers,
json=payload,
timeout=180,
)
response.raise_for_status()
print(response.text)if (!process.env.API_KEY) throw new Error("Set API_KEY first.");
const response = await fetch("https://api.tokatlas.ai/v1beta/interactions", {
method: "POST",
headers: {
"x-goog-api-key": process.env.API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "gemini-3.7-flash",
"input": [
{
"type": "text",
"text": "Describe this image in detail."
},
{
"type": "image",
"uri": "YOUR_FILE_URI",
"mime_type": "image/jpeg"
}
]
}),
signal: AbortSignal.timeout(180_000),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.text());import java.net.URI;
import java.net.http.*;
import java.time.Duration;
public class Example {
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("API_KEY");
if (apiKey == null || apiKey.isBlank()) {
throw new IllegalArgumentException("Set API_KEY first.");
}
String payload = String.join("\n",
"{",
" \"model\": \"gemini-3.7-flash\",",
" \"input\": [",
" {",
" \"type\": \"text\",",
" \"text\": \"Describe this image in detail.\"",
" },",
" {",
" \"type\": \"image\",",
" \"uri\": \"YOUR_FILE_URI\",",
" \"mime_type\": \"image/jpeg\"",
" }",
" ]",
"}"
);
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(30)).build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.tokatlas.ai/v1beta/interactions"))
.timeout(Duration.ofSeconds(180))
.header("x-goog-api-key", apiKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(
request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() < 200 || response.statusCode() >= 300) {
throw new IllegalStateException("HTTP " + response.statusCode() + ": "
+ response.body());
}
System.out.println(response.body());
}
}Response Example
{
"id": "interaction_abc123",
"model": "gemini-3.7-flash",
"steps": [
{
"type": "model_output",
"content": [
{
"type": "text",
"text": "The image shows a vintage acoustic guitar with a sunburst finish, positioned against a dark background..."
}
]
}
],
"status": "completed"
}Related Topics
Text Generation — Text conversation and streaming
Tool Calling — Function calling and tool use
