Skip to content

Copilot CLI gets zero prompt-cache hits on Claude models — ucode forces the openai provider type instead of Copilot's native anthropic one #494

Description

@larsmoan

The problem

Copilot CLI never caches anything when talking to Claude models through ucode. Every request pays full price, even though the same big system/tool prompt repeats on every turn.

Why

ucode always tells Copilot to use its openai connection mode for every model, including Claude. That mode has no way to mark "cache this part" — Anthropic's caching only works over Anthropic's own API format, which Copilot also supports (anthropic mode), but ucode never uses it for Copilot.

Complication

Copilot's anthropic mode only works right on newer versions. On anything below Copilot 1.0.81-6, Copilot sends a request parameter that current Claude models (Sonnet 5, Opus 5) reject outright — every request would just fail. So the fix has to check the installed Copilot version and only switch modes when it's new enough; older Copilot stays on the old (working, uncached) path.

Fix

PR #495. Verified against a real workspace: caching now shows up in Databricks' own usage table for Copilot + Claude, on Copilot 1.0.81-6 and newer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions