| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ache_key Agent-Logs-Url: https://github.com/CaddyGlow/ccproxy-api/sessions/392aa95e-bd93-4b16-a9d7-8b7829631987 Co-authored-by: CaddyGlow <219252898+CaddyGlow@users.noreply.github.com>
There was a problem hiding this comment.
Fixes two independent causes of prompt cache misses in the Anthropic→OpenAI/Codex path by making both the forwarded system instructions and the prompt_cache_key deterministic across turns.
Changes:
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ccproxy/llms/formatters/anthropic_to_openai/requests.py | Adds a helper to remove billing-header lines and applies it when building OpenAI Responses instructions. |
| ccproxy/plugins/codex/adapter.py | Stops randomizing prompt_cache_key when it comes from the request template. |
| tests/unit/llms/formatters/test_anthropic_to_openai_helpers.py | Adds tests covering header stripping behavior and instruction stability across requests. |
| tests/plugins/codex/unit/test_adapter.py | Updates/extends tests to verify stable template prompt_cache_key forwarding and caller precedence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| if not line.strip().lower().startswith(_NONSEMANTIC_SYSTEM_PREFIXES) | ||
| ).strip() | ||
|
|
||
|
|
…ent (#63) Apply `_strip_nonsemantic_system_lines()` in the Anthropic->OpenAI Chat request converter so the per-request `x-anthropic-billing-header` (with the regenerating `cch=<hash>`) does not defeat upstream prompt caching on the chat-completions path. Mirrors the fix landed for the Responses API converter in #62. If the cleaned system content is empty, the system message is dropped entirely instead of injecting an empty system role. Adds 5 chat-converter tests mirroring the Responses-API coverage: string-system stripping, block-system stripping, case-insensitive matching, header-only-system drops the message, and cross-request stability when only the `cch=` hash differs.
| Back | FazBrowse Home | New Git URL |
Every Anthropic→Codex request turn was a guaranteed cache miss due to two independent bugs: a per-request cch=<hash> in Claude Code's x-anthropic-billing-header system prefix producing unique instructions on every turn, and _apply_request_template overwriting any template-configured prompt_cache_key with a fresh uuid.uuid4().
Changes
ccproxy/llms/formatters/anthropic_to_openai/requests.py
ccproxy/plugins/codex/adapter.py
Tests
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either: