Skip to content
  • OpenCode plugin
  • v0.8.1
  • MIT

OpenCode Cache Manager

Take control of your prompt cache. Pick a 5m, 1h or hybrid TTL per session, and keep idle caches warm with pings so they don't expire while you're away.

  1. opencode plugin add @noppu-labs/opencode-cache-manager

Also published unscoped as opencode-cache-manager. Run /cache-manager in the TUI to change a session's settings.

Cache Manager, an OpenCode plugin: take control of your prompt cache. After 15 minutes away, the default 5m cache has expired and the next prompt rewrites it at 1.25x. With keepalive, pings keep it warm and the next prompt reads it at about 0.1x.

01 — What it does

Stop paying to rewrite the cache.

  • ttl

    A TTL per session

    Switch any session to 5m, 1h or hybrid with /cache-manager. On Claude, hybrid caches tools and the system prompt for an hour and the message tail for 5 minutes.

  • keepalive

    Keepalive pings

    A hidden ping goes out shortly before the cache expires and restarts its TTL. Nothing is added to the conversation, and a ping costs about one cache read.

  • limits

    Pings that stop themselves

    Keepalive stops after 5 pings in one idle stretch by default, and stops early when a ping misses the cache, so a provider that doesn't reuse it can't run up paid pings.

  • sidebar

    Cache status in the sidebar

    The OpenCode sidebar shows how much of the context is cached, when it expires, the next ping and what keepalive has saved.

  • openai

    GPT-5.6+ too

    On GPT-5.6+, 1h asks for OpenAI's 12-hour cache, and one-off requests such as titles stop paying for cache writes.

  • proxies

    Works through proxies

    It handles the Anthropic Messages API, OpenAI Chat Completions and the OpenAI Responses API, on the official endpoints and through proxies such as OpenRouter and OmniRoute.

02 — How it works

What happens to each request.

  1. OpenCode builds the request. On Claude it marks its own cache breakpoints, always with a 5-minute TTL.
  2. The plugin rewrites the outgoing request to the session's mode, and adds the extended-TTL header Claude needs for 1h and hybrid.
  3. It reads the cache usage in each response. When the provider reports which TTL it granted, the sidebar and the ping schedule use that one.
  4. When the session goes idle, it schedules a ping just before the cache would expire. Your next real request cancels it.
The Cache section of the OpenCode sidebar: status warm, 92% cached (141k of 153k tokens), expires 14:52, TTL 1h detected, next ping 14:42, 2 of 5 pings used with the last one a hit, $0.42 saved over 2 rewrites.
The sidebar's Cache section during an idle stretch.

03 — Requirements

What you need.

  • OpenCode V2 2.0.22 or later
  • A Claude or GPT-5.6+ model, through its official API or a proxy such as OpenRouter. Other models get only the cache readout unless cacheProfiles maps them to the anthropic or openai profile.
~/.config/opencode/opencode.jsonc
{
  "plugins": [
    {
      "package": "@noppu-labs/opencode-cache-manager",
      "options": {
        "defaultMode": "1h",
        "keepalive": { "enabled": true, "maxPings": 5, "minContextTokens": 50000 }
      }
    }
  ]
}

04 — Questions

Before you install.

Do keepalive pings cost money?

Yes. Each ping is a real request that reads the whole context from cache, at about 0.1x the input price. It saves money when you come back after a long gap, and costs money for sessions you never return to.

Which models does it manage?

Claude and OpenAI GPT-5.6+, through their official APIs or proxies such as OpenRouter. Another model that takes Claude- or OpenAI-style cache breakpoints can be managed the same way through the cacheProfiles option. For the rest it only shows how much of each prompt was cached, and never pings.

Can I use it with OpenCode's warming option?

Use one or the other. With warming: true on as well, both would ping the same session and you'd pay for every ping twice.

Does it work on OpenCode V1?

No. It needs OpenCode V2 2.0.22 or later.

More OpenCode plugins

All OpenCode plugins