Dashboardopencode-loreGatewayResponse usage optionality

GatewayResponse usage optionality

Category: architecture
Confidence: 1.00
ID: 01a0a07a-58e0-7c0f-88b0-fcc66cd23304
Project ID: 6f4be9ff-ed84-4cca-a9e7-732a0b0b8677
Cross-project: No
Recalled in other projects: 0
Source session: 0FB4SgnhBwNOmuyXG
Created: 2026-09-11 13:17:02
Updated: 2026-09-14 15:12:47

Content

Gateway accumulators try to populate usage, but GatewayResponse.usage remains optional because compatible providers and partial responses may omit it. Chose preserving absent cacheCreationInputTokens as undefined over coercing it to zero because zero would masquerade as provider-reported cache-write usage in analytics and cost tracking; use numeric fallbacks only where serialization or scaling requires them.

Move to: