> ## 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 2.0 Flash

> Google's Gemini 2.0 Flash for AI image editing via Gemini API.

Gemini 2.0 Flash is Google's multimodal model with image editing capabilities, available through Anyfast via the native Gemini API. It can edit existing images based on text instructions.

## Key capabilities

* **Image editing** — Modify existing images with natural language instructions
* **Multi-modal input** — Accept both text instructions and source images
* **Text generation** — Also supports standard text generation tasks
* **Versatile** — Fast and efficient for various multimodal tasks

## Quick example

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://www.anyfast.ai/v1beta/models/gemini-2.0-flash:generateContent?key=YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "contents": [
        {
          "role": "user",
          "parts": [
            { "text": "Change the background to a beach scene" },
            { "inline_data": { "mime_type": "image/png", "data": "BASE64_DATA" } }
          ]
        }
      ],
      "generationConfig": {
        "responseModalities": ["IMAGE"]
      }
    }'
  ```

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

  url = "https://www.anyfast.ai/v1beta/models/gemini-2.0-flash:generateContent"
  params = {"key": "YOUR_API_KEY"}

  with open("input.png", "rb") as f:
      image_b64 = base64.b64encode(f.read()).decode()

  data = {
      "contents": [
          {
              "role": "user",
              "parts": [
                  {"text": "Change the background to a beach scene"},
                  {"inline_data": {"mime_type": "image/png", "data": image_b64}}
              ]
          }
      ],
      "generationConfig": {
          "responseModalities": ["IMAGE"]
      }
  }

  response = requests.post(url, params=params, json=data)
  result = response.json()
  output = result["candidates"][0]["content"]["parts"][0]["inline_data"]["data"]
  with open("output.png", "wb") as f:
      f.write(base64.b64decode(output))
  ```
</CodeGroup>

## Parameters

| Parameter                             | Type   | Required | Description                                           |
| ------------------------------------- | ------ | -------- | ----------------------------------------------------- |
| `key`                                 | string | Yes      | API key (query parameter)                             |
| `contents`                            | array  | Yes      | Array of `{ role, parts }` with text and inline\_data |
| `generationConfig.responseModalities` | array  | Yes      | Must include `IMAGE`                                  |

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

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