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

Đang mở Phù hợp với người mới
#66,001 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại priceSource() trong provider claude-agent, nơi đã phát hiện liệu login có phải là subscription hay không, và theo dõi cách object settings của từng model được lắp ghép để cache.ttl có thể được đặt thành 1h cho các login subscription. Sau đó kiểm tra logic khoảng thời gian warming, vốn fallback về 4 phút khi thiếu cache.ttl. Hoàn tất trông giống như GET /api/model trả về settings.cache.ttl trên mọi model claude-agent dưới một login subscription, với các keep-alive warming cách nhau một giờ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
228k
Fork
31k
Merge trung bình
3 giờ 22 phút
Pull request đã merge (30 ngày)
476

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.