mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 12:02:27 +08:00
grok-build CLI recap-style side-calls (turn-summary / title-refresh) send a fresh per-call X-Grok-Conv-Id label but set body prompt_cache_key to the parent session id, so a direct xAI connection shares the main turn's server-side prompt cache prefix. sub2api's explicitGrokCacheSeed preferred X-Grok-Conv-Id over the body key, which fragmented the cache identity on every side-call and forced a full-price replay of the whole conversation (~300K+ tokens each, ~2.3% cache hit rate observed over 44 side-calls / 4.9M input tokens in 7 days — about a third of all grok-4.6 input). Priority is now: CC session > generic session headers > body prompt_cache_key > X-Grok-Conv-Id > explicitKey > previous_response_id. IDE header-stability tests updated; new regression test locks in the side-call/parent key-sharing contract.