You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Route @ai-sdk/xai models through the V2 native responses runner #35100
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
The V2 session runner sets a prompt cache key on every request (packages/core/src/session/runner/llm.ts), and the OpenAI Responses protocol writes it to the prompt_cache_key body field. SessionRunnerModel.fromCatalogModel has no branch for @ai-sdk/xai, so xai catalog models fail with UnsupportedApiError and never reach the native route that carries the key.
Request: map @ai-sdk/xai catalog models onto the existing OpenAIResponses route. xAI's Responses API matches the OpenAI Responses API, including prompt_cache_key, so no new protocol work is needed. One detail: the route's default baseURL points at api.openai.com, so xai models without a catalog URL need a default of https://api.x.ai/v1.
Benefit: xai sessions on the V2 runner send the identifier that xAI uses to route requests to the server holding their cache. Cached tokens are billed at a reduced rate and return faster. See the xAI prompt caching docs.
Related: #35033 covers the same gap in the legacy provider path. This issue is specific to the V2 native runner. It replaces #35034, which was closed for not using the issue template.
Audit update (2026-07-08): #35031 is the active implementation, but it currently targets dev rather than v2. Confirm the intended landing branch or port plan before treating this V2 issue as complete.
Addressed by #39613 together with the native xAI provider package on v2. xAI catalog models now resolve through the provider-package contract with credentials, base URL, headers, body overlays, limits, and provider options applied; the xAI provider defaults model() to its native OpenAI Responses route and uses the xAI API base URL. This lets V2 catalog-selected xAI models carry Responses options such as the prompt cache key instead of failing package resolution. Closing as resolved.
Activity
opencode-agent commentedon Jul 8, 2026
Audit update (2026-07-08): #35031 is the active implementation, but it currently targets
devrather thanv2. Confirm the intended landing branch or port plan before treating this V2 issue as complete.opencode-agent commentedon Jul 30, 2026
Addressed by #39613 together with the native xAI provider package on
v2. xAI catalog models now resolve through the provider-package contract with credentials, base URL, headers, body overlays, limits, and provider options applied; the xAI provider defaultsmodel()to its native OpenAI Responses route and uses the xAI API base URL. This lets V2 catalog-selected xAI models carry Responses options such as the prompt cache key instead of failing package resolution. Closing as resolved.