You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LiteLLM proxy responses record $0.00 cost when x-litellm-response-cost header is omitted #52127
When using OpenCode with a LiteLLM proxy, some turns are recorded with $0.00 cost in opencode stats even though the proxy correctly billed the request.
LiteLLM 1.98+ omits the x-litellm-response-cost response header when its value equals x-litellm-response-cost-original (a size optimisation). OpenCode does not read any LiteLLM response headers — cost is estimated purely from a local price table. For models with no price entry, this always yields $0.00. Two manual curl calls to the proxy with identical payloads confirmed the issue: request 1 returned x-litellm-response-cost: 0.000434; request 2 omitted that header but included x-litellm-response-cost-original: 0.000434, yet x-litellm-key-spend incremented on both.
Steps to reproduce
Configure OpenCode with a LiteLLM provider (custom proxy or hosted router)
Send a prompt using a model that has no local price entry (e.g. litellm/gpt-6-luna)
Run opencode stats — cost for that model shows $0.00
Activity
github-actions commentedon Sep 29, 2026
This issue might be a duplicate of an existing issue. Please check:
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊