Gemini 2.5 Pro
Text Generation • Google
google/gemini-2.5-pro
- Third-party
- Zero data retention
Google's most capable Gemini 2.5 model with strong reasoning, thinking support, and a 1M token context window.
| Model Info | |
|---|---|
| Context Window ↗ | 1,000,000 tokens |
| Terms and License | link ↗ |
| More information | link ↗ |
| Zero data retention | Yes |
| Request formats | Chat Completions |
| Pricing | <ul><li>Input (per 1M tokens)$1.25</li><li>Output (per 1M tokens)$10.00</li><li>Cached input (per 1M tokens)$0.125</li></ul> |
Usage
const response = await env.AI.run(
'google/gemini-2.5-pro',
{ contents: [{ parts: [{ text: 'What are the three laws of thermodynamics?' }], role: 'user' }] },
)
console.log(response)
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-2.5-pro",
"input": {
"contents": [
{
"parts": [
{
"text": "What are the three laws of thermodynamics?"
}
],
"role": "user"
}
]
}
}'
Of course! The three laws of thermodynamics are fundamental principles in physics that describe the relationships between heat, energy, and work.
Here they are, explained from a simple "catchphrase" summary to a more detailed breakdown.
***
### A Quick Summary (The "Gambling" Analogy)
A popular, easy way to remember the laws is to think of them in terms of a game:
1. **First Law:** You can't win. (You can't get more energy out than you put in.)
2. **Second Law:** You can't break even. (You can't even get back the energy you put in, in a perfectly useful form.)
3. **Third Law:** You can't quit the game. (You can't reach absolute zero and stop all energy.)
***
### The Detailed Explanation
Before the three main laws, it's helpful to understand the **Zeroth Law**, which was formulated after the others but is more fundamental.
#### The Zeroth Law of Thermodynamics: Defines Temperature
* **Simple Statement:** Objects in thermal equilibrium are at the same temperature.
* **Explanation:** If two systems are each in thermal equilibrium with a third system, then they are also in thermal equilibrium with each other. This law sounds obvious, but it's what makes thermometers work. When you put a thermometer in a cup of coffee, the thermometer and coffee reach thermal equilibrium. If you then use that thermometer on another cup and it gives the same reading, you know both cups are the same temperature without them ever having touched.
---
### 1. The First Law of Thermodynamics: Conservation of Energy
* **Simple Statement:** Energy cannot be created or destroyed, only converted from one form to another.
* **Explanation:** This is the thermodynamic version of the law of conservation of energy. It means that the total energy in a closed system is constant. If you add energy to a system (e.g., by heating it), that energy doesn't disappear. It either increases the system's internal energy (making it hotter) or is used by the system to do work on its surroundings (like a piston moving). You can't get free energy out of nothing.
* **Everyday Example:** When you eat food, the chemical energy stored in the food is converted by your body into thermal energy (to keep you warm) and kinetic energy (to move your muscles). The energy isn't created; it's just transformed.
---
### 2. The Second Law of Thermodynamics: The Increase of Entropy
* **Simple Statement:** The total entropy (disorder) of the universe always increases over time.
* **Explanation:** This is arguably the most profound of the laws. It states that natural processes tend to move towards a state of greater disorder or randomness (entropy). Heat will always spontaneously flow from a hotter object to a colder object, never the other way around. This flow increases the overall entropy because the energy becomes more spread out and less "organized." Because of this law, no energy transfer is 100% efficient; some energy is always lost as waste heat, increasing the overall disorder of the universe.
* **Everyday Example:** A hot cup of coffee will always cool down to room temperature. The concentrated heat (an ordered state) will spread out into the cooler, larger room (a more disordered state). You will never see a room-temperature cup of coffee spontaneously become hot by drawing heat from the air. Similarly, an ice cube melts in a warm room, moving from an ordered crystal structure to a disordered liquid.
---
### 3. The Third Law of Thermodynamics: Absolute Zero is Unreachable
* **Simple Statement:** The entropy of a system approaches a minimum value as the temperature approaches absolute zero. It is impossible to reach absolute zero in a finite number of steps.
* **Explanation:** Absolute zero (0 Kelvin or -273.15°C / -459.67°F) is the theoretical temperature at which all particle motion would completely stop. The Third Law states that as you get colder and closer to this temperature, the entropy of a perfect crystal becomes zero. However, the law also implies that it's physically impossible to ever reach absolute zero. Each step you take to cool a system gets you closer, but the effort required to remove the next bit of heat increases exponentially. You can get incredibly close, but you can never take that final step to get there.
* **Everyday Example:** This law is less intuitive in daily life as it deals with extreme cold. But you can think of it like trying to create a perfect vacuum by pumping all the air out of a container. With each pump, you remove a fraction of the remaining air, so you get closer and closer to a perfect vacuum but never fully achieve it because there will always be *some* molecules left. Reaching absolute zero is a similar process of diminishing returns.
| Law | Simple Statement | Key Concept |
| :--- | :--- | :--- |
| **Zeroth** | Defines temperature. | Thermal Equilibrium |
| **First** | Energy is conserved. | Conservation of Energy |
| **Second**| Disorder (entropy) increases. | Entropy & The Arrow of Time |
| **Third** | Absolute zero is unreachable. | Absolute Zero & Minimum Entropy |
{
"candidates": [
{
"avgLogprobs": -0.3830967711048414,
"content": {
"parts": [
{
"text": "Of course! The three laws of thermodynamics are fundamental principles in physics that describe the relationships between heat, energy, and work.\n\nHere they are, explained from a simple \"catchphrase\" summary to a more detailed breakdown.\n\n***\n\n### A Quick Summary (The \"Gambling\" Analogy)\n\nA popular, easy way to remember the laws is to think of them in terms of a game:\n\n1. **First Law:** You can't win. (You can't get more energy out than you put in.)\n2. **Second Law:** You can't break even. (You can't even get back the energy you put in, in a perfectly useful form.)\n3. **Third Law:** You can't quit the game. (You can't reach absolute zero and stop all energy.)\n\n***\n\n### The Detailed Explanation\n\nBefore the three main laws, it's helpful to understand the **Zeroth Law**, which was formulated after the others but is more fundamental.\n\n#### The Zeroth Law of Thermodynamics: Defines Temperature\n* **Simple Statement:** Objects in thermal equilibrium are at the same temperature.\n* **Explanation:** If two systems are each in thermal equilibrium with a third system, then they are also in thermal equilibrium with each other. This law sounds obvious, but it's what makes thermometers work. When you put a thermometer in a cup of coffee, the thermometer and coffee reach thermal equilibrium. If you then use that thermometer on another cup and it gives the same reading, you know both cups are the same temperature without them ever having touched.\n\n---\n\n### 1. The First Law of Thermodynamics: Conservation of Energy\n\n* **Simple Statement:** Energy cannot be created or destroyed, only converted from one form to another.\n* **Explanation:** This is the thermodynamic version of the law of conservation of energy. It means that the total energy in a closed system is constant. If you add energy to a system (e.g., by heating it), that energy doesn't disappear. It either increases the system's internal energy (making it hotter) or is used by the system to do work on its surroundings (like a piston moving). You can't get free energy out of nothing.\n* **Everyday Example:** When you eat food, the chemical energy stored in the food is converted by your body into thermal energy (to keep you warm) and kinetic energy (to move your muscles). The energy isn't created; it's just transformed.\n\n---\n\n### 2. The Second Law of Thermodynamics: The Increase of Entropy\n\n* **Simple Statement:** The total entropy (disorder) of the universe always increases over time.\n* **Explanation:** This is arguably the most profound of the laws. It states that natural processes tend to move towards a state of greater disorder or randomness (entropy). Heat will always spontaneously flow from a hotter object to a colder object, never the other way around. This flow increases the overall entropy because the energy becomes more spread out and less \"organized.\" Because of this law, no energy transfer is 100% efficient; some energy is always lost as waste heat, increasing the overall disorder of the universe.\n* **Everyday Example:** A hot cup of coffee will always cool down to room temperature. The concentrated heat (an ordered state) will spread out into the cooler, larger room (a more disordered state). You will never see a room-temperature cup of coffee spontaneously become hot by drawing heat from the air. Similarly, an ice cube melts in a warm room, moving from an ordered crystal structure to a disordered liquid.\n\n---\n\n### 3. The Third Law of Thermodynamics: Absolute Zero is Unreachable\n\n* **Simple Statement:** The entropy of a system approaches a minimum value as the temperature approaches absolute zero. It is impossible to reach absolute zero in a finite number of steps.\n* **Explanation:** Absolute zero (0 Kelvin or -273.15°C / -459.67°F) is the theoretical temperature at which all particle motion would completely stop. The Third Law states that as you get colder and closer to this temperature, the entropy of a perfect crystal becomes zero. However, the law also implies that it's physically impossible to ever reach absolute zero. Each step you take to cool a system gets you closer, but the effort required to remove the next bit of heat increases exponentially. You can get incredibly close, but you can never take that final step to get there.\n* **Everyday Example:** This law is less intuitive in daily life as it deals with extreme cold. But you can think of it like trying to create a perfect vacuum by pumping all the air out of a container. With each pump, you remove a fraction of the remaining air, so you get closer and closer to a perfect vacuum but never fully achieve it because there will always be *some* molecules left. Reaching absolute zero is a similar process of diminishing returns.\n\n| Law | Simple Statement | Key Concept |\n| :--- | :--- | :--- |\n| **Zeroth** | Defines temperature. | Thermal Equilibrium |\n| **First** | Energy is conserved. | Conservation of Energy |\n| **Second**| Disorder (entropy) increases. | Entropy & The Arrow of Time |\n| **Third** | Absolute zero is unreachable. | Absolute Zero & Minimum Entropy |"
}
],
"role": "model"
},
"finishReason": "STOP"
}
],
"createTime": "2026-04-28T19:34:08.655096Z",
"gatewayMetadata": {
"keySource": "BYOK"
},
"modelVersion": "gemini-2.5-pro",
"responseId": "sAvxafj9J8aA9LsP4fWlkAs",
"usageMetadata": {
"candidatesTokenCount": 1127,
"candidatesTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 1127
}
],
"promptTokenCount": 8,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 8
}
],
"thoughtsTokenCount": 1631,
"totalTokenCount": 2766,
"trafficType": "ON_DEMAND"
}
}
Examples
<details>
<summary>With System Instruction — Using a system instruction to set context</summary>
const response = await env.AI.run(
'google/gemini-2.5-pro',
{
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)
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-2.5-pro",
"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."
}
]
}
}
}'
```
Of course! Reading a JSON file in Python is a common task, and the built-injson` module makes it very straightforward.
Here is the most common and recommended way to do it.
The Short & Sweet Answer
Use the json.load() function along with a with open() context manager.
```python import json
