# New ways to balance cost and reliability in the Gemini API

> Google’s Gemini API offers Flex and Priority inference tiers for balancing cost and reliability across different workloads.

Source: https://ailoot.ai/blog/en/gemini-api-flex-priority-inference/
Canonical: https://ailoot.ai/blog/en/gemini-api-flex-priority-inference/
Language: en
Publisher: Ailoot (https://ailoot.ai/)
Translation: guide-100077
Revision: sha256-8fe5a859a7b0c512d69a605c4a05d0e4f862767cd909ca8dbafa6de83019c772


Google introduced two service tiers for the Gemini API: Flex and Priority. They let developers choose a tier based on a workload’s cost, latency, and reliability needs.

## Flex Inference

Flex is a cost-optimized tier for workloads that can tolerate latency and reduced reliability. Google says it costs 50% less than the Standard API. It uses synchronous requests, so developers can use familiar endpoints without managing input and output files or polling for job completion.

Potential uses include background CRM updates, research simulations, and agent workflows that browse or think in the background. Set the `service_tier` parameter to `flex` to use it:

```
# Using the Flex tier for background summarization
response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents="Summarize this massive transcript...",
    config={"service_tier": "flex"},
)

# Check which tier actually served your request
print(response.sdk_http_response.headers.get("x-gemini-service-tier"))
```

Flex is available for paid tiers with GenerateContent and Interactions API requests.

## Priority Inference

Priority is a premium tier intended for critical traffic. Google says it provides the highest level of assurance, including higher reliability during peak usage. When traffic exceeds Priority limits, overflow requests are served at the Standard tier instead of failing. The response indicates which tier handled the request, providing visibility into performance and billing.

Potential uses include real-time customer support, live content moderation, and other time-sensitive requests. Set `service_tier` to `priority`:

```
# Using the Priority tier for a critical alert
response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents="Triage this incoming security alert immediately.",
    config={"service_tier": "priority"},
)
```

Priority is available to users with Tier 2 or Tier 3 paid projects across the \`GenerateContent\` API and Interactions API.

See the [Gemini API documentation](https://ai.google.dev/gemini-api/docs/pricing) for pricing details. The source also points to the cookbook for runnable code examples.

## Put this guide to work with Ailoot

Connect AI models to your applications, agents and automations through one Ailoot API. Choose the model that fits your task and follow the [Ailoot documentation](https://ailoot.ai/docs/) to get started.


## Ailoot · The company and its project portfolio

Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.

The company and its project portfolio: millions of customers; monthly sales in the billions.

Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
