feat(agents): OpenCode + DeepSeek cache integration - #264
Open
harijsvucens wants to merge 6 commits into
Open
Conversation
added 2 commits
July 24, 2026 13:31
…ion, compaction config, and cache write tracking - Add deepseek/deepseek-v4-pro and deepseek/deepseek-v4-flash - Track reasoning tokens separately from output tokens - Inject compaction config for long-running sessions - Track cache write tokens for cache warming visibility
…ersation runtime - Add contextWindow to ProviderModel type - Parse limit.context from opencode models --verbose output - Store on ConversationMeta.runtime.contextWindow
harijsvucens
force-pushed
the
feat/opencode-deepseek-cache
branch
from
July 24, 2026 10:32
bf92c10 to
b37dfaa
Compare
added 4 commits
July 24, 2026 14:55
…n read for existing conversations
…n API route (server-side, no client import breakage)
…extWindow lookups find models from listModels()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves OpenCode integration in Cabinet for token efficiency and cost visibility when using DeepSeek models. It also adds general-purpose reasoning token tracking for all OpenCode providers.
Research
The cache token pipeline from DeepSeek through OpenCode to Cabinet was verified from opencode source (branch
dev). Cabinet already captures cached input tokens correctly viatokens.cache.readin the JSON stream. DeepSeek's KV cache is automatic (always on) with 50-120x cost savings on cache hits. SeeOPENCODE_PLAN.mdfor full analysis.Changes
Phase 1 — DeepSeek fallback models
deepseek/deepseek-v4-proanddeepseek/deepseek-v4-flashtoOPENCODE_FALLBACK_MODELSopencode modelsdiscovery failsPhase 2 — Reasoning token separation
reasoningTokenstoAdapterUsageSummary(types.ts)tokens.reasoningseparately instead of merging intooutputTokensTurnTokens,ConversationTokens, daemon client, store, and runnerPhase 3 — Compaction via config injection
OPENCODE_CONFIG_CONTENTwith compaction settingsOPENCODE_DISABLE_PROJECT_CONFIGto prevent project config leakagePhase 4 — Cache write tracking
tokens.cache.writeascacheWriteInputTokensfor cache warming visibilityTests
Files changed
16 files, ~190 insertions, ~10 deletions