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

# Gemini API Gateway: Models, Pricing & Code

> Integrate seven Gemini models through APIXO's Google-compatible Generate Content API gateway using generateContent requests, not the newer Interactions API.

Use one Gemini Generate Content-compatible integration for all seven Gemini models available through APIXO. Configure the APIXO base URL and API key once, then switch models by changing the model ID in the request URL or SDK call.

<Info>
  Google now recommends the newer Interactions API for new direct Gemini integrations and labels Generate Content as legacy. APIXO's currently published Gemini gateway still uses the `generateContent` request format documented here. Do not send Interactions API payloads to this endpoint unless APIXO explicitly adds support.
</Info>

<Info>
  This page includes the complete APIXO Gemini model and pricing snapshot verified on August 3, 2026. Model availability and pricing can change, so check the [APIXO Gemini model page](https://apixo.ai/models/llm/gemini) before making billing-sensitive decisions.
</Info>

<Tip>
  **Choose your integration path:** [Use the Quickstart](#quickstart) to integrate manually, or [let an AI implement it](#let-an-ai-implement-it) by copying this page or using APIXO MCP.
</Tip>

## Compare Gemini models and pricing

Choose the model that fits the workload, then use its exact model ID in any example on this page.

| Model | Model ID | Recommended for | Input | Output | Cache write | Cache read | Savings |
| - | - | - | -: | -: | -: | -: | -: |
| Gemini 3.5 Flash | `gemini-3.5-flash` | Latest Flash model for general-purpose, multimodal, and higher-throughput workloads | \$0.9 | \$5.4 | \$0.09 | \$0.09 | 40% |
| Gemini 3.1 Pro Preview | `gemini-3.1-pro-preview` | Complex reasoning and multimodal work that benefits from the Pro tier | \$1.2 | \$7.2 | — | \$0.12 | 40% |
| Gemini 3.1 Flash-Lite Preview | `gemini-3.1-flash-lite-preview` | Low-cost preview workloads and lightweight high-volume tasks | \$0.15 | \$0.9 | — | \$0.015 | 40% |
| Gemini 3 Flash Preview | `gemini-3-flash-preview` | Existing Gemini 3 Flash Preview integrations | \$0.3 | \$1.8 | — | \$0.03 | 40% |
| Gemini 2.5 Pro | `gemini-2.5-pro` | Established Gemini 2.5 Pro reasoning and multimodal integrations | \$0.75 | \$6 | — | \$0.075 | 40% |
| Gemini 2.5 Flash | `gemini-2.5-flash` | Established balanced Gemini 2.5 workloads | \$0.18 | \$1.5 | — | \$0.018 | 40% |
| Gemini 2.5 Flash-Lite | `gemini-2.5-flash-lite` | Lowest-cost Gemini option in this table for routine, high-volume tasks | \$0.06 | \$0.24 | — | \$0.006 | 40% |

Prices are in USD per 1 million tokens. `—` means APIXO does not publish a separate cache-write price for that model. Prices verified: 2026-08-03. See the [APIXO Gemini model page](https://apixo.ai/models/llm/gemini) for the current rate card.

<Tip>
  Start with Gemini 3.5 Flash for the latest general-purpose Flash option, Gemini 3.1 Pro Preview for more complex work, or Gemini 3.1 Flash-Lite Preview when preview access at a lower cost matters. Keep a Gemini 2.5 ID when your application intentionally targets that family.
</Tip>

## What to change

| Setting | APIXO value |
| - | - |
| SDK Base URL | `https://llm.apixo.ai` |
| Raw HTTP path | `POST /v1beta/models/{model}:generateContent` |
| Request URL | `https://llm.apixo.ai/v1beta/models/{model}:generateContent` |
| API key | `APIXO_API_KEY` from [APIXO API Keys](https://apixo.ai/dashboard/api-keys) |
| API key header | `x-goog-api-key` |
| API key value | `$APIXO_API_KEY` |
| Model location | URL path `{model}` for REST; SDK `model` argument |

## Quickstart

```bash theme={null}
export APIXO_API_KEY="your_apixo_api_key"
```

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://llm.apixo.ai/v1beta/models/gemini-3.5-flash:generateContent" \
      -H "x-goog-api-key: $APIXO_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [
          {
            "role": "user",
            "parts": [{"text": "Say hello in one sentence."}]
          }
        ]
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    import { GoogleGenAI } from "@google/genai";

    const ai = new GoogleGenAI({
      apiKey: process.env.APIXO_API_KEY,
      httpOptions: { baseUrl: "https://llm.apixo.ai" }
    });

    const response = await ai.models.generateContent({
      model: "gemini-3.5-flash",
      contents: "Say hello in one sentence."
    });

    console.log(response.text);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os
    from google import genai
    from google.genai import types

    client = genai.Client(
        api_key=os.environ["APIXO_API_KEY"],
        http_options=types.HttpOptions(base_url="https://llm.apixo.ai"),
    )

    response = client.models.generate_content(
        model="gemini-3.5-flash",
        contents="Say hello in one sentence.",
    )

    print(response.text)
    ```
  </Tab>
</Tabs>

<Tip>
  The examples use `gemini-3.5-flash`. For REST, replace the model ID in the URL path. For the SDKs, change the `model` argument.
</Tip>

## Let an AI implement it

### Copy this page to an AI

Use the **Copy page** button in the page menu, paste the copied documentation into your AI coding tool, and add this prompt:

```text theme={null}
Integrate the APIXO Gemini-compatible Generate Content API into my existing
project using the documentation below.

Requirements:
- Use model gemini-3.5-flash unless my project already specifies another supported model.
- Read APIXO_API_KEY from an environment variable and keep it server-side.
- Preserve my current language, framework, and project structure.
- Add the smallest working integration and one minimal verification request.
- Do not invent endpoints, model IDs, or request fields that are not documented.
```

Replace `gemini-3.5-flash` in the prompt with any model ID from the comparison table.

### Use APIXO MCP

[APIXO MCP](/docs/integrations/mcp) reads APIXO's published machine-readable model catalog and schemas. The `gemini` schema includes the gateway endpoint, authentication header, supported model IDs, model guidance, and the pricing snapshot shown above.

After [installing APIXO MCP](/docs/integrations/mcp/installation), ask your AI:

```text theme={null}
Use the APIXO MCP tools to find the gemini model schema. Compare the supported
Gemini models and prices, choose the best model for my stated workload, then
integrate the APIXO Gemini-compatible Generate Content API into this project.
Keep the API key server-side and add a minimal verification request.
```

APIXO MCP helps your AI write the integration; it does not replace the API connection used by your application.

## Streaming

```bash theme={null}
curl --no-buffer -X POST "https://llm.apixo.ai/v1beta/models/gemini-3.5-flash:streamGenerateContent?alt=sse" \
  -H "x-goog-api-key: $APIXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [{"text": "Stream a short hello message."}]
      }
    ]
  }'
```

The `alt=sse` query parameter requests Server-Sent Events so each response chunk can be processed as it arrives.

## Supported Gemini models

Use one of these exact IDs in the REST URL path or SDK `model` argument.

* `gemini-3.5-flash`
* `gemini-3.1-pro-preview`
* `gemini-3.1-flash-lite-preview`
* `gemini-3-flash-preview`
* `gemini-2.5-pro`
* `gemini-2.5-flash`
* `gemini-2.5-flash-lite`

To switch models, keep the same endpoint family, API key, and request format, then change only the model ID.

## Troubleshooting

* `401`: missing or invalid API key
* `400`: invalid Gemini request body, endpoint, or unsupported model ID
* `429`: rate limit or temporary capacity limit
* `502` / `504`: upstream provider error or timeout

Retry `429`, `502`, and `504` with backoff. Fix `400` and `401` before retrying.

## Related links

* [Chat API Overview](/docs/llm)
* [Supported Models](/docs/llm/supported-models)
* [LLM Authentication](/docs/llm/authentication)
* [LLM Streaming](/docs/llm/streaming)
* [LLM Errors and Retry](/docs/llm/errors-retry)
* [Install APIXO MCP](/docs/integrations/mcp/installation)
* [Gemini API reference](https://ai.google.dev/api)
* [Explore Gemini models on APIXO](https://apixo.ai/models/llm/gemini)
* [Pricing](https://apixo.ai/pricing)

## Open a model on APIXO

These links open the selected model on APIXO's Gemini gateway page, where you can review its current pricing and copy model-specific code examples.

* [Gemini 3.5 Flash](https://apixo.ai/models/llm/gemini?model=gemini-3.5-flash)
* [Gemini 3.1 Pro Preview](https://apixo.ai/models/llm/gemini?model=gemini-3.1-pro-preview)
* [Gemini 3.1 Flash-Lite Preview](https://apixo.ai/models/llm/gemini?model=gemini-3.1-flash-lite-preview)
* [Gemini 3 Flash Preview](https://apixo.ai/models/llm/gemini?model=gemini-3-flash-preview)
* [Gemini 2.5 Pro](https://apixo.ai/models/llm/gemini?model=gemini-2.5-pro)
* [Gemini 2.5 Flash](https://apixo.ai/models/llm/gemini?model=gemini-2.5-flash)
* [Gemini 2.5 Flash-Lite](https://apixo.ai/models/llm/gemini?model=gemini-2.5-flash-lite)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.