Repository navigation
Fixed prompt caching for ChatGPT Subscription and model aliases for subagents - #187
Merged
Merged
Conversation
…ubagents Codex backend cache routing needs the session_id header besides prompt_cache_key; the proxy now sends it, gives every subagent its own cache key (session id + x-claude-code-agent-id) and no longer sends the explicit caching fields that Codex rejects with HTTP 400 (prompt_cache_options, prompt_cache_retention). - Kept role:"system" messages sent by Claude Code 2.1.288 inside messages[] (Codex: developer item, Chat Completions: in place). - Parsed cache_write_tokens nested in input/prompt_tokens_details and logged cached_tokens for aggregated Codex responses. - Applied Model Aliases to ChatGPT Subscription sessions so subagents and background requests use a supported model. - Listed models mapped to sonnet/opus/haiku by their own id in the model combo, in the order of the Model Aliases dialog (modelOrder; derived getComboModelIds is @JsonIgnore'd). - Added PromptPrefixTracker (per cache key and model) to log how much of the prompt prefix is unchanged between requests. - Added claude-launch-tests for prefix stability, Codex cache routing and router sticky/explicit cache experiments (results in docstrings). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
session_idheader besidesprompt_cache_key: it is now sent (main sessions went from ~0% to 90–99% cache hits).<session>/<x-claude-code-agent-id>).prompt_cache_options,prompt_cache_retention) are no longer sent to ChatGPT Subscription.role:"system"messages sent by Claude Code 2.1.288 are no longer lost (Codex: developer item; Chat Completions: kept in place).cache_write_tokensnested in usage details is parsed;cached_tokensis logged for aggregated Codex responses.PromptPrefixTrackerlogs how much of the prompt prefix is unchanged between requests (per cache key and model).claude-launch-tests/(results in docstrings): Codex needssession_id; the OpenAI-compatible router's cache is random for glm-5.3 / gpt-6-luna and ignores sticky hints and explicit fields.Test plan
mvn package(all unit tests)🤖 Generated with Claude Code