{ "model_id": "google/gemini-3.1-pro", "provider_id": "google", "name": "Gemini 3.1 Pro", "description": "Google's most intelligent Gemini model with improved reasoning, a medium thinking level, and a 1M token context window.", "task": "Text Generation", "tags": [ "LLM", "Reasoning", "Multimodal", "Thinking" ], "context_length": 1000000, "max_output_tokens": 65536, "schema_version": "1.0.0", "pricing": { "Input <=200k (per 1M)": 2, "Cached input <=200k (per 1M)": 0.2, "Output <=200k (per 1M)": 12, "Input >200k (per 1M)": 4, "Cached input >200k (per 1M)": 0.4, "Output >200k (per 1M)": 18 }, "examples": [ { "name": "Simple Question", "description": "Basic generateContent request", "input": { "contents": [ { "parts": [ { "text": "What are the three laws of thermodynamics?" } ], "role": "user" } ] }, "output": { "text": "The laws of thermodynamics describe how energy moves and changes form within physical systems. While the prompt asks for the \"three\" laws, there are actually four (scientists realized later that they needed a foundational law, which they named the \"Zeroth\" law). \n\nHere are the three main laws of thermodynamics, explained simply:\n\n### **1. The First Law: The Law of Conservation of Energy**\n* **The Concept:** Energy cannot be created or destroyed; it can only change forms or be transferred from one object to another.\n* **What it means:** The total amount of energy in the universe is constant. For example, a car engine doesn't \"create\" energy to move the car; it converts the chemical energy stored in gasoline into mechanical energy (motion) and thermal energy (heat). \n* **The famous summary:** *\"You can't get something for nothing.\"* (You cannot create energy out of thin air).\n\n### **2. The Second Law: The Law of Entropy**\n* **The Concept:** In any isolated system, the total **entropy** (disorder or randomness) will always increase over time. \n* **What it means:** Energy naturally disperses. This is why a hot cup of coffee will always cool down in a room, but a cold cup of coffee will never spontaneously absorb heat from the room to boil. Furthermore, because energy disperses, no energy transfer is 100% efficient. Whenever you convert energy from one form to another, some of it is always \"lost\" as unusable waste heat. \n* **The famous summary:** *\"You can't even break even.\"* (Because of entropy, you will always lose some usable energy in any process).\n\n### **3. The Third Law: Absolute Zero**\n* **The Concept:** As the temperature of a system approaches **absolute zero** (0 Kelvin, or -273.15\u00b0C), the entropy of the system approaches a constant, minimum value. \n* **What it means:** Absolute zero is the theoretical point where all thermal energy is gone and the atoms stop moving entirely. The third law dictates that while we can get extremely close to absolute zero, it is physically impossible to actually reach it. \n* **The famous summary:** *\"You can't get out of the game.\"* (You can never reach absolute zero, so there will always be *some* heat and entropy).\n\n***\n\n### **Bonus: The \"Zeroth\" Law**\nFormulated after the first three laws were already established, scientists realized they needed a law to define temperature itself. Since it was the most fundamental, they called it the \"Zeroth\" Law.\n* **The Concept:** If System A is in thermal equilibrium (the same temperature) with System B, and System B is in thermal equilibrium with System C, then System A and System C must also be the same temperature.\n* **What it means:** This seems obvious, but it is the foundational rule that allows thermometers to work!" }, "raw_response": { "candidates": [ { "content": { "role": "model", "parts": [ { "text": "The laws of thermodynamics describe how energy moves and changes form within physical systems. While the prompt asks for the \"three\" laws, there are actually four (scientists realized later that they needed a foundational law, which they named the \"Zeroth\" law). \n\nHere are the three main laws of thermodynamics, explained simply:\n\n### **1. The First Law: The Law of Conservation of Energy**\n* **The Concept:** Energy cannot be created or destroyed; it can only change forms or be transferred from one object to another.\n* **What it means:** The total amount of energy in the universe is constant. For example, a car engine doesn't \"create\" energy to move the car; it converts the chemical energy stored in gasoline into mechanical energy (motion) and thermal energy (heat). \n* **The famous summary:** *\"You can't get something for nothing.\"* (You cannot create energy out of thin air).\n\n### **2. The Second Law: The Law of Entropy**\n* **The Concept:** In any isolated system, the total **entropy** (disorder or randomness) will always increase over time. \n* **What it means:** Energy naturally disperses. This is why a hot cup of coffee will always cool down in a room, but a cold cup of coffee will never spontaneously absorb heat from the room to boil. Furthermore, because energy disperses, no energy transfer is 100% efficient. Whenever you convert energy from one form to another, some of it is always \"lost\" as unusable waste heat. \n* **The famous summary:** *\"You can't even break even.\"* (Because of entropy, you will always lose some usable energy in any process).\n\n### **3. The Third Law: Absolute Zero**\n* **The Concept:** As the temperature of a system approaches **absolute zero** (0 Kelvin, or -273.15\u00b0C), the entropy of the system approaches a constant, minimum value. \n* **What it means:** Absolute zero is the theoretical point where all thermal energy is gone and the atoms stop moving entirely. The third law dictates that while we can get extremely close to absolute zero, it is physically impossible to actually reach it. \n* **The famous summary:** *\"You can't get out of the game.\"* (You can never reach absolute zero, so there will always be *some* heat and entropy).\n\n***\n\n### **Bonus: The \"Zeroth\" Law**\nFormulated after the first three laws were already established, scientists realized they needed a law to define temperature itself. Since it was the most fundamental, they called it the \"Zeroth\" Law.\n* **The Concept:** If System A is in thermal equilibrium (the same temperature) with System B, and System B is in thermal equilibrium with System C, then System A and System C must also be the same temperature.\n* **What it means:** This seems obvious, but it is the foundational rule that allows thermometers to work!", "thoughtSignature": "AY89a197GECnMwUlM7wtji6/asWPmDOw31IcboL2qXHjETlhZBJfD5iMStj+z9+vySalZtJ1NQYfQF8JpOU7SnXTCMwSHOnVB4Ldz/M2rubkfi11yR+XetAYveyWbs12yboQ4Q2IuojZuBWhHcv5oW3XWzaw/d4xiCdrnmDaqN2BY3xHEaaXQuhVvGqsMJZcQoHGBmoOMupngIq1CGjIrpqVcDXKQ5d2ib99wWnr6zbkcuO9MlSnZQ5N9/9h5lXX62se9hIAiN9dXB5XAjbTfpudRIHsZick+tsJ19B3QF6opQQzTtVxwmuJviFAQMe3QA4CIfqQUhBkCdqs/dYMQ9TeYCUnpFOVDEh6a9qeXhmnPt1YspA3Uur942oQ6EB1uvFAoOMTjKFn/JvsP0+4Ip0/MuULcgfIGPLYo5pgtVa3eS4B9yBaaIq/RAUK2g8lgvjSZI7h7bshhHbIjL5IVExxGegnhy1dqOf/X1tWaRVydvAEQCNrF1wqDfxcUut0xPNVBtFOFMvDUOjiWbrxecTjLDfHe6XiLBQpzaSsAxIqiQFs1qobbqPwaghCHzkdFM5A8CMlG68d1R4P6uxgo7rQzwik1D4Yy4iwCDS9IX5gXQWRCD5qgHGRdftnW9B15l/Cg9Ssgk14+lSUX1VuSNRm34s+wDV5mYwd6NwBe9Q3r13BOXynglWFjKkWKcTaYXeWuyrtdkzZB+Dh4aCTAN3dndni3YKiMCsVVyJr8VN2iaWZ3cC58mqH/PGJ4D2C1ZBuvW3VQvU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f8q+Z5KFobTQWe+ZRd7PvmugPt3j7atAPU+MxgkH1su2jwShATGIvmLqwIwTMHa2v3Uuen0qo+9nD/JzKnzUY3SqIofbkqHsRi5SFvHu/swt3OxBkYmM2v2ajT1TI8kcaseI5EWOMpcvsHDSK23sV6dLEJWG54/hi87aEWABhW1DhRXupusCUwA3Tdgq4W12E3r1l4wP/WoKDzBjRu4juaYEtpq4mWdkTQchivrr+6sOqdi4QTiATX4+mdaQGzVcjMs+54zRC62OkYEokJ0SPSOtUPYJZWwUn2JzyeGBspGhKiywJr6aGI35yneGMDS6FvjMCtG+4V2H23oQovfRO1P1DGasDsbBORnw6vSCqibHIkvBdqTBbIK3ANYRvfgP+vuaFqaVwmNsd9LfEEuHNoxFqq9TtLDxbLmvzOVGdRGQ2XbgPbZwUsEsKVd+g3gbj8GcfXunnlvCKhIdGeHTsiYBX+ZX9nHQeGnZcfGTsyIscqZ2bPs7lT+cjm2GttZJZdSzAN+t6qCgyPmSOngDeY30ptMt47KRhg9mZutg8mFRkJH4hJPBXtqxW71+kF5CcPBBEfl9yi1fcnOcwjkAlT7NBg4eM+bbBTFgtJYio7QulEgQTbgHkJ/xVtMPJ5UtbjDnMot8f/VxmaemUJqr1m8o4gxtllh+RMy8cimG0Me53F+htJxqBRZh3RwEZxAfDcfxXLYxt7R42UNC++UammCA+HEjMr56jDXz9EP5kiuPucms3aG7OOD1MSg261udCCfa29pkQvulvwqCCkjBGlx02lwpPkxq49JX3mw7UjpODb3YA==" } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 8, "candidatesTokenCount": 626, "totalTokenCount": 1489, "trafficType": "ON_DEMAND", "promptTokensDetails": [ { "modality": "TEXT", "tokenCount": 8 } ], "candidatesTokensDetails": [ { "modality": "TEXT", "tokenCount": 626 } ], "thoughtsTokenCount": 855 }, "modelVersion": "gemini-3.1-pro-preview", "createTime": "2026-07-24T21:52:50.808795Z", "responseId": "st5jatuuMfy7u-gP9bXk0QI", "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/gemini-3.1-pro',\n { contents: [{ parts: [{ text: 'What are the three laws of thermodynamics?' }], role: 'user' }] },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/gemini-3.1-pro\",\n \"input\": {\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": \"What are the three laws of thermodynamics?\"\n }\n ],\n \"role\": \"user\"\n }\n ]\n }\n}'" } ] }, { "name": "With System Instruction", "description": "Using a system instruction to set context", "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": { "text": "To read a JSON file in Python, you can use the built-in **`json`** module. \n\nHere is the most standard and recommended way to do it:\n\n```python\nimport json\n\n# Open the file in read mode\nwith open('data.json', 'r', encoding='utf-8') as file:\n # Load the JSON data into a Python dictionary\n data = json.load(file)\n\n# Now you can use 'data' like a normal Python dictionary\nprint(data)\n```\n\n### Breakdown of the code:\n1. **`import json`**: Imports Python's built-in JSON library.\n2. **`with open(...) as file:`**: This is the best practice for opening files. The `with` statement ensures that the file is automatically closed as soon as the block of code finishes, even if an error occurs.\n3. **`encoding='utf-8'`**: It is highly recommended to specify the encoding, especially if your JSON file contains special characters or emojis.\n4. **`json.load(file)`**: This function reads the file and converts the JSON data into the corresponding Python object (usually a dictionary or a list).\n\n---\n\n### Best Practice: Adding Error Handling\nIf there is a chance the file might not exist or the JSON is formatted incorrectly, it's a good idea to use a `try-except` block:\n\n```python\nimport json\n\ntry:\n with open('data.json', 'r', encoding='utf-8') as file:\n data = json.load(file)\n print(\"File loaded successfully!\")\n \nexcept FileNotFoundError:\n print(\"Error: The file was not found.\")\nexcept json.JSONDecodeError:\n print(\"Error: The file does not contain valid JSON.\")\n```\n\n### Bonus Tip: `json.load()` vs `json.loads()`\n* Use **`json.load()`** (no 's') when reading directly from a **file**.\n* Use **`json.loads()`** (with an 's' for string) if you already have JSON data saved as a Python **string** variable." }, "raw_response": { "candidates": [ { "content": { "role": "model", "parts": [ { "text": "To read a JSON file in Python, you can use the built-in **`json`** module. \n\nHere is the most standard and recommended way to do it:\n\n```python\nimport json\n\n# Open the file in read mode\nwith open('data.json', 'r', encoding='utf-8') as file:\n # Load the JSON data into a Python dictionary\n data = json.load(file)\n\n# Now you can use 'data' like a normal Python dictionary\nprint(data)\n```\n\n### Breakdown of the code:\n1. **`import json`**: Imports Python's built-in JSON library.\n2. **`with open(...) as file:`**: This is the best practice for opening files. The `with` statement ensures that the file is automatically closed as soon as the block of code finishes, even if an error occurs.\n3. **`encoding='utf-8'`**: It is highly recommended to specify the encoding, especially if your JSON file contains special characters or emojis.\n4. **`json.load(file)`**: This function reads the file and converts the JSON data into the corresponding Python object (usually a dictionary or a list).\n\n---\n\n### Best Practice: Adding Error Handling\nIf there is a chance the file might not exist or the JSON is formatted incorrectly, it's a good idea to use a `try-except` block:\n\n```python\nimport json\n\ntry:\n with open('data.json', 'r', encoding='utf-8') as file:\n data = json.load(file)\n print(\"File loaded successfully!\")\n \nexcept FileNotFoundError:\n print(\"Error: The file was not found.\")\nexcept json.JSONDecodeError:\n print(\"Error: The file does not contain valid JSON.\")\n```\n\n### Bonus Tip: `json.load()` vs `json.loads()`\n* Use **`json.load()`** (no 's') when reading directly from a **file**.\n* Use **`json.loads()`** (with an 's' for string) if you already have JSON data saved as a Python **string** variable.", "thoughtSignature": "AY89a1/WVQVfP8X81xtbe/Y3eP4vwcFwMmemlaAcD6N/8fTRHsROrZr1DG00bINwygCw86NfVtlJCMVVj2WSJgOjnpj5HOLNxpzdsZXEQnAMyZ5R46j2XVXo5k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xC65Zn65csmJXoJkIX4dBIkGT7YfT0akJiyVHmfQysN9n9brUh/smhD5sACutFxFb6y7I5QWzU7lIiWrlesf7a9PCD8ZTHxD8gcq+5u3uMGLPIFR1E5YK37QkINzj2Vc637n8Tvs5xa9VDx2xK6tsUKTZMeLGkKbOd1YDwEXkIuFi/npTHUD5cOn7l8CvSK1a4lweFJHPsZsXyue+2ZxUvVZgzRJatE36erCr4XbubFua9FTGDtQVU95n3XW3pJFAkdJ1n6idLa+qD3X7Y/qLlvBO7vD4cPbM27VIExUGcK6HzNTMGoiJAI2ZB5WP0fNfgPMCRhzzsC0Avt1Q9T7i1d4IEcAMcz58G1/9kqlmFoosIbYfGh4BqNLjis49fF68l3AwFye4Yb4mm8KxNLU2+K2wQQPOppfUznKQ/tgwQ4UsjF3wISDVt/Pw3Up2Jc1M14cf1ZphUtI6embyp8y4WxVBJXMBzYx8g5gqijnguUNwZhGH/Ns7CVerczqjw08wyZIKrWSj4H6h4jqxSs05xE3mptoh7Sp3k5cEOMjrUNTJytVbALPyc7jjCX6/mew/Caft0FSiAEXMlir8BhGJQIb9orNpDh0qRIAkJRhnNdSXzfi6ivsfboJltMW5WA71oGuqCASFAZhgO9SOMm8upPOlz0cv8M2n3aVlXi5PLm7QoE7F5zHNUzV9X8/IPu0dIYEQDEapShmrTfIj3XezwHSVZMSmJiCbDmOG04n2cT63xpl42IZdVpWE6Q6aBsxbCsy5nTTNlMEMx8QvZQpXlchdCd3jbcH63e6BfHrKs3tMjhpE7987x2jywpZj1ALWI/l8OZNYxsMdqcpxtaTyfSjsWcplSwI4fUs=" } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 20, "candidatesTokenCount": 461, "totalTokenCount": 1079, "trafficType": "ON_DEMAND", "promptTokensDetails": [ { "modality": "TEXT", "tokenCount": 20 } ], "candidatesTokensDetails": [ { "modality": "TEXT", "tokenCount": 461 } ], "thoughtsTokenCount": 598 }, "modelVersion": "gemini-3.1-pro-preview", "createTime": "2026-07-24T21:53:04.959579Z", "responseId": "wN5jatvIOs27u-gP-sKs4Ao", "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/gemini-3.1-pro',\n {\n contents: [{ parts: [{ text: 'How do I read a JSON file in Python?' }], role: 'user' }],\n generationConfig: { temperature: 0.3 },\n systemInstruction: {\n parts: [{ text: 'You are a helpful coding assistant specializing in Python.' }],\n },\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/gemini-3.1-pro\",\n \"input\": {\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": \"How do I read a JSON file in Python?\"\n }\n ],\n \"role\": \"user\"\n }\n ],\n \"generationConfig\": {\n \"temperature\": 0.3\n },\n \"systemInstruction\": {\n \"parts\": [\n {\n \"text\": \"You are a helpful coding assistant specializing in Python.\"\n }\n ]\n }\n }\n}'" } ] }, { "name": "Multi-turn Conversation", "description": "Continuing a conversation with context", "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": { "text": "The stops you make will depend heavily on which route you decide to take. \n\nIf you want to do the drive in **5-6 hours**, you'll take **Interstate 5 (I-5)**, which is the fast, inland route. If you have a full day (or even better, two days), you can take the **Pacific Coast Highway (Highway 1 / US-101)**, which is one of the most famous and scenic drives in the world.\n\nHere are the best stops for both options, listed in order from North to South:\n\n### \ud83c\udf0a The Scenic Coastal Route (Highway 1 / US-101)\n*This route takes 9+ hours of pure driving, so it\u2019s best if you have a whole day or plan to stay somewhere overnight.*\n\n* **Santa Cruz:** A classic California surf town. You can stretch your legs at the famous Santa Cruz Beach Boardwalk or grab a coffee downtown.\n* **Monterey & Carmel-by-the-Sea:** Monterey is home to the world-renowned Monterey Bay Aquarium and Cannery Row. Right next door is Carmel, a charming, fairytale-like village with boutique shops and a beautiful white-sand beach.\n* **Big Sur:** This is the most dramatic, cliff-hugging part of the drive. Must-sees include the iconic **Bixby Creek Bridge** and **McWay Falls** (an 80-foot waterfall that drops right onto the beach). *Note: Always check Caltrans before your trip, as Highway 1 frequently experiences closures due to landslides.*\n* **San Simeon:** Stop here to see **Hearst Castle** (a magnificent historic mansion on a hill\u2014book tickets in advance!) and the Piedras Blancas Elephant Seal Rookery, where you can see hundreds of massive elephant seals lounging on the beach.\n* **San Luis Obispo (SLO):** A great halfway point. It has a fantastic, walkable downtown area. If you like quirky stops, check out Bubblegum Alley or grab a slice of cake at the wildly eccentric, pink-themed **Madonna Inn**.\n* **Santa Barbara:** Known as the \"American Riviera.\" It features stunning Spanish colonial architecture, great wine tasting, beautiful beaches, and a vibrant downtown street (State Street). \n\n### \ud83d\ude97 The Fast Inland Route (I-5)\n*This route is mostly flat agricultural land. The stops here are less about sightseeing and more about unique places to grab food and stretch your legs.*\n\n* **Casa de Fruta (Pacheco Pass):** If you take Highway 152 to connect to I-5, this massive roadside fruit stand/theme park is a legendary California pit stop. Great for snacks, dried fruit, and a quick break.\n* **Harris Ranch (Coalinga):** A massive, famous steakhouse and inn sitting right on I-5. It's a very popular spot to stop for a nice sit-down lunch or dinner.\n* **Kettleman City / Bravo Farms:** Kettleman City is the classic halfway point. It has a massive In-N-Out Burger, but the real star is **Bravo Farms**\u2014a quirky, western-themed roadside attraction with a cheese factory, ice cream, a petting zoo, and lots of souvenirs. \n* **Tejon Ranch (The Grapevine):** Right before you climb the mountains to drop down into Los Angeles, there are the Outlets at Tejon if you want to do a little shopping or need a final coffee/food break.\n\n**How much time do you have for this trip?** Are you trying to get down to LA in a single day, or are you open to spending a night somewhere along the coast?" }, "raw_response": { "candidates": [ { "content": { "role": "model", "parts": [ { "text": "The stops you make will depend heavily on which route you decide to take. \n\nIf you want to do the drive in **5-6 hours**, you'll take **Interstate 5 (I-5)**, which is the fast, inland route. If you have a full day (or even better, two days), you can take the **Pacific Coast Highway (Highway 1 / US-101)**, which is one of the most famous and scenic drives in the world.\n\nHere are the best stops for both options, listed in order from North to South:\n\n### \ud83c\udf0a The Scenic Coastal Route (Highway 1 / US-101)\n*This route takes 9+ hours of pure driving, so it\u2019s best if you have a whole day or plan to stay somewhere overnight.*\n\n* **Santa Cruz:** A classic California surf town. You can stretch your legs at the famous Santa Cruz Beach Boardwalk or grab a coffee downtown.\n* **Monterey & Carmel-by-the-Sea:** Monterey is home to the world-renowned Monterey Bay Aquarium and Cannery Row. Right next door is Carmel, a charming, fairytale-like village with boutique shops and a beautiful white-sand beach.\n* **Big Sur:** This is the most dramatic, cliff-hugging part of the drive. Must-sees include the iconic **Bixby Creek Bridge** and **McWay Falls** (an 80-foot waterfall that drops right onto the beach). *Note: Always check Caltrans before your trip, as Highway 1 frequently experiences closures due to landslides.*\n* **San Simeon:** Stop here to see **Hearst Castle** (a magnificent historic mansion on a hill\u2014book tickets in advance!) and the Piedras Blancas Elephant Seal Rookery, where you can see hundreds of massive elephant seals lounging on the beach.\n* **San Luis Obispo (SLO):** A great halfway point. It has a fantastic, walkable downtown area. If you like quirky stops, check out Bubblegum Alley or grab a slice of cake at the wildly eccentric, pink-themed **Madonna Inn**.\n* **Santa Barbara:** Known as the \"American Riviera.\" It features stunning Spanish colonial architecture, great wine tasting, beautiful beaches, and a vibrant downtown street (State Street). \n\n### \ud83d\ude97 The Fast Inland Route (I-5)\n*This route is mostly flat agricultural land. The stops here are less about sightseeing and more about unique places to grab food and stretch your legs.*\n\n* **Casa de Fruta (Pacheco Pass):** If you take Highway 152 to connect to I-5, this massive roadside fruit stand/theme park is a legendary California pit stop. Great for snacks, dried fruit, and a quick break.\n* **Harris Ranch (Coalinga):** A massive, famous steakhouse and inn sitting right on I-5. It's a very popular spot to stop for a nice sit-down lunch or dinner.\n* **Kettleman City / Bravo Farms:** Kettleman City is the classic halfway point. It has a massive In-N-Out Burger, but the real star is **Bravo Farms**\u2014a quirky, western-themed roadside attraction with a cheese factory, ice cream, a petting zoo, and lots of souvenirs. \n* **Tejon Ranch (The Grapevine):** Right before you climb the mountains to drop down into Los Angeles, there are the Outlets at Tejon if you want to do a little shopping or need a final coffee/food break.\n\n**How much time do you have for this trip?** Are you trying to get down to LA in a single day, or are you open to spending a night somewhere along the coast?", "thoughtSignature": "AY89a1/VDTias+le3Jn45CwRR51o60DI2g5LpXxUzKaW/8Rt94VWKZXixIBISizF6Qy2OBHUcBw02EfJeTs/fLMjh3YQUZyVvNEjo15kJki4BxvcFfmRrLJsLAipjR7QFA/hVSSJBOSLI7jsPQvzFpdF/3SFBk6RKtooUR7QEftb26SctN/3gXtmFzrgEB3HvXC7VTldKzNLaGlUT5fdb0Pj2Mi4uxX2soEg/EnKEVXdMO+LQD5i6XqoBLoaqKjf16M0N8kiJ8uRl2wb2JXxOCCEyagO+ktumAJhC2aWMgel93DWX62e0mj3sYW94ecQ0tzhQO+ghevWLdXi9CPKPOnJ5GefPgiqlZ4elG1IXRrvNMaDkY0xba5QTm/vNLBDJWIhGh5KLdD5OPfZfkVNzI+IIWPXC+QJB2lXy3zEEebOlpMlmPiKk0km4EYN4IbgRU60ZJiYsJzS0mHlb1uqOhspd8AZo63NItrfVnweHp1yEyk0emle8zSvzylFzcTtSAalGNrt314rNgFi86ISjxbBmySKaL2aRckXXElaDdaniPdzb0xvvJ5EbHVk5IgZyllLsm0zLqL8pOMrC6SOEex4zSFvKuxXhVRfcE8lSSzooz+5VTRuk+3l1qU5GB0+LP+htSh2b+q3s5V1aJKpvDpAAF8PMWWwUllvuLjgC/cnB9lS/F/Z3PIV5jRngQyNYPNa5uXItzHppCD2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FTnmLJHf/zAoZq0reRi4gq5dqK3KIbleEzedlBYtmPCoQu2D9NmawBgany/k5lKQPHq6TZnmpcMLLp2vD0Ngl2regsiHH3Rci4UkNKVILWU9wuLo3c+5spoh33AWaeBbqFWsO0SJmKM3fdHDvLwuxxdSZxGaRjKHWYNV1SgCayJOg4Oe0/6sc8848I=" } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 64, "candidatesTokenCount": 786, "totalTokenCount": 1932, "trafficType": "ON_DEMAND", "promptTokensDetails": [ { "modality": "TEXT", "tokenCount": 64 } ], "candidatesTokensDetails": [ { "modality": "TEXT", "tokenCount": 786 } ], "thoughtsTokenCount": 1082 }, "modelVersion": "gemini-3.1-pro-preview", "createTime": "2026-07-24T21:53:15.548070Z", "responseId": "y95jaua5IeyY3dAPyJOYoQU", "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/gemini-3.1-pro',\n {\n contents: [\n {\n parts: [{ text: 'I need help planning a road trip from San Francisco to Los Angeles.' }],\n role: 'user',\n },\n {\n parts: [\n {\n 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?\",\n },\n ],\n role: 'model',\n },\n { parts: [{ text: 'Yes, what are some good places to stop?' }], role: 'user' },\n ],\n generationConfig: { maxOutputTokens: 2048 },\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/gemini-3.1-pro\",\n \"input\": {\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": \"I need help planning a road trip from San Francisco to Los Angeles.\"\n }\n ],\n \"role\": \"user\"\n },\n {\n \"parts\": [\n {\n \"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?\"\n }\n ],\n \"role\": \"model\"\n },\n {\n \"parts\": [\n {\n \"text\": \"Yes, what are some good places to stop?\"\n }\n ],\n \"role\": \"user\"\n }\n ],\n \"generationConfig\": {\n \"maxOutputTokens\": 2048\n }\n }\n}'" } ] }, { "name": "Creative Writing", "description": "Higher temperature for creative output", "input": { "contents": [ { "parts": [ { "text": "Write a short story opening about a detective finding an unusual clue." } ], "role": "user" } ], "generationConfig": { "maxOutputTokens": 4096, "temperature": 0.8 } }, "output": { "text": "Detective Elias Vance didn\u2019t mind blood; it was the absolute absence of it that set his teeth on edge. \n\nThe penthouse apartment of billionaire tech mogul Marcus Sterling was a monument to sterile minimalism\u2014white marble, white leather, glass. Even Sterling himself, currently lying supine in the center of the sunken living room, looked less like a corpse and more like a carefully placed art installation. No visible wounds. No signs of struggle. Just a dead man in a two-thousand-dollar silk robe, staring blankly at the vaulted ceiling. \n\nThe forensics team was buzzing around the perimeter, dusting glass and bagging the obvious: the half-empty crystal tumbler, the silk slippers, the victim's unlocked phone. Vance ignored them. He operated on the principle that killers who left clean scenes always overcompensated. They focused so hard on the macro that they forgot the micro. \n\nHe dropped to his knees, ignoring the sharp protest in his lower back, and brought his face inches from the pristine, white rug. He began his crawl, moving in tight, methodical spirals outward from the body. \n\nTen minutes in, he found it. \n\nIt was tucked just beneath the shadow of a floating glass coffee table, nearly invisible against the thick pile of the rug. Vance pulled a pair of bamboo tweezers and a small evidence bag from his trench coat pocket. With practiced care, he pinched the object and lifted it into the harsh glare of the tactical lights.\n\nIt was a walnut shell. \n\nVance frowned. A discarded nutshell in an apartment that smelled entirely of ozone and expensive bleach was odd, but not Earth-shattering. Then, he noticed the seam. The shell had been sliced perfectly in half and hinged with a piece of brass wire so thin it looked like a golden hair. \n\nUsing the tip of his pen, Vance nudged the top half of the shell open. \n\nHe stopped breathing. He fumbled in his pocket for his jeweler's loupe, jammed it into his right eye, and leaned in close. \n\nInside the hollowed-out walnut was a diorama. It was carved from what looked like ivory and painted with a single-hair brush. It was a perfect, impossibly detailed replica of the penthouse living room. There was the glass table. There was the white leather sofa. \n\nAnd there, in the center of the tiny, carved floor, was a minuscule figure wearing a silk robe, lying dead on its back. \n\nBut that wasn't what made the hair on Vance\u2019s arms stand up. Standing over the tiny, dead figure in the walnut shell was another carving. It was a man in a trench coat, on his hands and knees, holding a magnifying glass to his eye. \n\nVance slowly lowered the shell, the silence of the sterile room suddenly feeling very heavy, and looked up at the empty ceiling. They weren't just hunting a killer. They were dealing with an audience." }, "raw_response": { "candidates": [ { "content": { "role": "model", "parts": [ { "text": "Detective Elias Vance didn\u2019t mind blood; it was the absolute absence of it that set his teeth on edge. \n\nThe penthouse apartment of billionaire tech mogul Marcus Sterling was a monument to sterile minimalism\u2014white marble, white leather, glass. Even Sterling himself, currently lying supine in the center of the sunken living room, looked less like a corpse and more like a carefully placed art installation. No visible wounds. No signs of struggle. Just a dead man in a two-thousand-dollar silk robe, staring blankly at the vaulted ceiling. \n\nThe forensics team was buzzing around the perimeter, dusting glass and bagging the obvious: the half-empty crystal tumbler, the silk slippers, the victim's unlocked phone. Vance ignored them. He operated on the principle that killers who left clean scenes always overcompensated. They focused so hard on the macro that they forgot the micro. \n\nHe dropped to his knees, ignoring the sharp protest in his lower back, and brought his face inches from the pristine, white rug. He began his crawl, moving in tight, methodical spirals outward from the body. \n\nTen minutes in, he found it. \n\nIt was tucked just beneath the shadow of a floating glass coffee table, nearly invisible against the thick pile of the rug. Vance pulled a pair of bamboo tweezers and a small evidence bag from his trench coat pocket. With practiced care, he pinched the object and lifted it into the harsh glare of the tactical lights.\n\nIt was a walnut shell. \n\nVance frowned. A discarded nutshell in an apartment that smelled entirely of ozone and expensive bleach was odd, but not Earth-shattering. Then, he noticed the seam. The shell had been sliced perfectly in half and hinged with a piece of brass wire so thin it looked like a golden hair. \n\nUsing the tip of his pen, Vance nudged the top half of the shell open. \n\nHe stopped breathing. He fumbled in his pocket for his jeweler's loupe, jammed it into his right eye, and leaned in close. \n\nInside the hollowed-out walnut was a diorama. It was carved from what looked like ivory and painted with a single-hair brush. It was a perfect, impossibly detailed replica of the penthouse living room. There was the glass table. There was the white leather sofa. \n\nAnd there, in the center of the tiny, carved floor, was a minuscule figure wearing a silk robe, lying dead on its back. \n\nBut that wasn't what made the hair on Vance\u2019s arms stand up. Standing over the tiny, dead figure in the walnut shell was another carving. It was a man in a trench coat, on his hands and knees, holding a magnifying glass to his eye. \n\nVance slowly lowered the shell, the silence of the sterile room suddenly feeling very heavy, and looked up at the empty ceiling. They weren't just hunting a killer. They were dealing with an audience.", "thoughtSignature": "AY89a1/nJwqLvTZRX5LPVcjnU/V3AI3ulS85hu8rnCwOMBRa08DV5rtf9Xh2XRVLyqXcvDcBhl00FbpS6tOl92tDxHZ/T+EtwFWnPlPpaC4xdzGdGOjlallnYKcY/rSxCwhsjuGtowqkX8Y5yZMgTpVi7wgwZ5BWiFtcn+mopaKRYqXDbi/CwXq7w06h/R+2ate5pRK43UhoT8FBINF3sGeAwpSrObNR+6xO/7J9E2F7RkXQ+mcVR0zfnMZVBeM/ICH4Mtuj+tEo+iDLc4g/6J2T+Z8baZuF9+hOXOTc+Zvgf/a3pWqNL77BdWpF09VnfiQEs/7gTTXfWa3dtxjldjV4bH142KZ0ihKOH33Q2M3QRkhFdDcQfRIZrklEO+vFr7lzEmN6QxfbezNX8m1BKkLJXZO0TXDUo6UA1z7z6vtFSfLxNIplo55or8Umyj1fK82dUACzltCga5FFDshJqTAofKqAg1eno9EBHihC0ZWCbdvfFXTzOyGMqep0wH5z5TlvRK5ezZWONT9Is/gNbVOdwNr4EJAM7brrCrVbn0akEah1wwRog0zPouUtxTkEbyyoGOthOtHZE2As5WRIuNpoY9qiFaYKVJXRiDImgpFn32L81R40jOKxD0W90rHIG8pKBAyAXKPUsusPKXrcq8PKFeAyUxDdrPw6BoMFODpUfSyhfN5Gtz2thhzUC1TiQa9Ic6oEW2VuhY7dPidY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YnODPR3UUq7MSz0bF7SEGB+gUV++yrTquWfDfiBTiEUw8omCBBfyBAwnOl7pGlXfXAFYh1zACkN1fHvzdr3Ke1t35GW1uSF6UWOSd8e3qy7vN+FyXaqoVXegIiE1PCK9RsEt7+OX+GRtf9trOhjway7MWhSjUAWH2hlSX8z9iFilMF1zu2p5wKe7/ZRlHDXmFpr8aBuspclfbkdFGpu9eBzEsRg/QTXXJ0hmqaGCvtFFjumVs2mmErdlpBLfBe5yptlI/0b8BO3J7rFrLRIlJ3+6vRmh4Egqd3t0LOJ0kfAJ1q/iSIliEZutZesFFrbDZtOnZ6pW8xXlRK9rJ7uXTFT+qa0chR/Rv28NttoaLq9p53bj29W3qYSqhT/fit2A+VyqJySpV/HmEs5ejUuRmqmiTxoJK2HtYlOMgRz3AnBjz5ganOK18juZooviYlsUhBKr8PnP9NjkIOhug4obNo0w26FBd+bOFJSaaTNCrWTnqrwJ+nD8xoIw7gQBUZxFxP8LH5oAlDOU3jaOWAyVlvXj6yudwKjqksFcCA7uncJcEW6QWxkWNzfyQAajbgKAPi5yP1Y3aQkxXJYgbJ8CM8rWPcxU5vc+yV3i/poB/ZEUOHvCb3CUSPtP8eacfNrI/YB5Km9eiGkQcDBikjQM/6Ui1oLp0q7FJNbHTfbJPu2osyW8Z2qLJ/jp+MXu8cVPLJACOSagBE1Gazc+pq2UFzvqtX+MDiYyaBYjZHeW7Q7dgAarrOH7xaIssJVQYTGbB4ZJAWSJWZx7eu9umusv/1jhN+GC5zxNCVhJ04Lhpj+ZpIcA1Ap0hPMuYlicrVFny8zmwRkhCAUaPeex7tcsRHNehaLwbUIm9qGdLtRp7DNGXXH+PzUsqbZkmmYYZQ==" } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 13, "candidatesTokenCount": 609, "totalTokenCount": 1962, "trafficType": "ON_DEMAND", "promptTokensDetails": [ { "modality": "TEXT", "tokenCount": 13 } ], "candidatesTokensDetails": [ { "modality": "TEXT", "tokenCount": 609 } ], "thoughtsTokenCount": 1340 }, "modelVersion": "gemini-3.1-pro-preview", "createTime": "2026-07-24T21:53:33.033254Z", "responseId": "3d5jauaDAtGp3dAPh_-o0Ag", "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/gemini-3.1-pro',\n {\n contents: [\n {\n parts: [{ text: 'Write a short story opening about a detective finding an unusual clue.' }],\n role: 'user',\n },\n ],\n generationConfig: { maxOutputTokens: 4096, temperature: 0.8 },\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/gemini-3.1-pro\",\n \"input\": {\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": \"Write a short story opening about a detective finding an unusual clue.\"\n }\n ],\n \"role\": \"user\"\n }\n ],\n \"generationConfig\": {\n \"maxOutputTokens\": 4096,\n \"temperature\": 0.8\n }\n }\n}'" } ] } ], "default_example": null, "code_snippets": [], "supports_async": false, "zdr": true, "zdr_comment": null, "external_info": "https://deepmind.google/technologies/gemini/", "terms": "https://ai.google.dev/gemini-api/terms", "cover_image_url": "https://pub-26f1392c1b674324be6786695bd72257.r2.dev/google/gemini-3.1-pro.png", "metadata": { "Architecture": "Transformer (multimodal)", "Thinking": "Yes (medium level)" }, "request_formats": [ "chat-completions" ], "providers": null, "provider_details": [ { "id": "google-vertex-ai", "pricing": { "under_200k_per_1m_input_tokens": 2, "under_200k_per_1m_input_cached_tokens": 0.2, "under_200k_per_1m_output_tokens": 12, "over_200k_per_1m_input_tokens": 4, "over_200k_per_1m_input_cached_tokens": 0.4, "over_200k_per_1m_output_tokens": 18 } } ], "banner": null, "created_at": "2026-05-22 17:53:11", "schema": { "input": { "$schema": "https://json-schema.org/draft/2020-12/schema", "oneOf": [ { "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": {}, "title": "Generate Content" }, { "type": "object", "properties": { "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "system", "developer", "user", "assistant", "tool" ] }, "content": { "anyOf": [ { "type": "string" }, { "type": "null" }, { "type": "array", "items": {} } ] } }, "required": [ "role" ], "additionalProperties": {} } }, "temperature": { "type": "number", "minimum": 0, "maximum": 2 }, "max_tokens": { "type": "number", "exclusiveMinimum": 0 }, "max_completion_tokens": { "type": "number", "exclusiveMinimum": 0 }, "top_p": { "type": "number", "minimum": 0, "maximum": 1 }, "frequency_penalty": { "type": "number", "minimum": -2, "maximum": 2 }, "presence_penalty": { "type": "number", "minimum": -2, "maximum": 2 }, "stream": { "type": "boolean" }, "stream_options": { "type": "object", "properties": { "include_usage": { "type": "boolean" } }, "additionalProperties": false }, "tools": { "type": "array", "items": {} }, "tool_choice": {}, "response_format": {}, "modalities": { "type": "array", "items": { "type": "string", "enum": [ "text", "audio" ] } }, "audio": { "type": "object", "properties": { "voice": { "type": "string", "enum": [ "alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse" ] }, "format": { "type": "string", "enum": [ "wav", "mp3", "flac", "opus", "pcm16" ] } }, "additionalProperties": false }, "reasoning_effort": { "description": "Optional reasoning control; availability and accepted values are model-dependent.", "type": [ "string", "null" ] } }, "required": [ "messages" ], "additionalProperties": {}, "title": "Chat Completions" } ] }, "output": { "$schema": "https://json-schema.org/draft/2020-12/schema", "oneOf": [ { "type": "object", "properties": { "candidates": { "type": "array", "items": {} }, "usageMetadata": { "type": "object", "properties": { "promptTokenCount": { "type": "number" }, "candidatesTokenCount": { "type": "number" }, "totalTokenCount": { "type": "number" } }, "additionalProperties": {} }, "modelVersion": { "type": "string" } }, "additionalProperties": {}, "title": "Generate Content" }, { "type": "object", "properties": { "id": { "type": "string" }, "object": { "type": "string" }, "created": { "type": "number" }, "model": { "type": "string" }, "choices": { "type": "array", "items": { "type": "object", "properties": { "index": { "type": "number" }, "message": { "type": "object", "properties": { "role": { "type": "string" }, "content": { "type": [ "string", "null" ] }, "tool_calls": { "anyOf": [ { "type": "array", "items": {} }, { "type": "null" } ] }, "audio": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "data": { "type": "string" }, "expires_at": { "type": "number" }, "transcript": { "type": "string" } }, "additionalProperties": {} }, { "type": "null" } ] } }, "required": [ "role" ], "additionalProperties": {} }, "finish_reason": { "type": [ "string", "null" ] } }, "required": [ "index", "message", "finish_reason" ], "additionalProperties": {} } }, "usage": { "type": "object", "properties": { "prompt_tokens": { "type": "number" }, "completion_tokens": { "type": "number" }, "total_tokens": { "type": "number" } }, "required": [ "prompt_tokens", "completion_tokens", "total_tokens" ], "additionalProperties": {} } }, "required": [ "id", "object", "created", "model", "choices" ], "additionalProperties": {}, "title": "Chat Completions" } ] } } }