Skip to content

v1.7.0

Choose a tag to compare

@github-actions github-actions released this 08 Oct 03:52
· 280 commits to main since this release
ac2ec33

TokenFuse 1.7.0

Four fixes, three about what a call is charged and one about whom.

  • The price book has a row for every Claude id Anthropic lists, and for the
    current Gemini models sold on Vertex AI.
  • A Gemini thinking call is charged the reasoning tokens Google bills.
  • An operator can set prices in a file.
  • A call refused for identity is exported under the credential that made it,
    not under the agent it pretended to be.

This is a minor release because it adds one environment name,
TOKENFUSE_PRICE_BOOK, and two FOCUS export columns, x_key_id and
x_block_reason. Nothing frozen in compat/1.0.json moves; the FOCUS columns
are appended after the existing ones, and the rule is now written there. The
umbrella crate and both client SDKs move to 1.7.0 with no client behavior
change.

Fixed

  • A price-book row for every listed Claude id, and x-fuse-price on every
    answer (#366, invariant 79).
    • The defect. A claude-sonnet-5 call of 2874 input and 200 output
      tokens settled at 0.05811 USD, the 15 / 75 fallback, because the book had
      no row for it. Its list rate is 2 / 10, so the right figure was 0.007748.
      Every Bedrock and Google Cloud id was in the same place.
    • The rows. Every Claude id Anthropic lists under the Claude API,
      Bedrock, Google Cloud and OpenRouter, each rate read from the vendor's
      page on 2026-10-07 and cited beside it. An id that does not say which
      endpoint served it is priced with the clouds' 10 percent regional
      premium, the over-charging side.
    • x-fuse-price. Every metered answer, streamed or not, now carries
      x-fuse-price: known or fallback; a streamed answer carried nothing
      before. The first fallback-priced call of each model id is logged at warn.
  • TOKENFUSE_PRICE_BOOK, an operator's price file (#366, invariant 79). A
    JSON file of rows in the published book's own shape, read once at startup,
    replacing a built-in row of the same id or adding one. The fallback cannot
    be set from it. A set but unusable file stops the gateway with exit 2 naming
    the variable.
  • A Gemini thinking call is charged its reasoning (#367, invariant 80).
    • The defect. Vertex AI's OpenAI-compatible endpoint reports reasoning
      tokens outside completion_tokens and bills them at the output rate. The
      gateway read completion_tokens alone, so a measured gemini-2.5-flash
      call settled 152 micro-USD where Google bills 1552.
    • The rule. Output is the larger of completion_tokens and
      total_tokens less prompt_tokens. For OpenAI the two are equal and
      nothing changes.
  • Gemini on Vertex AI is priced at Google's listed rate (#369, invariant
    82).
    • The defect. The book had no Gemini row, so every Gemini call settled
      at the fallback: the measured call above cost 46635 micro-USD there.
    • The rows. Ten ids as the OpenAI-compatible endpoint takes them,
      google/gemini-3.8-flash to google/gemini-2.5-flash-lite, read from
      Google's Vertex AI pricing page on 2026-10-08.
    • The choices, each toward over-charging. The Gemini 3 family at its
      non-global rate. Gemini 2.5 Pro at its rate above 200K input tokens.
      Gemini 3.6, 3.7 and 3.8 Flash at the standard rate, not the introductory
      credit that runs to the end of 2026.
  • A call refused for identity is exported under the credential that made it
    (#368, invariant 81).
    • The defect. Measured 2026-10-07: a caller presenting one key and
      another agent's id was refused 403 identity_mismatch, correctly. But
      tokenfuse focus-export wrote the refused row under the claimed agent
      and carried neither the key nor the reason. A FinOps console reading the
      export showed the victim with blocked calls it never made.
    • The fix. Such a row's ResourceId and ResourceName are now
      key:<key_id>, and its x_agent_id is empty. With client keys off there
      is no key, and both columns are empty. Every other row is unchanged.
    • Two new columns, appended last.
      • x_key_id on every row: empty with client keys off, and for trace
        segments written before the key was recorded.
      • x_block_reason: the Breaker's reason, set exactly when x_blocked is
        true.
    • The column list is published in contracts/tokenfuse-constants.json
      as focus_export.columns.

Upgrade

  • Nothing to configure. The price rows, the reasoning rule and the export
    columns apply on start.
  • A call may now cost less, or more, than on 1.6.1. A listed Claude or
    Gemini id that used to settle at the 15 / 75 fallback now settles at its
    list rate. A Gemini thinking call now also pays for its reasoning. A budget
    sized against the fallback has more room than before.
  • A FOCUS consumer that reads columns by name needs nothing. One that
    checks the exact header sees two more columns at the end. A row refused for
    identity now names key:<key_id>, not an agent.

Not proven

  • No live call to Anthropic, Bedrock, Google Cloud or OpenRouter for this
    release.
    The rows are held by tests that write each rate out by hand, and
    the measured calls are replayed through the shipped book.
  • The rates are true on the date they were read (2026-10-07 for Claude,
    2026-10-08 for Gemini) and on no other.
  • An audio prompt to a Gemini model with a dearer audio rate is
    under-charged.
    The rows price text input.
  • Two things the export cannot see in TOKENFUSE_IDENTITY_STRICT=warn.
    A mismatched call is forwarded and exported as allowed, under the agent id
    it claimed. The finer identity reason is not in the trace either.
  • A Google-shaped usage with no total_tokens still settles on the
    completion count alone.