Skip to content

fix: improve xai cache hit rate#35970

Merged
rekram1-node merged 1 commit into
devfrom
xai-caching
Jul 8, 2026
Merged

fix: improve xai cache hit rate#35970
rekram1-node merged 1 commit into
devfrom
xai-caching

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

XAI supports automatic caching, but sending the key helps guarantee hits

Summary

  • send a session-scoped prompt cache key for models using the xAI SDK
  • allow setCacheKey: false to disable default cache keys for OpenAI and xAI
  • update the AI SDK 6 xAI provider to 3.0.102 and patch Responses serialization for prompt_cache_key
  • retain inline PDF support while adopting upstream URL-based file support

Testing

  • bun test test/provider-xai-responses.test.ts in packages/core
  • bun test test/provider/transform.test.ts in packages/opencode
  • bun typecheck in packages/core
  • bun typecheck in packages/opencode

@rekram1-node rekram1-node changed the title fix(provider): send xAI prompt cache key fix: improve xai cache hit rate Jul 8, 2026
@rekram1-node rekram1-node merged commit ccb6b7c into dev Jul 8, 2026
16 checks passed
@rekram1-node rekram1-node deleted the xai-caching branch July 8, 2026 22:29
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 9, 2026
anduimagui pushed a commit to anduimagui/opencode that referenced this pull request Jul 9, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant