mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6341] [Feature]: 1-hour prompt cache option for the Claude (Subscription) provider #3542
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#3542
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Sep 18, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6341
Originally assigned to: @SpicyMarinara on GitHub.
What problem does this solve?
The Anthropic (API key) provider has an "Extended token caching (1 hour)" toggle, but the Claude (Subscription) provider has no equivalent. Roleplay chats routinely have gaps of more than 5 minutes between messages, and when the cache lapses the next request re-writes the full context at the cache-write rate, which eats into subscription usage windows.
Users also can't fix this themselves through Claude Code config: the provider passes
settingSources: [](deliberately, to keep Claude Code settings out of chat requests), sopromptCacheTtlin~/.claude/settings.jsonis never read.Proposed solution
settingsobject the provider already sends (settings: { fastMode }-> alsopromptCacheTtl: "1h"), or by settingCLAUDE_CODE_PROMPT_CACHE_TTL=1hinsdkOptions.env. Requires Claude Code v2.1.242+.claude-subscription.provider.tsthat state the Agent SDK uses the 5-minute cache (write 1.25x). Per Anthropic's current docs, Agent SDK turns fall in the "main conversation" bucket, which defaults to the 1-hour TTL on a subscription within plan usage (write 2x) and drops to 5 minutes on usage credits or an API key. The cache-economics log may be using the wrong multiplier.ephemeral_5m_input_tokensandephemeral_1h_input_tokens(both are in the usage object undercache_creation), so users can see which TTL they are actually getting.Alternatives considered
Setting
CLAUDE_CODE_PROMPT_CACHE_TTL=1hin Marinara's.envworks today as a workaround, since the provider forwardsprocess.envto the SDK subprocess. It's undiscoverable, though, and applies to every subscription connection rather than per connection.Additional context
Template check
@SpicyMarinara commented on GitHub (Sep 18, 2026):
Implementation owner: @SpicyMarinara (Codex), tracked in draft #6342 against staging. I checked open PRs and issue-linked branch names before starting; none overlap these fixes. Reproduction and regression proof are in progress.
@SpicyMarinara commented on GitHub (Sep 19, 2026):
Implemented in #6342, now merged into staging. Claude Subscription supports the existing one-hour cache setting, including save/reload and unsaved exports. Cache logs distinguish reported five-minute and one-hour writes; incomplete usage leaves estimates unknown. SDK and desktop/mobile regressions pass; live subscription expiry testing remains documented in the PR.