Module exposing: normalizeUpstreamUsage, parseUsageRaw, parseUsageBody, upstreamUsage, normUsage
// Source: https://github.com/Gnosil/semantix | License: MIT | Copyright 2026 Gnosil // Provided via justclaw.it.com; keep this notice with the code. package gateway import "encoding/json" // upstreamUsage is the union of the cache-usage wire shapes observed across // upstreams (GLM-P0-3 / Issue #291; measured in docs/reports/glm-spike-week.md // §2, §3A.2, §3B): // // - OpenAI style: prompt_tokens is the full input; // prompt_tokens_details.cached_tokens is the prefix-cache-served subset. // - Anthropic style: input_tokens EXCLUDES cache reads and writes // (incremental accounting) — the full input is // input_tokens + cache_creation_input_tokens + cache_read_input_tokens. // Tencent-style gateways emit cache_read_input_tokens only on a hit; // AtomClub-style gat ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key