Example Request
curl -X POST https://aiplatform.googleapis.com/v1/projects/{project}/locations/global/interactions \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-H "Api-Revision: 2026-05-20" \
-d '{
"model": "gemini-3.8-flash",
"input": [
{
"type": "user_input",
"content": [
{
"type": "text",
"text": "Hello!"
}
]
},
{
"type": "model_output",
"content": [
{
"type": "text",
"text": "Hi there! How can I help you today?"
}
]
},
{
"type": "user_input",
"content": [
{
"type": "text",
"text": "What is the capital of France?"
}
]
}
]
}'
from google import genai
client = genai.Client(vertexai=True, location='global')
interaction = client.interactions.create(
model="gemini-3.8-flash",
input=[
{
"type": "user_input",
"content": [{"type": "text", "text": "Hello!"}],
},
{
"type": "model_output",
"content": [
{"type": "text", "text": "Hi there! How can I help you today?"}
],
},
{
"type": "user_input",
"content": [
{"type": "text", "text": "What is the capital of France?"}
],
},
],
)
print(interaction.output_text)
import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({vertexai: true, location: 'global'});
const interaction = await ai.interactions.create({
model: 'gemini-3.8-flash',
input: [
{
type: 'user_input',
content: [{type: 'text', text: 'Hello!'}],
},
{
type: 'model_output',
content: [{type: 'text', text: 'Hi there! How can I help you today?'}],
},
{
type: 'user_input',
content: [{type: 'text', text: 'What is the capital of France?'}],
},
],
});
console.log(interaction.output_text);