claude-agent with a Claude subscription doesn't set cache.ttl, so warming pings every 4 minutes

Open Beginner friendly
#66,001 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Start at priceSource() in the claude-agent provider, which already detects whether the login is a subscription, and follow how each model's settings object is assembled so cache.ttl can be set to 1h for subscription logins. Then check the warming interval logic that falls back to 4 minutes when cache.ttl is absent. Done looks like GET /api/model returning settings.cache.ttl on every claude-agent model under a subscription login, with warming keep-alives spaced an hour apart.

Written by the indexing model from the issue text.

Description

area/providers platform/windows type/feature version/v2
Description

With claude-agent signed in through a Claude subscription, the prompt cache lasts an hour, but none of its models have settings.cache.ttl. So warming's "auto" interval falls back to 4 minutes: about a dozen keep-alive requests an hour instead of one, each sending the full context and using up subscription quota. Background compaction is hit the same way: once a session has been idle for 5 minutes it no longer precomputes the summary, even though the cache is still there.

The workaround is adding "settings": { "cache": { "ttl": "1h" } } to every claude-agent model in the config. priceSource() in the claude-agent provider already knows when the login is a subscription, so it could set cache.ttl there.

Plugins

None

OpenCode version

2.3.2

Steps to reproduce
  1. Sign in to claude-agent with a Claude subscription
  2. Set "warming": true in the config
  3. GET /api/model: none of the claude-agent models have settings.cache.ttl
Screenshot

No response

Operating System

Windows 11

Terminal

OpenChamber desktop app

Dominant language
TypeScript
Stars
228k
Forks
31k
Avg merge
3h 22m
Merged PRs (30d)
476

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.