Skip to content

Deepseek API burning too many tokens. #32911

Description

@tehNate

Description

There is an issue that I am experiencing, and other are experiencing. If you are using the Deepseek API with a key VIA the newer 1.17 versions of Opencode then you are being overbilled because of a bug in the code.

The bug has been tested in this Reddit thread:

https://www.reddit.com/r/opencodeCLI/comments/1u9grix/opencode_not_using_prompt_caching_with_deepseek/

Ongoing problem for a week you all need to address this.

DeepSeek V3/V4 supports native prompt caching so the model can do it.

The issue seems to be OpenCode not sending cache_control in its API requests.

Plugins

No response

OpenCode version

1.17+

Steps to reproduce

The bug has been tested in this Reddit thread:

https://www.reddit.com/r/opencodeCLI/comments/1u9grix/opencode_not_using_prompt_caching_with_deepseek/

Every prompt I send costs 160–170K input tokens because the full conversation history gets re-sent each turn with no caching. Tested in a brand new empty folder — even "hello" costs ~8K tokens (that's OpenCode's fixed system prompt + tool definitions overhead, apparently normal). The real problem: after a long session there's zero cache reduction. No "cache read" field in the UI, no cost savings between turns.

DeepSeek V3/V4 supports native prompt caching so the model can do it. The issue seems to be OpenCode not sending cache_control in its API requests.

Screenshot and/or share link

No response

Operating System

Linux CLI

Terminal

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions