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

# Google Gemini models

> Gemini 3 preview and the 2.5 series, plus thinking, multimodal and embeddings

OpenPAI supports both the **OpenAI-compatible protocol** and the **Gemini-native protocol** (`/v1beta/models/{model}:generateContent`), covering Google's latest Gemini 3 preview and the stable 2.5 series.

## Gemini 3 series (current mainline)

The next-generation flagship, suited to agents, complex reasoning, realtime voice and more — currently Google's primary series.

| Model ID                        | Type             | Positioning                                                                             |
| ------------------------------- | ---------------- | --------------------------------------------------------------------------------------- |
| `gemini-3.1-pro-preview`        | Chat / Agent     | Most intelligent — top-tier reasoning and agent capability for complex multi-step tasks |
| `gemini-3.5-flash`              | Chat             | Frontier-class performance rivaling larger models                                       |
| `gemini-3-flash`                | Chat             | Frontier capability + lower cost                                                        |
| `gemini-3.1-flash-lite`         | Chat             | High performance + ultra-low cost, for high-volume lightweight tasks                    |
| `gemini-3.1-flash-live-preview` | Realtime audio   | Voice-first apps, bidirectional low-latency streaming (Live API)                        |
| `gemini-3.1-flash-tts-preview`  | Speech synthesis | Low-latency, natural TTS                                                                |

<Note>Preview models may change their interface and pricing at any time; for production, also configure a stable fallback model. The available IDs shown in [Console → Models](https://openp.ai/dashboard/models) are authoritative.</Note>

## Gemini 2.5 series (stable)

| Model ID                                | Context | Positioning                          |
| --------------------------------------- | ------- | ------------------------------------ |
| `gemini-2.5-pro`                        | 1M      | Strongest general reasoning and code |
| `gemini-2.5-flash`                      | 1M      | Best value for reasoning tasks       |
| `gemini-2.5-flash-lite`                 | 1M      | Fastest, cheapest multimodal option  |
| `gemini-2.5-flash-native-audio-preview` | 1M      | Sub-second native audio streaming    |

## Thinking and reasoning effort

The Gemini 2.5 / 3 series supports an **explicit thinking budget**. Both ways work:

### Via parameter

```python theme={null}
resp = client.models.generate_content(
    model="gemini-2.5-pro",
    contents="Prove Goldbach's conjecture",
    config=types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(thinking_budget=8000),
    ),
)
```

### Via model ID suffix

OpenPAI passes through the following model ID aliases, mapping them internally to the corresponding thinking config:

| Model ID                         | Behavior                               |
| -------------------------------- | -------------------------------------- |
| `gemini-2.5-pro-thinking`        | Default medium thinking budget         |
| `gemini-2.5-pro-thinking-128`    | Force a 128-token thinking budget      |
| `gemini-2.5-flash-thinking`      | Flash + thinking on                    |
| `gemini-2.5-flash-nothinking`    | Flash + thinking off (cheaper)         |
| `gemini-2.5-pro-low/medium/high` | Progressively higher reasoning effort  |
| `gemini-3.1-pro-preview-high`    | Gemini 3 Pro, maximum reasoning budget |

## Multimodal generation

| Model ID                 | Use case                                                                  |
| ------------------------ | ------------------------------------------------------------------------- |
| `nano-banana-pro`        | Top-tier visual creation / 4K professional design                         |
| `nano-banana-2`          | Efficient image generation / editing                                      |
| `gemini-2.5-flash-image` | Native image generation / editing                                         |
| `imagen-4`               | Ultra-fast text-to-image (2K)                                             |
| `veo-3.1`                | Video generation (with native audio); availability subject to the console |

Example:

```bash theme={null}
curl "https://openp.ai/v1beta/models/gemini-2.5-flash-image:generateContent" \
  -H "x-goog-api-key: $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"role":"user","parts":[{"text":"A red panda surfing, cartoon style"}]}],
    "generationConfig": {"responseModalities": ["IMAGE"]}
  }'
```

## Embedding models

| Model ID               | Dimensions       | Positioning                                                      |
| ---------------------- | ---------------- | ---------------------------------------------------------------- |
| `gemini-embedding-2`   | 3072 (reducible) | Latest multimodal embedding, first choice for semantic retrieval |
| `gemini-embedding-001` | 3072 (reducible) | Text embedding, RAG / classification                             |
| `text-embedding-004`   | 768              | Older, for compatibility                                         |

## Examples

### OpenAI-compatible protocol

```python theme={null}
from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://openp.ai/v1")

resp = client.chat.completions.create(
    model="gemini-3.1-pro-preview",
    messages=[{"role": "user", "content": "Explain the Fourier transform"}],
)
print(resp.choices[0].message.content)
```

### Gemini native protocol

```bash theme={null}
curl "https://openp.ai/v1beta/models/gemini-3.1-pro-preview:generateContent" \
  -H "x-goog-api-key: $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"role":"user","parts":[{"text":"hello"}]}],
    "generationConfig": { "temperature": 0.7, "maxOutputTokens": 2048 }
  }'
```

### google-genai SDK

```python theme={null}
from google import genai

client = genai.Client(
    api_key="sk-XXXXXXXXXXXXXXXX",
    http_options={"base_url": "https://openp.ai"},
)

resp = client.models.generate_content(
    model="gemini-3.1-pro-preview",
    contents="Give me 3 travel vlog titles",
)
print(resp.text)
```

## Vision and multimodal input

Gemini natively supports image, PDF, audio and video input:

```json theme={null}
{
  "contents": [{
    "role": "user",
    "parts": [
      {"text": "Summarize this image"},
      {"inline_data": {"mime_type": "image/png", "data": "<base64>"}}
    ]
  }]
}
```

## Function calling

Full support for Gemini `function_declarations` and `function_call`; when accessed via the OpenAI-compatible endpoint, these are automatically converted to `tools` / `tool_calls` structures. See [Function calling](/en/advanced/function-calling).

## API docs

* [generateContent](/en/api-reference/gemini/generate-content)
* [streamGenerateContent](/en/api-reference/gemini/stream-generate-content)
* [embedContent](/en/api-reference/gemini/embed-content)
