Gemini 3.7 Flash’s Launch Price Ends December 31. Here’s How to Measure What Your Laravel AI Feature Really Costs

Logging token usage per request, estimating your bill at full price, and deciding now whether the feature still pays for itself.


Picture a ticket-summary feature that costs $380 in November. On January 1, with the same traffic, the same prompts and no new users, it costs $760. Nothing in the code changed, no deploy happened, and no alert fired, because nothing in the app ever recorded how many tokens it used. The first sign is the invoice, and by then the feature has been live for months on a price that was never going to last.

That’s the situation for anyone running a Laravel feature on Gemini 3.7 Flash. Google released the model on August 13, 2026 at an introductory price of $0.75 per million input tokens and $3.75 per million output tokens. Google’s pricing page says that rate runs through December 31, 2026, and from January 1, 2027 output moves to $7.50. Coverage of the release puts input at $1.50 from the same date, which is exactly double. The model itself isn’t going anywhere, but the price schedule is already published.

The useful question isn’t whether to be annoyed about that. It’s whether you know what your feature costs per request today, so you can see what it costs at the 2027 price, and decide before the invoice does it for you. This post covers where the token counts come from in the Laravel AI SDK, how to log them, how to price a request at both rates, and how to decide.

Sources and limits. The output prices and the December 31 date come from Google’s Gemini Developer API pricing page. Input and cached-input prices come from several third-party write-ups that agree with each other, so check the pricing page for the exact figures before you rely on them. The usage fields come from the Laravel AI SDK documentation and its v1.0 announcement. I haven’t run the code below, so treat it as a sketch to test against a real response.


What Actually Changes on January 1

TierInput per 1M tokensOutput per 1M tokens (thinking included)
Standard, through Dec 31, 2026$0.75$3.75
Standard, from Jan 1, 2027$1.50$7.50
Batch, through Dec 31, 2026$0.375$1.875
Batch, from Jan 1, 2027$0.75$3.75
Priority, through Dec 31, 2026$1.35$6.75
Priority, from Jan 1, 2027$2.70$13.50

The output column is what Google’s pricing page lists, including the batch and priority rows. The input column follows the stated doubling, and one third-party summary says the same 2x applies to batch, priority and context caching. One more detail from the same sources: cached input reads are listed at $0.075 per million at the introductory rate, so treat that as the figure to verify.

Two things in that table matter more than the headline doubling.

Thinking tokens are billed as output. Google’s own wording on the pricing page is “output price (including thinking tokens).” Gemini 3.7 Flash is a reasoning model, so a short visible answer can sit on top of a large hidden reasoning bill. Per LiteLLM’s day-zero notes for the model, the minimal thinking level wasn’t supported yet and the API returned a 400 if you asked for it. That was a snapshot, so check the current docs, but it means you can’t assume thinking can be switched off.

Batch at 2027 prices equals today’s standard intro price. The batch rate in 2027 is $0.75 input and $3.75 output, exactly what standard costs right now. If part of your feature doesn’t need an immediate answer, that’s the cheapest route back to today’s price.

Also worth knowing: according to one third-party summary of the pricing page, Gemini 3.6 Flash and 3.8 Flash follow the same introductory schedule, and Google released 3.8 Flash on September 2. So switching to a newer Flash model isn’t an obvious way around the change. Verify the schedule for whichever model you use. I found nothing describing a way to lock the introductory rate.


Why You Can’t Estimate This From the Invoice

A monthly invoice is a single number. It can’t tell you which feature caused it, which tenant, or which kind of token. Three things make estimating from it unreliable:

Reasoning inflates output invisibly. Your prompt can be 200 words and your visible reply 50, while thousands of reasoning tokens are billed at the output rate. You only see this if you log the reasoning count.

Cached tokens are billed at a different rate. A feature with a large, stable prefix can cost far less than its raw token count suggests, until a prompt change breaks the cache.

Agent loops resend history. A tool-calling agent that takes five steps sends the accumulated conversation on each one. One user action can mean several model calls, so cost per user action is not cost per request.

All three disappear once you record usage per call, tagged with the feature that made it.


What the Laravel AI SDK Gives You

Every response from the SDK carries a usage property with the token counts the provider reported:

$response->usage->inputTokens;
$response->usage->outputTokens;
$response->usage->totalTokens();

$response->usage->cacheReadInputTokens;  // a subset of inputTokens
$response->usage->reasoningTokens;       // a subset of outputTokens
$response->usage->uncachedInputTokens(); // input that neither read nor wrote cache

The detail that trips people up is the word “subset.” As of SDK v1.0, inputTokens and outputTokens are the provider’s full counts, and the cached, cache-written and reasoning counts are parts of those totals, not extra on top. That’s a rename too: promptTokens and completionTokens became inputTokens and outputTokens, so logging code written against the older names will break on upgrade.

The consequence for cost math is a double-counting trap:

// ❌ Reasoning tokens are already inside outputTokens
$output = $usage->outputTokens + $usage->reasoningTokens;

// ✅ Bill outputTokens once; reasoningTokens only explains the share
$output = $usage->outputTokens;

If you ever read Gemini’s raw usage metadata yourself instead of going through the SDK, check how thought tokens are reported. My recollection is that the raw API reports them in a separate field from the visible output count, which would mean adding them yourself. Verify it against a real response, because getting this wrong understates your bill.


Step 1: Log Usage Per Call

One table, one row per model call:

// database/migrations/xxxx_create_ai_usage_logs_table.php
Schema::create('ai_usage_logs', function (Blueprint $table) {
    $table->id();
    $table->string('feature');              // 'ticket-summary', 'reply-draft', ...
    $table->string('model');                // 'gemini-3.7-flash'
    $table->foreignId('user_id')->nullable();
    $table->unsignedInteger('input_tokens');
    $table->unsignedInteger('cache_read_tokens')->default(0);
    $table->unsignedInteger('output_tokens');
    $table->unsignedInteger('reasoning_tokens')->default(0);
    $table->unsignedInteger('latency_ms')->nullable();
    $table->timestamps();

    $table->index(['feature', 'created_at']);
});

And a small recorder you call right after each prompt:

use Laravel\Ai\Enums\Lab;

final class RecordAiUsage
{
    public static function from(object $response, string $feature, string $model, ?int $userId = null, ?int $latencyMs = null): void
    {
        $u = $response->usage;

        AiUsageLog::create([
            'feature' => $feature,
            'model' => $model,
            'user_id' => $userId,
            'input_tokens' => $u->inputTokens,
            'cache_read_tokens' => $u->cacheReadInputTokens ?? 0,
            'output_tokens' => $u->outputTokens,
            'reasoning_tokens' => $u->reasoningTokens ?? 0,
            'latency_ms' => $latencyMs,
        ]);
    }
}

// At the call site
$started = hrtime(true);

$response = (new SummarizeTicket)->prompt(
    $ticket->body,
    provider: Lab::Gemini,
    model: 'gemini-3.7-flash',
);

RecordAiUsage::from(
    $response,
    feature: 'ticket-summary',
    model: 'gemini-3.7-flash',
    userId: $ticket->user_id,
    latencyMs: (int) ((hrtime(true) - $started) / 1_000_000),
);

Put the feature label in the call, not inferred later. When you add a second AI feature in March, the question “which one is expensive?” should already have an answer.

Two things to check against your own setup. First, whether usage covers every step of a tool-calling agent or only the last call. Run one multi-step agent and compare the logged total against the provider’s dashboard before you trust the numbers. Second, if you log from a queued job, write the row inside the job, so a retry doesn’t silently skip or duplicate it.


Step 2: Price Every Row at Both Rates

Keep the rates in config with the schedule they belong to, so the same logged tokens can be priced either way:

// config/ai-pricing.php
return [
    'gemini-3.7-flash' => [
        // USD per 1M tokens; verify against Google's pricing page
        'intro'    => ['input' => 0.75, 'cached_input' => 0.075, 'output' => 3.75],
        'standard' => ['input' => 1.50, 'cached_input' => 0.15,  'output' => 7.50],
    ],
];
final class AiCost
{
    public static function usd(AiUsageLog $row, string $schedule): float
    {
        $rate = config("ai-pricing.{$row->model}.{$schedule}");

        $uncachedInput = $row->input_tokens - $row->cache_read_tokens;

        return (
            $uncachedInput * $rate['input']
            + $row->cache_read_tokens * $rate['cached_input']
            + $row->output_tokens * $rate['output']   // reasoning is already inside this
        ) / 1_000_000;
    }
}

This sketch ignores explicit cache storage fees and cache-write tokens. If you use explicit context caching, storage is billed per hour on top of token usage, so add it separately. The standard cached-input rate is my extrapolation from the stated doubling, which is another number to confirm.


Step 3: Report Cost per Feature, Now and in January

// app/Console/Commands/AiCostReport.php
public function handle(): void
{
    $rows = AiUsageLog::query()
        ->where('created_at', '>=', now()->subDays(30))
        ->get()
        ->groupBy('feature')
        ->map(function ($group) {
            $intro = $group->sum(fn ($r) => AiCost::usd($r, 'intro'));
            $standard = $group->sum(fn ($r) => AiCost::usd($r, 'standard'));
            $calls = $group->count();

            return [
                'calls' => $calls,
                'tokens_per_call' => (int) round(($group->sum('input_tokens') + $group->sum('output_tokens')) / max($calls, 1)),
                'reasoning_share' => round($group->sum('reasoning_tokens') / max($group->sum('output_tokens'), 1), 2),
                'cost_now' => round($intro, 2),
                'cost_jan' => round($standard, 2),
            ];
        });

    $this->table(
        ['Feature', 'Calls', 'Tokens/call', 'Reasoning share', 'Cost now', 'Cost at Jan price'],
        $rows->map(fn ($r, $feature) => [$feature, ...array_values($r)])->all(),
    );
}

The columns that matter most are the last two and the reasoning share. A feature where reasoning is 80% of output is a feature whose cost you can influence by changing thinking settings, far more than by shortening your prompt.

Also look at the distribution, not just the total. Check the 95th percentile of tokens per call and the top tenants by spend:

SELECT user_id,
       SUM(input_tokens + output_tokens) AS tokens
FROM ai_usage_logs
WHERE created_at >= now() - interval '30 days'
GROUP BY user_id
ORDER BY tokens DESC
LIMIT 10;

One tenant running an unusually long document through the feature can account for a disproportionate share of the bill, and an average hides that completely.


Step 4: Decide With Unit Economics, Not Totals

The total tells you what you’re spending. The decision depends on what each use of the feature is worth. Work through these four numbers for each feature:

  1. Cost per call at the January price, from the report above.
  2. Calls per successful outcome. If users regenerate, or an agent retries, one useful result costs more than one call.
  3. Value per successful outcome. Time saved, a ticket deflected, a conversion. Estimate it honestly, and use a conservative figure.
  4. Break-even: cost per outcome at the January price should sit well below value per outcome, with room for the cost to move again.

A worked example, using made-up numbers you should replace with your own. A summary feature averages 6,000 input tokens and 1,500 output tokens per call, with no cache hits:

At the intro price:    6000 × $0.75/1M + 1500 × $3.75/1M = $0.0045 + $0.005625 ≈ $0.0101 per call
At the 2027 price:     6000 × $1.50/1M + 1500 × $7.50/1M = $0.0090 + $0.01125  ≈ $0.0203 per call

20,000 calls a month:  ≈ $203 now, ≈ $405 from January

Whether that’s acceptable has nothing to do with Google and everything to do with what 20,000 summaries are worth. If each one saves a support agent two minutes, $405 a month is trivial. If the feature is a nice-to-have that nobody measures, it may not survive the review.

The outcome that should worry you isn’t “the feature gets more expensive.” It’s “I don’t know what the feature is worth.” Doubling a cost you can’t justify is the moment it gets cut.


Levers, in Order of Effort

Once you know the per-call cost, here’s what to change, cheapest first:

Move non-interactive work to Batch. Anything that doesn’t need an instant reply, such as nightly summaries, backfills and report generation, can use the Batch tier, which costs half of standard. At 2027 prices that’s the same rate you pay today.

Look at your thinking settings. If reasoning dominates your output, a lower thinking level can cut cost directly. Check which levels the model currently supports, since minimal wasn’t available when it launched.

Fix cache breaks. A stable prompt prefix gets the cached-input rate, and a small change at the front of a prompt can invalidate it. Put variable content at the end.

Cap output where it makes sense. The SDK has a MaxTokens attribute for agents. Check how it interacts with reasoning tokens on your model before relying on it as a cost control.

Cache identical requests in your own app. A hash of the normalized input, a TTL that fits how fast the answer goes stale, and duplicate submissions stop costing anything. This works regardless of provider pricing.

Route simple work to a cheaper model. Google lists cheaper Flash-Lite models. Only do this with an evaluation set you trust, since a cheaper model that fails more often can cost more in retries and cleanup than it saves.

Don’t rush a migration just for the date. Moving to a different model to dodge a scheduled increase is a change to your output quality and your prompts, with its own risk. Measure first, then decide whether the saving is worth it.


Add a Budget Guard

A report tells you after the fact. A guard stops a runaway before it becomes the invoice:

final class AiBudget
{
    public static function exceeded(string $feature): bool
    {
        $spentToday = AiUsageLog::where('feature', $feature)
            ->whereDate('created_at', today())
            ->get()
            ->sum(fn ($row) => AiCost::usd($row, 'standard'));

        return $spentToday > config("ai-budgets.{$feature}", PHP_FLOAT_MAX);
    }
}

Check it before calling the model, and decide what “exceeded” means for each feature. Degrading to a cached or shorter response is usually better than failing, and a Slack alert at 80% of the daily budget tells you something changed before it becomes expensive.


The Checklist

  1. Add the ai_usage_logs table and the recorder, and tag every call with a feature name.
  2. Update any older logging that reads promptTokens or completionTokens, since the v1.0 names are inputTokens and outputTokens.
  3. Confirm on one multi-step agent that logged usage matches the provider’s dashboard.
  4. Put the rates in config with the intro and standard schedules, and verify them against the pricing page.
  5. Run the cost report and note cost now, cost at the January price, and reasoning share per feature.
  6. Compute cost per successful outcome and compare it with what an outcome is worth.
  7. Move anything non-interactive to Batch, and try your thinking and caching levers.
  8. Add a budget guard and an alert, then re-run the report on January 2.

The Decision

Do you log tokens per call, tagged by feature?
 ├─ No  → Do that first. Every other step depends on it.
 └─ Yes → What does the feature cost per successful outcome at the January price?
           ├─ Far below its value → Keep it. Add the budget guard and move on.
           ├─ Close to its value
           │     ├─ Is work non-interactive?   → Batch tier
           │     ├─ Is reasoning most of output? → Review thinking settings
           │     └─ Is the prefix stable?       → Check for cache breaks
           └─ Above its value or unknown → Decide to cut, shrink or measure value
                                           before January 1, not after the invoice.

The Verdict

A price change you can read about in advance is the easiest kind to handle, and most teams still won’t, because their feature can’t answer the one question that matters: what does one use of it cost? The date on the pricing page is the least important fact here. What matters is that thinking tokens bill as output, that the SDK reports them as a subset of output so you must not add them twice, and that a log line per call turns an invoice you can’t explain into a report you can act on. Do the measurement now. If the feature clearly pays for itself at the January price, nothing else is needed. If it only works at half the price, you’ve learned that while you can still do something about it.

Leave a Reply

Your email address will not be published. Required fields are marked *