Prompt caching not working: app does not send anthropic-beta header on /anthropic/v1/messages requests
まだ誰も着手していません。
評価
調査の方向性
まず、/anthropic/v1/messages エンドポイントに対する Copilot アプリのリクエスト構築と、supports_prompt_caching の読み取り方法を追跡します。対象となるカスタムプロバイダーのモデルへのリクエストに anthropic-beta: prompt-caching-2024-07-31 が含まれ、それ以外のリクエストは変更されないことを確認します。既存のリクエストまたはプロキシのログ設定を使用して、送信されるヘッダーを検証します。
索引モデルが issue の本文から書いたものです。
説明
Summary
The Copilot app correctly uses the /anthropic/v1/messages endpoint when a custom model provider is configured with an Anthropic-compatible base URL. However, it does not send the anthropic-beta: prompt-caching-2024-07-31 header, so prompt caching is never activated — even when cache_control: {type: ephemeral} markers are present in the request.
Evidence (from local hai-desktop proxy logs)
The local hai-desktop proxy forwards requests and adds ?beta=true to the upstream URL only when it sees the anthropic-beta header from the client. Comparing the two callers:
| Client | User-Agent | Upstream target | Caching |
|---|---|---|---|
| Claude Code | claude-cli/2.1.222 |
...llm-proxy/anthropic/v1/messages?beta=true |
✅ works |
| Copilot app | Anthropic/JS 0.94.0 |
...llm-proxy/anthropic/v1/messages |
❌ broken |
Claude Code sends anthropic-beta: prompt-caching-2024-07-31; the Copilot app does not.
Confirmed by live test (same proxy, same model)
With anthropic-beta header (Claude Code / manual curl):
- Request 1:
cache_creation_input_tokens: 1202, cost0.005942 - Request 2:
cache_read_input_tokens: 1202, cost0.000587— 10× cheaper
Without anthropic-beta header (Copilot app):
- Request 1:
cache_creation_input_tokens: 0 - Request 2:
cache_read_input_tokens: 0— no savings
Workaround
I added a local HTTP caching proxy on a separate port that sits in front of hai-desktop to avoid redundant calls. This is a symptom fix, not a solution.
Request
When the Copilot app is configured with a custom provider using an Anthropic-format endpoint, and a model reports supports_prompt_caching: true, the app should send:
anthropic-beta: prompt-caching-2024-07-31
on requests to /anthropic/v1/messages. This is the only missing piece — the endpoint, the model, and the cache_control markers in the request body are all already correct.
- 主要言語
- 言語のデータがありません
- スター
- 2.1k
- フォーク
- 157
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/app のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
似ている issue
-
bug CLI custom-model
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug confirmed issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
open-webui/open-webui#30750 · コメント 1 件 ·
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2234 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100