Release date 2026/08/20
Feature
Added
cache_read_costandcache_write_costtomodel.optionsso cached and cache-write prompt tokens can be priced per 1M tokens, alongsideinput_cost/output_cost.Added filtering for empty Anthropic thinking blocks in request history.
Added support for reporting prompt cache token metrics in OpenAI-compatible format.
Added support for reporting prompt cache token metrics when using native (non-OpenAI) request/response formats.
Usage cost now supports per-cache-TTL cache-write pricing, context-window pricing factors, and service-tier pricing factors via
model.options(cache_write_cost_list,context_window_factor,service_tier_factor). Anthropic (cache TTL + service tier), OpenAI, and Gemini service tiers are collected from upstream responses.
Bugfix
Fixed a bug where a response from Anthropic could fail to decode when the client’s request advertised Brotli support, since Anthropic’s edge may then return a Brotli-encoded body that Kong’s response decompression – which only understands gzip – can’t inflate. Kong now normalizes the outgoing
Accept-Encodingrequest header before proxying to any LLM provider:gzip, identitywhen the client accepts gzip, andidentityotherwise, so a client that cannot inflate gzip is never handed a compressed body on the paths that pass the upstream response through untouched.Fixed an issue where token usage for Anthropic requests using the compaction beta was undercounted. Kong now sums
usage.iterationswhen present instead of relying solely on the top-levelinput_tokens/output_tokens, which only reflect non-compaction iterations.Fixed an issue where Gemini’s tool-use token usage (billed when server-side tools such as grounding, code execution, or URL context are used) was not counted in the reported token usage or cost.
Fixed an issue where signed Anthropic thinking blocks with omitted text were removed from request history.
Fixed an issue where
cache_creation_input_tokensandcache_read_input_tokenswere excluded from prompt token counts, causing undercounting when Anthropic prompt caching was active.Fixed an issue where native Anthropic streaming counted provisional
message_startoutput tokens and summed cumulativemessage_deltausage.Fixed an issue where the
context-management-2025-06-27Anthropic beta flag was dropped when routing to a Bedrock target, causing Bedrock to reject requests carryingcontext_managementwith a400error on failover from an Anthropic target.Fixed an issue where output token usage was reported as zero for Bedrock native format request to AWS models like Nova.
Fixed an issue where Anthropic-format requests could report zero usage when it targets Bedrock’s own model via conversion.
Fixed an issue where OpenAI, Azure, and Gemini realtime upstream URLs using
wsswere downgraded tows.Fixed an issue where a credential header could appear unredacted in access logs when using AWS temporary credentials with Bedrock.
Fixed an issue where Ollama rejected OpenAI message content arrays.
Fixed an issue where some Claude Code MCP tools did not correctly handle empty ‘requires’ array.
Fixed Gemini image generation token accounting to include reasoning tokens (
thoughtsTokenCount) inoutput_tokensand report them asoutput_tokens_details.reasoning_tokens. Previously the reasoning tokens were dropped, which under-reported output tokens, analytics, and calculated cost for thinking-enabled image models.Fixed Gemini realtime (Live API) token accounting to include reasoning tokens (
thoughtsTokenCount) in the reported output tokens, and to report them asoutput_tokens_reasoning_tokens_count. Previously the reasoning tokens were dropped, which under-reported the output and total token counts of thinking-enabled realtime sessions.Fixed token usage statistics being silently dropped for
audio/v1/audio/transcriptionsrequests. Token-billed OpenAI/Azure transcription models (e.g.gpt-4o-transcribe) now reportinput_tokens/output_tokens/total_tokensand thetext_tokens/audio_tokensbreakdown in the analytics log whenlogging.log_statisticsis enabled.Fixed an issue where Gemini streaming analytics could over-report token usage. Gemini repeats its usage metadata on every stream chunk as a running request-level total, but the counts were summed across chunks instead of replaced, multiplying the reported usage by the number of chunks. Reasoning tokens were affected the most, because Gemini reports them in full on the first chunk and does not change them afterwards. A chunk that carried no usage metadata also reset the recorded output token count to zero.