---
title: Gemini 3 Flash
description: Gemini 3 Flash is Google's fast multimodal model with frontier intelligence, superior search, and grounding capabilities.
image: https://developers.cloudflare.com/dev-products-preview.png
---

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/ai/llms.txt  
> Use this file to discover all available pages before exploring further. 

[Skip to content](#%5Ftop) 

![Google logo](https://developers.cloudflare.com/_astro/google.DyXKPTPP.svg) 

#  Gemini 3 Flash 

Text Generation • Google 

`google/gemini-3-flash` 

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

| Model Info                                                                 |                                                                                                                         |
| -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| Context Window[ ↗](https://developers.cloudflare.com/workers-ai/glossary/) | 1,000,000 tokens                                                                                                        |
| Terms and License                                                          | [link ↗](https://ai.google.dev/gemini-api/terms)                                                                        |
| More information                                                           | [link ↗](https://deepmind.google/technologies/gemini/)                                                                  |
| Zero data retention                                                        | Yes                                                                                                                     |
| Request formats                                                            | Chat Completions                                                                                                        |
| Pricing                                                                    | [View pricing in the Cloudflare dashboard ↗](https://dash.cloudflare.com/?to=/:account/ai/models/google/gemini-3-flash) |

## Usage

* [ TypeScript ](#tab-panel-536)
* [ cURL ](#tab-panel-537)

TypeScript

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

Terminal window

```
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \  --header "Content-Type: application/json" \  --data '{  "model": "google/gemini-3-flash",  "input": {    "contents": [      {        "parts": [          {            "text": "What are the three laws of thermodynamics?"          }        ],        "role": "user"      }    ]  }}'
```

* [ Output ](#tab-panel-542)
* [ Raw response ](#tab-panel-543)

While there are actually four laws of thermodynamics (numbered 0 through 3), the "Three Laws" usually refer to the following fundamental principles that govern how energy, heat, and matter behave:

### 1. The First Law: The Law of Conservation of Energy
**"Energy cannot be created or destroyed, only transformed from one form to another."**

This law states that the total amount of energy in an isolated system remains constant. In practical terms, if you add heat to a system, that energy must either increase the system's internal temperature or be used to do work on the surroundings.
*   **The Equation:** $\Delta U = Q - W$
    *(Change in internal energy = Heat added - Work done by the system)*

### 2. The Second Law: The Law of Entropy
**"The total entropy of an isolated system can never decrease over time; it can only remain constant or increase."**

Entropy is a measure of "disorder" or randomness. This law explains why processes have a specific direction (the "arrow of time"). It tells us that heat will always flow spontaneously from a hot object to a cold object, and that no machine can ever be 100% efficient because some energy is always "lost" as waste heat.
*   **Key takeaway:** Systems naturally progress toward a state of maximum disorder.

### 3. The Third Law: The Law of Absolute Zero
**"As the temperature of a system approaches absolute zero, its entropy approaches a constant minimum."**

Absolute zero ($0$ Kelvin, or $-273.15^\circ\text{C}$) is the theoretical point where all molecular motion stops. This law implies that it is impossible to reach absolute zero in a finite number of steps. At this temperature, a perfect crystal would have zero entropy.
*   **Key takeaway:** You can get very close to absolute zero, but you can never actually get there.

***

### Bonus: The Zeroth Law (The Law of Equilibrium)
Physicists realized they needed this law *after* the first three were already named, so they called it the "Zeroth" law because it is the most fundamental. 
*   **The Law:** If two systems are each in thermal equilibrium with a third system, they are in thermal equilibrium with each other. 
*   **Simplified:** This is the logic that allows us to use **thermometers**. If the thermometer says the water is $100^\circ$ and the same thermometer says the tea is $100^\circ$, then the water and the tea are the same temperature.

***

### A Common Way to Remember Them:
Scientists often use a cynical "gambling" analogy to remember the laws:
1.  **First Law:** You can’t win (you can’t get more energy out than you put in).
2.  **Second Law:** You can’t even break even (entropy always increases; you always lose some energy to heat).
3.  **Third Law:** You can’t quit the game (you can’t reach absolute zero).

```
{  "candidates": [    {      "avgLogprobs": -0.1735024595133252,      "content": {        "parts": [          {            "text": "While there are actually four laws of thermodynamics (numbered 0 through 3), the \"Three Laws\" usually refer to the following fundamental principles that govern how energy, heat, and matter behave:\n\n### 1. The First Law: The Law of Conservation of Energy\n**\"Energy cannot be created or destroyed, only transformed from one form to another.\"**\n\nThis law states that the total amount of energy in an isolated system remains constant. In practical terms, if you add heat to a system, that energy must either increase the system's internal temperature or be used to do work on the surroundings.\n*   **The Equation:** $\\Delta U = Q - W$\n    *(Change in internal energy = Heat added - Work done by the system)*\n\n### 2. The Second Law: The Law of Entropy\n**\"The total entropy of an isolated system can never decrease over time; it can only remain constant or increase.\"**\n\nEntropy is a measure of \"disorder\" or randomness. This law explains why processes have a specific direction (the \"arrow of time\"). It tells us that heat will always flow spontaneously from a hot object to a cold object, and that no machine can ever be 100% efficient because some energy is always \"lost\" as waste heat.\n*   **Key takeaway:** Systems naturally progress toward a state of maximum disorder.\n\n### 3. The Third Law: The Law of Absolute Zero\n**\"As the temperature of a system approaches absolute zero, its entropy approaches a constant minimum.\"**\n\nAbsolute zero ($0$ Kelvin, or $-273.15^\\circ\\text{C}$) is the theoretical point where all molecular motion stops. This law implies that it is impossible to reach absolute zero in a finite number of steps. At this temperature, a perfect crystal would have zero entropy.\n*   **Key takeaway:** You can get very close to absolute zero, but you can never actually get there.\n\n***\n\n### Bonus: The Zeroth Law (The Law of Equilibrium)\nPhysicists realized they needed this law *after* the first three were already named, so they called it the \"Zeroth\" law because it is the most fundamental. \n*   **The Law:** If two systems are each in thermal equilibrium with a third system, they are in thermal equilibrium with each other. \n*   **Simplified:** This is the logic that allows us to use **thermometers**. If the thermometer says the water is $100^\\circ$ and the same thermometer says the tea is $100^\\circ$, then the water and the tea are the same temperature.\n\n***\n\n### A Common Way to Remember Them:\nScientists often use a cynical \"gambling\" analogy to remember the laws:\n1.  **First Law:** You can’t win (you can’t get more energy out than you put in).\n2.  **Second Law:** You can’t even break even (entropy always increases; you always lose some energy to heat).\n3.  **Third Law:** You can’t quit the game (you can’t reach absolute zero).",            "thoughtSignature": "CqkLAY89a19qCNl4uuKEEiZFrk/uT0hJLwMSmY8qnonXaWSr5n37N6xw9j45+UGCClhbVuK6cpRq7/oR4Tdzhsy6w7W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7cbRqaZNbJun7ZRWb0lAIpUYO+P7jixDdMMr8sLtuYkbsd92Y/QlrDzSI5Dfb9Jg+5iPp+FvJappnXgjr3ZbdgV/4pXL7OznXMx+AWxrhldHVCmvW+qmlP8gJGovBfdR9t9rJSYlWP4M9UCjscUo/6Wl3xUEIdVtNf6gvfdb7LhT0e/AwIZmLEpvtbW8VTYtw7Ly4VWe0a/fkLP8d/L4p/nwb5PiARkbyLT0VIG5K3yZ+1F5d85ispp2szwjABH2yGgqQBbMUu4I/iae3VhFgOw24BabtdnH+QmogvA2Hi6wePJ4fmz2L+AVIwkGG7Z2ta6hde/8KEn38oM68LF6gJYvRkk1TFhSZlrYPZ+g1Ei+5gak37sbErhQ3qvkfxPIVBcuTRXQFR/a29L+Bcj4wvShU8PILtNaandlEQcMGfJzjU9cyM3EbJd1m/vIvHKL6gOjE2VUTqYfm8N0ELe/Kyvj1GJ1So3x2CMpYQJmNrrQBDA2SIJjdsXytkV5Ycaxt8cOCK9rkAkHHZ5lsujjjh2GgjJSWUKWeVWHCIfAwn8lsCIIZydTX1L515g7Rlz+hl29aZwf8F/cnBM68h5tu0zmfZAHCl3J6WuleW8ya1Ht6aOdb8Xe1xI+KKFJ+VnHjHU6Q7mLTWzaaNvboOBF5pW0dFDisDo+7YleHAtx5V9E3W3C2/V3pFrgjmfGAw3/tOR9h5ShpWdqAVJDWJCcZ4mYk3R0Wa7ezA2uTJpzKfl4Ya6XSisX9VN+EZfW4mglXB"          }        ],        "role": "model"      },      "finishReason": "STOP"    }  ],  "createTime": "2026-04-17T05:47:50.289216Z",  "gatewayMetadata": {    "keySource": "Unified"  },  "modelVersion": "gemini-3-flash-preview",  "responseId": "hsnhacDTEYGPq8YPsdmS-Qc",  "usageMetadata": {    "candidatesTokenCount": 652,    "candidatesTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 652      }    ],    "promptTokenCount": 8,    "promptTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 8      }    ],    "thoughtsTokenCount": 363,    "totalTokenCount": 1023,    "trafficType": "ON_DEMAND"  }}
```

## Examples

**With System Instruction**  — Using a system instruction to set context 

* [ TypeScript ](#tab-panel-538)
* [ cURL ](#tab-panel-539)

TypeScript

```
const response = await env.AI.run(  'google/gemini-3-flash',  {    contents: [{ parts: [{ text: 'How do I read a JSON file in Python?' }], role: 'user' }],    generationConfig: { temperature: 0.3 },    systemInstruction: {      parts: [{ text: 'You are a helpful coding assistant specializing in Python.' }],    },  },)console.log(response)
```

Terminal window

```
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \  --header "Content-Type: application/json" \  --data '{  "model": "google/gemini-3-flash",  "input": {    "contents": [      {        "parts": [          {            "text": "How do I read a JSON file in Python?"          }        ],        "role": "user"      }    ],    "generationConfig": {      "temperature": 0.3    },    "systemInstruction": {      "parts": [        {          "text": "You are a helpful coding assistant specializing in Python."        }      ]    }  }}'
```

* [ Output ](#tab-panel-546)
* [ Raw response ](#tab-panel-547)

To read a JSON file in Python, you use the built-in **`json`** module.

Here is the most common and recommended way to do it:

### Basic Example
```python
import json

# Open the file and load the data
with open('data.json', 'r', encoding='utf-8') as file:
    data = json.load(file)

# Now 'data' is a Python dictionary (or list)
print(data)
```

---

### Key Details to Remember

#### 1. `json.load()` vs `json.loads()`
*   **`json.load(file_object)`**: Used to read from a **file**.
*   **`json.loads(json_string)`**: Used to parse a **string** that contains JSON data (the "s" stands for "string").

#### 2. Using the `with` statement
It is best practice to use the `with` statement because it automatically closes the file for you, even if an error occurs during reading.

#### 3. Handling Encoding
If your JSON file contains special characters (like emojis or non-English letters), it is safer to specify the encoding:
```python
with open('data.json', 'r', encoding='utf-8') as file:
    data = json.load(file)
```

---

### Error Handling
If the file is missing or the JSON is formatted incorrectly, your program will crash. You can wrap it in a `try-except` block to handle these cases:

```python
import json

try:
    with open('data.json', 'r') as file:
        data = json.load(file)
except FileNotFoundError:
    print("The file was not found.")
except json.JSONDecodeError:
    print("The file is not a valid JSON format.")
```

### Reading JSON from a URL
If you want to read JSON directly from the web, you can use the `requests` library:

```python
import requests

response = requests.get('https://api.example.com/data')
data = response.json()  # Automatically parses the JSON
print(data)
```

```
{  "candidates": [    {      "avgLogprobs": -0.09832632964156421,      "content": {        "parts": [          {            "text": "To read a JSON file in Python, you use the built-in **`json`** module.\n\nHere is the most common and recommended way to do it:\n\n### Basic Example\n```python\nimport json\n\n# Open the file and load the data\nwith open('data.json', 'r', encoding='utf-8') as file:\n    data = json.load(file)\n\n# Now 'data' is a Python dictionary (or list)\nprint(data)\n```\n\n---\n\n### Key Details to Remember\n\n#### 1. `json.load()` vs `json.loads()`\n*   **`json.load(file_object)`**: Used to read from a **file**.\n*   **`json.loads(json_string)`**: Used to parse a **string** that contains JSON data (the \"s\" stands for \"string\").\n\n#### 2. Using the `with` statement\nIt is best practice to use the `with` statement because it automatically closes the file for you, even if an error occurs during reading.\n\n#### 3. Handling Encoding\nIf your JSON file contains special characters (like emojis or non-English letters), it is safer to specify the encoding:\n```python\nwith open('data.json', 'r', encoding='utf-8') as file:\n    data = json.load(file)\n```\n\n---\n\n### Error Handling\nIf the file is missing or the JSON is formatted incorrectly, your program will crash. You can wrap it in a `try-except` block to handle these cases:\n\n```python\nimport json\n\ntry:\n    with open('data.json', 'r') as file:\n        data = json.load(file)\nexcept FileNotFoundError:\n    print(\"The file was not found.\")\nexcept json.JSONDecodeError:\n    print(\"The file is not a valid JSON format.\")\n```\n\n### Reading JSON from a URL\nIf you want to read JSON directly from the web, you can use the `requests` library:\n\n```python\nimport requests\n\nresponse = requests.get('https://api.example.com/data')\ndata = response.json()  # Automatically parses the JSON\nprint(data)\n```",            "thoughtSignature": "CpoIAY89a18jqSNoAkdnLwrTiEVOfCWU2h+i0cF80VkEbpiDJonCd8buSMVdR/N8pVtqibgPP3INdZkmGbxBAer3Ojz/B+IvLyYtJEvr9Lj7q18FPXX1GOG10u3noKl3uyxQ2doaIGaJ+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Rvc7guEc01pRl4i0RUYZGjkVC3SdC55H1UrH6uYQ938j2FJhLgih2RqEKEfWENwYs20zxJTkJwxw9fBUcfob9Qakhay5CNLZQ9C29H3Y7YmSo7nIf72upvVFy8rMUXY4H7l9CU/ZMR+bxLWDEY+ly/RaOOAscpiGHdOtgvghnps8Jbqk9VaTTXZ9nhcujJ"          }        ],        "role": "model"      },      "finishReason": "STOP"    }  ],  "createTime": "2026-04-17T05:47:57.460588Z",  "gatewayMetadata": {    "keySource": "Unified"  },  "modelVersion": "gemini-3-flash-preview",  "responseId": "jcnhaayOHISRq8YP2o-ouQg",  "usageMetadata": {    "candidatesTokenCount": 476,    "candidatesTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 476      }    ],    "promptTokenCount": 20,    "promptTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 20      }    ],    "thoughtsTokenCount": 296,    "totalTokenCount": 792,    "trafficType": "ON_DEMAND"  }}
```

**Multi-turn Conversation**  — Continuing a conversation with context 

* [ TypeScript ](#tab-panel-544)
* [ cURL ](#tab-panel-545)

TypeScript

```
const response = await env.AI.run(  'google/gemini-3-flash',  {    contents: [      {        parts: [{ text: 'I need help planning a road trip from San Francisco to Los Angeles.' }],        role: 'user',      },      {        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: 'model',      },      { parts: [{ text: 'Yes, what are some good places to stop?' }], role: 'user' },    ],    generationConfig: { maxOutputTokens: 2048 },  },)console.log(response)
```

Terminal window

```
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \  --header "Content-Type: application/json" \  --data '{  "model": "google/gemini-3-flash",  "input": {    "contents": [      {        "parts": [          {            "text": "I need help planning a road trip from San Francisco to Los Angeles."          }        ],        "role": "user"      },      {        "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": "model"      },      {        "parts": [          {            "text": "Yes, what are some good places to stop?"          }        ],        "role": "user"      }    ],    "generationConfig": {      "maxOutputTokens": 2048    }  }}'
```

* [ Output ](#tab-panel-548)
* [ Raw response ](#tab-panel-549)

To give you the best recommendations, it helps to know how much time you have. The drive can

```
{  "candidates": [    {      "avgLogprobs": -7.779651683751491,      "content": {        "parts": [          {            "text": "To give you the best recommendations, it helps to know how much time you have. The drive can",            "thoughtSignature": "CsEMAY89a1+MKxwIRFM9FZAI5vUueKSbga//EOdZuU7xXNiL7Af8Qk69+AoQGdXTicASRYeElP17NgERz6Szv5b0K7Wp0fhgWOIKhd6TuTHBGsH86lSet25yLc08epSZS5vfj5QsA7yI2gvxwfZn6M3z8RtdP7XbW0ueIM+qzDq8apirDmwO2re+2E9rNNVSQKARCZQ/ZXMcVAcWRO4i4r3OxOpdX7cBdGPuv11Xoj1rlMYvBuxRJs54SQAO0sVcMmvJNosLtOUqlp6gtwbLe0lvd+iF7pf/E9kc8OOuGPDFwolyPoCDebkgUIFSI2tpKtMm/Wb3BNAvNjxf9/wHKefo7wi3/lXdC2lGIMdcq0QTVHYq1P+lJN3knGL2NCTNxwXBtKMrLqPSfRFjm36hf1ItchDklYW+UIi32/+zoId0O/N4NGcKi3JBcMuT0dxwAmVmVVwhdtuSRLzKaZtub7lKa/At8loruBQt9Pyqr2CcRfXgkr6bmoXfeUQi4Nx+NP9f3A5uehrPFyST7QQhkXvvkvf8tiumQbqxkSmK+U0yBaMeBTPKPOlkqU1C5doe2nep13HtWQHGHcnYLQ+Z2lD2xmldC4fg/5rnM2NW3cw48DZ95cVjS2yDlvvfMZlhWg0JthF8raqluhQ2KoQbMHjZKsc3f14CLq4dJE0clzRKDQDVAIVfiahOM4fTlRSekyTP6xwEH+9FZUhuy+tJqJEz/Ucd6MrJ5mdpWU8JE1K4F5uznvv9rx/clyiXqKj7tiQAfv4TYHVQIEvHuysCQidX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2npbCxUhkt7Pk5Tiy1XcvytR+qXxekHhFRo8ODLkuka5RTuhsABO7z9dRWnWBU5Bn7qoT7CurVufof3ssqR1BcsTjzxDG621ALUTxnxi39gre6O+PaZFUsEv3tLojU6vjU+ABPOsY+um7I2BF0EBeNRasknuFPgzfXQLyTb6yrEvEQ0lJCbemjyFXD5onJo0TDY4flH+lxZrIXkjnxxnmn61oICa3r5U6hnCXKhtIAbzs75hBPiM81esMREFA2FQ+OeJqznsMhejig="          }        ],        "role": "model"      },      "finishReason": "MAX_TOKENS"    }  ],  "createTime": "2026-04-17T05:48:02.222198Z",  "gatewayMetadata": {    "keySource": "Unified"  },  "modelVersion": "gemini-3-flash-preview",  "responseId": "ksnhafbHDZCeq8YPtfXXyQ4",  "usageMetadata": {    "candidatesTokenCount": 20,    "candidatesTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 20      }    ],    "promptTokenCount": 64,    "promptTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 64      }    ],    "thoughtsTokenCount": 476,    "totalTokenCount": 560,    "trafficType": "ON_DEMAND"  }}
```

**Creative Writing**  — Higher temperature for creative output 

* [ TypeScript ](#tab-panel-540)
* [ cURL ](#tab-panel-541)

TypeScript

```
const response = await env.AI.run(  'google/gemini-3-flash',  {    contents: [      {        parts: [{ text: 'Write a short story opening about a detective finding an unusual clue.' }],        role: 'user',      },    ],    generationConfig: { maxOutputTokens: 1500, temperature: 0.8 },  },)console.log(response)
```

Terminal window

```
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \  --header "Content-Type: application/json" \  --data '{  "model": "google/gemini-3-flash",  "input": {    "contents": [      {        "parts": [          {            "text": "Write a short story opening about a detective finding an unusual clue."          }        ],        "role": "user"      }    ],    "generationConfig": {      "maxOutputTokens": 1500,      "temperature": 0.8    }  }}'
```

* [ Output ](#tab-panel-550)
* [ Raw response ](#tab-panel-551)

The yellow police tape hummed in the drafty

```
{  "candidates": [    {      "avgLogprobs": -15.592795781649631,      "content": {        "parts": [          {            "text": "The yellow police tape hummed in the drafty",            "thoughtSignature": "CvAIAY89a184jaSQCZEM4oHqR38/9rVamPb8K209g7cY61/Q3OxFivZwmOKnowcQMnAxvVGTaxxuDlXAqiNS70l3UPnk+3GPr8wExttqJyoSzP/k1E1UpMurGT/CEhXJnmfAaf3ChjjPztJVM/Mb94nkIjh284U1w0KQOHh/T1Za3F3KUlkPVcIPOoctReIMhsI1Z/Do/LZykKPYMZtDp73oJU6ADi+Yo6DZH1Voc56qKXmJTCadmNjsNXzTkklCXdwspIvfdeh3MeT/DY3wbu8SseGNxp8JQx6v+6hry8KL9G0EjP478Zz2iYmV58hdWvmhSvioQtJ9wGN2CEK4v2vpmGmlO4Xzh908uu3YA6pHevmPrgkWjYwJ/vZ27kVFCL2pfXNNQBWcX9rQuGueSfkLYjBr90c6iyVJcM/saAbmBbBfKHko5rfkwwKjPFoj9y8kXQ7lBl3H9YRVjvkfJNxaDVxz+IygwHB52H1h78mZmc27g9faKAwzxn/GNhIG3r18TVKy6liAsebOVKpeC1bPuFIGEo6nwdzIBdsJP7/ngU9+4mCZ60/n3293iPJxff4zA+7tRTfjDTjtSuPW2Ta6phZ2NfnKwKWbwuwqxDdSAK9N8RRugb6hn2o7lIoG1BEQ+T3W728uzpDFhEpa0P9RBiYAV1oDJ5kDCZBdC7JqWS1RjxfOqe8Mh6KgMD8eMEImYF4dHU8Ppt4BANexgK3rSHSauW3Ykb0r8KxTIjKmd6mJ/ImJLuqwVshwjx8Ovbt38D9cag4MiNbq5rwjAgTk1BbFF0XQvTRef2LHYEqIBIvYYxKLH6eYFhrAWG/TT9tp7R/TZD2pfs+fGqMzyehGEFOUjMyhphgK5o0hKsXe/xHGeQsTdu3kFySVlc+bvzV5ve0T2hau1xXD+tnBNFpCaHlS25amUdTXJluWuF2iDfzet648bckCQTxQRBEGT5QiF7CKdvu+l3x/Jct5l9ZynwMcr0rHhkm+7iL74QFykS1lZT+9GiJO7bj2Onz6RUdAIAEg7PWp/zvwX8P+uSeXMMX0hBuRZ69oR1z9EfUFBsravP/XwxWpbFi2QCk2RhbaBolrzPkNq5C1Fnk7H1YWFvDkRnQ+vCVdWitRVhIJSJ/MCuH2ryewJ1eywlVLPddlu/mGtTqAMJSZJz+f6h9BUrRffA8EDL10L2lVb+IpwvVrwvaVqCoFiRYmYmtyrm+ckJMR/8LRsM5aCoJyKGgt/QmhLrDI9br/r6ghkxj4IhS4K03+rcDpG6aZ/W6WKw5tnq/gaZNG7ZhV6PXSxuKdTBMnw6waSqFc2d1UhLTbSwJDxhUn3seOWltq6rBRxJNLRxn/rB0aM3G0chiHQxMwKZxoXBhmc+Lph07RZlSs/IGdn1tvPNhDbAKEVCBwRUrvouCYNdOqS5UCkLwnTFOpm5XX3G+I/hFPgBgZksGu7ylh298RfWUaojbDBd5rWjs6/vDyNKT8/M80B3B+anLSgpoGl+Emv0ocdKJbVf5OBCo="          }        ],        "role": "model"      },      "finishReason": "MAX_TOKENS"    }  ],  "createTime": "2026-04-17T05:48:06.216204Z",  "gatewayMetadata": {    "keySource": "Unified"  },  "modelVersion": "gemini-3-flash-preview",  "responseId": "lsnhaYyZDd-jq8YPlobFmAo",  "usageMetadata": {    "candidatesTokenCount": 10,    "candidatesTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 10      }    ],    "promptTokenCount": 13,    "promptTokensDetails": [      {        "modality": "TEXT",        "tokenCount": 13      }    ],    "thoughtsTokenCount": 286,    "totalTokenCount": 309,    "trafficType": "ON_DEMAND"  }}
```

## Parameters

Schema variant

Generate ContentChat Completions

* [ Input ](#tab-panel-552)
* [ Output ](#tab-panel-553)

▶contents\[\]

`array`required

▶systemInstruction{}

`object`

▶generationConfig{}

`object`

▶safetySettings\[\]

`array`

▶tools\[\]

`array`

toolConfig

``

▶messages\[\]

`array`required

temperature

`number`minimum: 0maximum: 2

max\_tokens

`number`exclusiveMinimum: 0

max\_completion\_tokens

`number`exclusiveMinimum: 0

top\_p

`number`minimum: 0maximum: 1

frequency\_penalty

`number`minimum: \-2maximum: 2

presence\_penalty

`number`minimum: \-2maximum: 2

stream

`boolean`

▶stream\_options{}

`object`

▶tools\[\]

`array`

tool\_choice

``

response\_format

``

▶modalities\[\]

`array`

▶audio{}

`object`

▶candidates\[\]

`array`

▶usageMetadata{}

`object`

modelVersion

`string`

id

`string`

object

`string`

created

`number`

model

`string`

▶choices\[\]

`array`

▶usage{}

`object`

## API Schemas (Raw)

Input [ ](https://developers.cloudflare.com/ai/models/google/gemini-3-flash/schema-input.json "Open") [ ](https://developers.cloudflare.com/ai/models/google/gemini-3-flash/schema-input.json "Download") 

Output [ ](https://developers.cloudflare.com/ai/models/google/gemini-3-flash/schema-output.json "Open") [ ](https://developers.cloudflare.com/ai/models/google/gemini-3-flash/schema-output.json "Download")

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai/models/google/gemini-3-flash/#page","headline":"Gemini 3 Flash (Google) · Cloudflare AI docs · Cloudflare AI docs","description":"Gemini 3 Flash is Google's fast multimodal model with frontier intelligence, superior search, and grounding capabilities.","url":"https://developers.cloudflare.com/ai/models/google/gemini-3-flash/","inLanguage":"en","image":"https://developers.cloudflare.com/dev-products-preview.png","publisher":{"@type":"Organization","name":"Cloudflare","url":"https://www.cloudflare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/ai/","name":"AI"}},{"@type":"ListItem","position":3,"item":{"@id":"/ai/models/","name":"Models"}}]}
```
