Skip to content

fix: retain Google usage on JSON errors - #18

Merged
ElliotEtag merged 1 commit into
mainfrom
codex/json-error-usage
Oct 30, 2026
Merged

ElliotEtag merged 1 commit into
mainfrom
codex/json-error-usage

Conversation

@ElliotEtag

@ElliotEtag ElliotEtag commented Oct 30, 2026 •

Copy link
Copy Markdown

Description:

  • Preserve provider-reported usage alongside Google/Vertex JSON errors, including prompt blocks. This completes the JSON counterpart of fix: preserve Gemini refusals and zero-output usage #17's SSE usage handling.
  • Reuse the existing JSON usage mapping, including reasoning, audio and Vertex cache-creation accounting. Errors without usage still omit it.
  • Gen can then record provider cost without charging callers; Pollinations #18814 also handles failed fallback attempts.

Tests Run/Test cases added:

  • 27 stream/response tests, 47 Vertex tests, 15 parameter tests; formatting, build and startup pass.
  • Nine E2E cases through modified Gen and gateway: five live Google calls, plus four native fixtures. The documented seven-token JSON block returns 422, records provider cost and debits zero.
  • Gen's 95 tracking tests and typecheck pass.
  • Local wallet/telemetry; JSON uses the inline coordinator helper. Gateway typecheck retains 11 existing main diagnostics.

Type of Change:

  • Bug fix

Rollout requires Pollinations #18814, which includes the gateway pin update. Provider invoicing for blocked prompts remains unverified; this preserves reported counters without changing caller billing.

@ElliotEtag
ElliotEtag merged commit e0e99d0 into main Oct 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant