Gemini 3.8 Flash API Pricing: How to Budget for Tokens and Caching

Gemini 3.8 Flash token and cache prices, a worked budget example, free-tier limits, and current Google and Ofox API access. Includes the scheduled 2027 rates.

Single-line ink drawing of a price tag with a second tag half hidden behind it on a pale paper card over a dusty pink background, a small grid of black and olive geometric glyphs beside it, and the serif title Gemini 3.8 Flash API beneath

Google’s Gemini 3.8 Flash Standard rate is $0.75 per million input tokens and $3.75 per million output tokens, including thinking, through December 31, 2026. The scheduled rates from January 1, 2027 are $1.50 and $7.50. For a useful budget, count the tokens your application actually consumes, then add any caching and tool charges.

Checked September 14, 2026. Prices below describe the direct Gemini API, not a guaranteed quote for Vertex AI or an Ofox provider route. Google’s pricing page is the source for the rate tables.

Gemini 3.8 Flash token and cache prices

All token rates are USD per million tokens. Output includes billed thinking tokens.

ServiceInput through 2026Output through 2026Cached input through 2026Input / output / cached input from Jan 2027
Standard$0.75$3.75$0.075$1.50 / $7.50 / $0.15
Batch or Flex$0.375$1.875$0.0375$0.75 / $3.75 / $0.075
Priority$1.35$6.75$0.135$2.70 / $13.50 / $0.27

Cache storage is separate: $0.50 per million tokens per hour through 2026, scheduled to become $1.00 in January. A lower cache-read price does not make a rarely reused cache economical; include its lifetime and reuse count.

A worked API budget

Suppose an application makes 1,000 requests, each using 2,000 uncached input tokens and 500 billed output tokens, including thinking. These are example assumptions, not measurements of Gemini’s typical response length.

At Standard rates through December 2026:

  • Input: (2 million / 1 million) × $0.75 = $1.50.
  • Output: (0.5 million / 1 million) × $3.75 = $1.875.
  • Model-token total: $3.375, before tools, storage and retries.

With the same usage, the scheduled January rates make that total $6.75. If 500 describes only the visible answer, this estimate is incomplete: billed thinking must also be counted.

For cached requests, charge cached tokens at the cache-read rate and subtract them from the uncached input count. Do not charge the same input token at both rates. Add storage, tool usage and failed or repeated attempts where they are billable.

Which usage fields matter?

Keep the full response usage record. In native generateContent, inspect usageMetadata.promptTokenCount, cachedContentTokenCount, candidatesTokenCount and thoughtsTokenCount. Candidate output and thinking are separate fields; candidate output alone understates the output used for billing. See Google’s UsageMetadata reference.

For an OpenAI-compatible response, check the provider’s meaning of completion_tokens and any reasoning detail. If reasoning is already included in the total, adding it again overcounts. Reconcile the estimate with the selected provider’s billing record, especially for tools and multimodal inputs.

Free tier, search grounding and rate limits

Google lists free-tier model input and output, subject to account eligibility and project limits. Search grounding is not available in Gemini 3.8 Flash’s free-tier pricing column. The paid column lists 5,000 shared requests per month across Gemini 3.x, followed by $14 per 1,000 search queries. A user prompt can trigger multiple searches; do not assume one prompt equals one billable query.

Read your project’s active limits in AI Studio. Google’s rate-limit documentation explains the project-based quotas and usage tiers. Adding another key in the same project does not create a new quota pool.

For a 429 response, inspect the error details and the project’s quota and billing status before retrying. A short burst and an exhausted quota need different responses; repeated immediate retries can increase the load. See Google’s API error reference.

Get a key and call Gemini 3.8 Flash

For direct access, create a key in Google AI Studio. New AI Studio keys now default to auth keys. If you have an older Standard key, follow the migration instructions in Google’s API key guide, which announces Standard-key rejection in September 2026 without specifying a day. That migration advice concerns older keys; it does not mean every newly created key needs conversion.

Keep keys in server-side environment variables. This native REST example assumes GEMINI_API_KEY is set:

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Return only the sum of 17 and 25."}]}],
    "generationConfig": {"thinkingConfig": {"thinkingLevel": "medium"}}
  }'

The expected answer for this small example is 42. It illustrates request structure, not model quality. Supported thinking levels are low, medium and high; minimal is unsupported. REST uses thinkingLevel inside generationConfig.thinkingConfig; an SDK can use different field names. See the Gemini 3.8 model documentation for supported levels and the generateContent reference for the REST request format.

Current Ofox access

Gemini 3.8 Flash is listed on Ofox as google/gemini-3.8-flash. Its model page lists both OpenAI and Gemini protocols, with a Vertex provider route. The OpenAI-compatible base URL is https://api.ofox.run/v1; the native Gemini base is https://api.ofox.run/gemini.

Install the OpenAI Python package with pip install openai and set OFOX_API_KEY in your server environment before running this example:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.ofox.run/v1",
    api_key=os.environ["OFOX_API_KEY"],
)
response = client.chat.completions.create(
    model="google/gemini-3.8-flash",
    messages=[{"role": "user", "content": "Return only the sum of 17 and 25."}],
)
print(response.choices[0].message.content)
if response.usage is not None:
    print(response.usage.model_dump())

Use the selected route’s current quote and supported parameters. Google’s direct free tier, service tiers and grounding allowance do not automatically carry over to a gateway. Listing and protocol support were checked for this update; these examples were not verified with a paid inference request.

Does upgrading from 3.7 change the bill?

The two models have matching direct Standard token rates, but may consume different amounts of output and thinking. Compare accepted results, tokens and retries on your workload. The 3.8 vs 3.7 migration comparison separates the launch benchmark snapshot from practical upgrade checks.

For a current cross-vendor shortlist, use DeepSeek V4.1 Flash vs Gemini 3.8 Flash vs Qwen3.8 Flash. Readers arriving from an older V4 comparison should first check the DeepSeek V4 version and alias changes.

Frequently Asked Questions

How much does Gemini 3.8 Flash cost?
Google Gemini API Standard pricing is $0.75 per million input tokens and $3.75 per million output tokens, including thinking, through December 31, 2026. Scheduled January 2027 rates are $1.50 and $7.50. Gateway and Vertex billing must be checked separately.
Is Gemini 3.8 Flash free?
Google lists a Gemini API free tier for model input and output, subject to eligibility and project limits. Google Search grounding is not available on that free tier. The paid grounding allowance does not apply to every free request or third-party route.
Which tokens should my budget include?
Include uncached input, cached input, visible output and billed thinking tokens, plus applicable cache storage and tool charges. Native generateContent reports candidatesTokenCount and thoughtsTokenCount separately; do not add reasoning twice if a compatibility API already includes it in completion_tokens.
What model ID does Ofox use?
Ofox currently lists google/gemini-3.8-flash with OpenAI and Gemini protocols. The OpenAI-compatible base URL is https://api.ofox.run/v1. Check the selected provider route for its applicable rate and supported options.
How do I create an API key?
Create a key in Google AI Studio for direct Gemini API access. New AI Studio keys default to auth keys. Existing Standard keys need the migration described in Google’s key guide. Use an Ofox key for an Ofox route and keep either key on your server.
Which thinking levels work?
Gemini 3.8 Flash supports low, medium and high, with medium the default. It does not support minimal. The configuration syntax depends on the protocol and SDK.