Is your feature request related to a problem? Please describe.
schema.PromptTokenDetails models only CachedTokens (cache read). There's no field for cache write (creation) tokens. Multiple providers bill cache writes at a premium and report a distinct count - Anthropic cache_creation_input_tokens (1.25x/2x), OpenAI cache_write_tokens (newer manual-cache models, 1.25x), AWS Bedrock cacheWriteInputTokens - but eino has nowhere to put it, so bindings fold it into PromptTokens. The total is preserved, but the distinct write count isn't surfaced:
promptTokens := int(usage.InputTokens + usage.CacheReadInputTokens + usage.CacheCreationInputTokens)
PromptTokenDetails{ CachedTokens: int(usage.CacheReadInputTokens) } // write count not surfaced
Result: write tokens are counted, but unattributable - they land in the input bucket and get priced at 1x instead of the provider's write rate, so cost tracking under-reports the write premium and can't break out write volume.
Describe the solution you'd like
type PromptTokenDetails struct {
CachedTokens int `json:"cached_tokens"` // cache read
CacheCreationTokens int `json:"cache_creation_tokens"` // cache write
}
Describe alternatives you've considered
- Compute downstream - impossible; the write count is already summed into
PromptTokens at the binding and can't be separated back out.
- Carry via ResponseMeta.Extra - works but unshaped and per-consumer; a typed field is the right home.
Additional context
Every other provider-agnostic framework already models write separately and provider-neutrally: LangChain / LangChain.js (input_token_details.cache_creation), Vercel AI SDK (inputTokens.cacheWrite), LlamaIndex (cache_creation_input_tokens). Gemini is the one provider with no per-request write count (write billed in a separate caches.create call) — a neutral field simply stays zero there.
Is your feature request related to a problem? Please describe.
schema.PromptTokenDetailsmodels only CachedTokens (cache read). There's no field for cache write (creation) tokens. Multiple providers bill cache writes at a premium and report a distinct count - Anthropic cache_creation_input_tokens (1.25x/2x), OpenAI cache_write_tokens (newer manual-cache models, 1.25x), AWS Bedrock cacheWriteInputTokens - but eino has nowhere to put it, so bindings fold it intoPromptTokens. The total is preserved, but the distinct write count isn't surfaced:Result: write tokens are counted, but unattributable - they land in the input bucket and get priced at 1x instead of the provider's write rate, so cost tracking under-reports the write premium and can't break out write volume.
Describe the solution you'd like
Describe alternatives you've considered
PromptTokensat the binding and can't be separated back out.Additional context
Every other provider-agnostic framework already models write separately and provider-neutrally: LangChain / LangChain.js (input_token_details.cache_creation), Vercel AI SDK (inputTokens.cacheWrite), LlamaIndex (cache_creation_input_tokens). Gemini is the one provider with no per-request write count (write billed in a separate caches.create call) — a neutral field simply stays zero there.