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

# Gemini 3.8 Flash

> Use Google Gemini 3.8 Flash through the native Gemini API for long-horizon software engineering, autonomous agents, and complex multimodal workflows.

Gemini 3.8 Flash is Google's generally available Flash model for long-horizon software engineering, autonomous agents, and complex enterprise workflows. AnyFast exposes it through the native Gemini `generateContent` API with the stable model ID `gemini-3.8-flash`.

## Key capabilities

* **1M token context** - Up to 1,048,576 input tokens and 65,536 output tokens
* **Multimodal input** - Text, image, video, audio, and PDF input; text output
* **Long-horizon coding** - Designed for complex, multi-file engineering work and iterative verification
* **Autonomous agents** - Improved multi-step planning, deterministic tool execution, and recovery from failed loops
* **Tools** - Function calling, code execution, Google Search, Google Maps, URL context, and Computer Use (Preview)
* **Structured output** - Generate JSON that follows a supplied response schema
* **Thinking levels** - `low`, `medium`, and `high`; the default is `medium`
* **Caching and processing options** - Supports context caching, Batch API, Flex inference, and Priority inference upstream

## Model specifications

| Property               | Value                              |
| ---------------------- | ---------------------------------- |
| Model ID               | `gemini-3.8-flash`                 |
| Release stage          | Generally available (GA)           |
| Release date           | September 2, 2026                  |
| Inputs                 | Text, image, video, audio, and PDF |
| Output                 | Text                               |
| Input token limit      | 1,048,576                          |
| Output token limit     | 65,536                             |
| Default thinking level | `medium`                           |

## Quick example

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://www.anyfast.ai/v1beta/models/gemini-3.8-flash:generateContent?key=YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "contents": [
        {
          "role": "user",
          "parts": [{ "text": "Review this retry design, identify race conditions, and propose a safe implementation plan." }]
        }
      ],
      "generationConfig": {
        "thinkingConfig": {
          "thinkingLevel": "medium"
        },
        "maxOutputTokens": 2048
      }
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://www.anyfast.ai/v1beta/models/gemini-3.8-flash:generateContent",
      params={"key": "YOUR_API_KEY"},
      json={
          "contents": [{
              "role": "user",
              "parts": [{
                  "text": "Review this retry design, identify race conditions, and propose a safe implementation plan."
              }],
          }],
          "generationConfig": {
              "thinkingConfig": {"thinkingLevel": "medium"},
              "maxOutputTokens": 2048,
          },
      },
  )
  response.raise_for_status()
  print(response.json()["candidates"][0]["content"]["parts"][0]["text"])
  ```
</CodeGroup>

## Thinking levels

Choose a thinking level based on latency and task difficulty:

| Level    | Recommended use                                                                     |
| -------- | ----------------------------------------------------------------------------------- |
| `low`    | Latency-sensitive chat, drafting, incident response, and quick analysis             |
| `medium` | Default; coding and agentic tasks that need balanced latency and reasoning          |
| `high`   | Difficult coding, mathematics, tool orchestration, and complex multi-step reasoning |

<Warning>
  Gemini 3.8 Flash does not support `minimal`. Sending it returns an error. Use `low`, `medium`, or `high`.
</Warning>

<Note>
  Gemini 3.8 Flash may use more reasoning tokens on difficult, long-running tasks because it works in smaller steps, calls tools iteratively, and verifies intermediate results. Use `low` for workflows that do not need this level of verification.
</Note>

## Verified AnyFast behavior

The following behavior has been verified against the AnyFast international endpoint:

* `low`, `medium`, and `high` thinking levels are accepted; `minimal` returns HTTP 400.
* Text, image, video, audio, and PDF inputs are accepted in one multimodal request.
* Function calling, code execution, Google Search, Google Maps, URL context, Computer Use, structured output, stop sequences, system instructions, and safety settings are accepted.
* File Search is not currently exposed by this endpoint. Sending `tools[].fileSearch` returns HTTP 400.
* Requests ending with a model turn or an empty final user part return HTTP 400.

## Conversation and tool requirements

* Do not prefill the model response. The final conversation turn must be a non-empty `user` turn.
* Preserve every `thoughtSignature` returned by the model when sending conversation history back in a tool workflow.
* A `functionResponse` must include the function `name`. Its `id` and `response` are optional on the current AnyFast route; return the model-provided `id` and the tool result when they are available.
* Keep multimodal assets inside their corresponding content or function-response payload.

## Parameters

| Parameter                                       | Type    | Required | Description                                                                                                                       |
| ----------------------------------------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `key`                                           | string  | Yes      | API key in the query string                                                                                                       |
| `contents`                                      | array   | Yes      | Conversation turns containing text or multimodal parts                                                                            |
| `systemInstruction`                             | object  | No       | System instruction with a `parts` array                                                                                           |
| `generationConfig.thinkingConfig.thinkingLevel` | string  | No       | `low`, `medium` (default), or `high`                                                                                              |
| `generationConfig.maxOutputTokens`              | integer | No       | Maximum output tokens, up to 65,536                                                                                               |
| `generationConfig.responseMimeType`             | string  | No       | Output MIME type, such as `application/json`                                                                                      |
| `generationConfig.responseSchema`               | object  | No       | JSON Schema used with structured output                                                                                           |
| `generationConfig.stopSequences`                | array   | No       | Strings that stop generation when encountered                                                                                     |
| `tools`                                         | array   | No       | Function declarations or a supported built-in tool: `googleSearch`, `googleMaps`, `urlContext`, `codeExecution`, or `computerUse` |
| `toolConfig`                                    | object  | No       | Function-calling or retrieval configuration for a selected tool                                                                   |
| `safetySettings`                                | array   | No       | Per-category content safety thresholds                                                                                            |

<Card title="API Reference" icon="code" href="/api-reference/model-api/google/gemini-3.8-flash">
  View the interactive API reference for Gemini 3.8 Flash.
</Card>

## Official references

* [Gemini 3.8 Flash model page](https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash)
* [What's new in Gemini 3.8 Flash](https://ai.google.dev/gemini-api/docs/generate-content/latest-model)
* [Gemini thinking](https://ai.google.dev/gemini-api/docs/thinking)

<script src="/public/feedback.js" />
