Skip to content

[Phase 1] Correct the mis-priced gemini-3.5-flash row in model-pricing.tsv ($0.30/$1.20 → verified $1.50/$9.00) #1205

Closed

Description

@don-petry

Story

The gemini-3.5-flash* row in scripts/lib/model-pricing.tsv is mis-priced and materially understates Gemini review cost.

Current (wrong) row on main:
gemini-3.5-flash* 2026-06-11 0.30 0.03 0.30 1.20 → $0.30 input / $1.20 output per MTok

Verified against Google's official pricing page (2026-07-13): Gemini 3.5 Flash (paid tier) is $1.50 input / $9.00 output / $0.15 context-cache read per 1M tokens. The current row understates output by ~7.5×.

Source: https://ai.google.dev/gemini-api/docs/pricing

Acceptance Criteria

  1. scripts/lib/model-pricing.tsv prices gemini-3.5-flash at the verified rate for a current timestamp: input 1.50, cache_read 0.15, output 9.00. cache_write is best-effort per the file convention (mirror input 1.50 and mark VERIFY, matching how other non-Claude rows are handled).
  2. Follow the file's PRICE-CHANGES rule: append a new effective-dated gemini-3.5-flash* row (do not edit the existing 2026-06-11 row) with effective_from = the correction date, so price_for gemini-3.5-flash <today> resolves to the corrected rate while historical lookups are unchanged.
  3. Cite the source URL + retrieval date in the PR description; no guessed figures.
  4. Add/extend a regression assertion in the model-pricing test suite mirroring the existing gemini-3.5-flash coverage, asserting the corrected rate for a post-correction timestamp.

Notes

Filed under epic #1138. Status: ready-for-dev.

Activity

  1. don-petry commented on Jul 14, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead Implementation Plan

    Issue: #1205 — [Phase 1] Correct the mis-priced gemini-3.5-flash row in model-pricing.tsv ($0.30/$1.20 → verified $1.50/$9.00)

    Scope

    Append a corrected effective-dated gemini-3.5-flash* row (input 1.50 / cache_read 0.15 / cache_write 1.50 VERIFY / output 9.00, effective 2026-07-14) to scripts/lib/model-pricing.tsv, leaving the historical 2026-06-11 row intact, and add a regression assertion to the pricing test suite.

    Implementation Checklist

    • scripts/lib/model-pricing.tsv — append gemini-3.5-flash* 2026-07-14 1.50 0.15 1.50 9.00 after the existing 2026-06-11 row (do NOT edit the old row)

    Tests to Write

    • tests/model_pricing.bats — assert price_for gemini-3.5-flash 2026-07-14 → 1.50 0.15 1.50 9.00 (post-correction)
    • tests/model_pricing.bats — assert price_for gemini-3.5-flash 2026-07-01 → 0.30 0.03 0.30 1.20 (historical row unchanged)

    Test Command

    bats tests/model_pricing.bats

  2. don-petry commented on Jul 14, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Implementation Complete

    Plan Execution

    • Appended corrected effective-dated gemini-3.5-flash* row (2026-07-14) to scripts/lib/model-pricing.tsv — existing 2026-06-11 row left untouched
    • Added post-correction regression assertion to tests/model_pricing.bats
    • Added historical (pre-correction) assertion guarding the old row still resolves for past dates
    • Full pricing suite + downstream consumers (et-baseline, token_report) green; dev-lead-lint passes

    Source

    Verified against Google's official pricing page — https://ai.google.dev/gemini-api/docs/pricing (retrieved 2026-07-13): Gemini 3.5 Flash paid tier = $1.50 input / $0.15 context-cache read / $9.00 output per 1M tokens. cache_write is best-effort (mirrors input 1.50, marked VERIFY per the file's non-Claude convention).

    Test Results

    1..18
    ok 1 price_for: opus 4.7 at a 2026 date → $5 / $0.50 / $6.25 / $25
    ok 2 price_for: sonnet 4.6 → $3 / $0.30 / $3.75 / $15
    ok 3 price_for: sonnet 5 intro window → $2 / $0.20 / $2.50 / $10
    ok 4 price_for: sonnet 5 standard window — exact boundary (2026-09-01) → $3 / $0.30 / $3.75 / $15
    ok 5 price_for: sonnet 5 standard window (after 2026-09-01) → $3 / $0.30 / $3.75 / $15
    ok 6 price_for: more-specific glob wins (opus-4-1 legacy = $15, not $5)
    ok 7 price_for: unknown model → empty
    ok 8 price_for: gemini-3.5-flash historical (pre-correction) → $0.30 / $0.03 / $0.30 / $1.20
    ok 9 price_for: gemini-3.5-flash corrected (post-correction) → $1.50 / $0.15 / $1.50 / $9.00
    ok 10 price_for: selects the rate in effect on the record's date
    ok 11 price_for: date before the earliest effective_from → empty (no retroactive guess)
    ok 12 cost_usd: opus 21952/0/14665 ≈ $0.476385 (no cache)
    ok 13 cost_usd: includes cache-read and cache-write terms
    ok 14 cost_usd: unknown model → empty (never silently $0)
    ok 15 et_multiplier_for: haiku baseline = 1.0
    ok 16 et_multiplier_for: sonnet = 3.0
    ok 17 et_multiplier_for: opus 4.7 = 5.0 (was hardcoded 15)
    ok 18 et_multiplier_for: unknown model → safe default 1.0
    

    Files Changed

    • scripts/lib/model-pricing.tsv: appended gemini-3.5-flash* 2026-07-14 1.50 0.15 1.50 9.00 (with a sourced VERIFY comment). price_for gemini-3.5-flash <today> now resolves to the corrected rate via most-specific-glob + latest-effective_from selection; historical lookups (< 2026-07-14) still resolve to the original 2026-06-11 rate.
    • tests/model_pricing.bats: two regression assertions — corrected rate at 2026-07-14, and unchanged historical rate at 2026-07-01.

    Notes

    No engine/routing change (out of scope per the issue). The two # Corrected ... comment lines in the TSV follow the file's existing comment convention and are skipped by the awk parser (/^[[:space:]]*#/). No commit/PR opened — left to the CI workflow.

  3. added a commit that references this issue on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dev-leadFor dev-lead agent pickupinitiativeEpic / initiative tracking issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions