Skip to content
Google logo

Gemini 3 Flash

Text GenerationGoogleProxied

Gemini 3 Flash is Google's fast multimodal model with frontier intelligence, superior search, and grounding capabilities.

Model Info
Context Window1,000,000 tokens
Terms and Licenselink
More informationlink

Usage

TypeScript
const response = await env.AI.run(
'google/gemini-3-flash',
{
contents: [
{
role: 'user',
parts: [
{
text: 'What are the three laws of thermodynamics?',
},
],
},
],
},
{
gateway: { id: 'default' },
}
)
console.log(response)

Examples

With System Instruction — Using a system instruction to set context
TypeScript
const response = await env.AI.run(
'google/gemini-3-flash',
{
systemInstruction: {
parts: [
{
text: 'You are a helpful coding assistant specializing in Python.',
},
],
},
contents: [
{
role: 'user',
parts: [
{
text: 'How do I read a JSON file in Python?',
},
],
},
],
generationConfig: {
temperature: 0.3,
},
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Multi-turn Conversation — Continuing a conversation with context
TypeScript
const response = await env.AI.run(
'google/gemini-3-flash',
{
contents: [
{
role: 'user',
parts: [
{
text: 'I need help planning a road trip from San Francisco to Los Angeles.',
},
],
},
{
role: 'model',
parts: [
{
text: "I'd be happy to help! The drive is about 380 miles and takes roughly 5-6 hours. Would you like suggestions for scenic routes or interesting stops along the way?",
},
],
},
{
role: 'user',
parts: [
{
text: 'Yes, what are some good places to stop?',
},
],
},
],
generationConfig: {
maxOutputTokens: 500,
},
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Creative Writing — Higher temperature for creative output
TypeScript
const response = await env.AI.run(
'google/gemini-3-flash',
{
contents: [
{
role: 'user',
parts: [
{
text: 'Write a short story opening about a detective finding an unusual clue.',
},
],
},
],
generationConfig: {
temperature: 0.8,
maxOutputTokens: 300,
},
},
{
gateway: { id: 'default' },
}
)
console.log(response)

Parameters

toolConfig

API Schemas

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"contents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string",
"enum": [
"user",
"model"
]
},
"parts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"additionalProperties": {}
}
}
},
"required": [
"parts"
],
"additionalProperties": {}
}
},
"systemInstruction": {
"type": "object",
"properties": {
"parts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"additionalProperties": {}
}
}
},
"required": [
"parts"
],
"additionalProperties": {}
},
"generationConfig": {
"type": "object",
"properties": {
"temperature": {
"type": "number"
},
"topP": {
"type": "number"
},
"topK": {
"type": "number"
},
"maxOutputTokens": {
"type": "number"
},
"candidateCount": {
"type": "number"
},
"stopSequences": {
"type": "array",
"items": {
"type": "string"
}
},
"responseMimeType": {
"type": "string"
}
},
"additionalProperties": {}
},
"safetySettings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"category": {
"type": "string"
},
"threshold": {
"type": "string"
}
},
"required": [
"category",
"threshold"
],
"additionalProperties": {}
}
},
"tools": {
"type": "array",
"items": {}
},
"toolConfig": {}
},
"required": [
"contents"
],
"additionalProperties": {}
}