Skip to content

fix(ai-openrouter): exclude unsupported 'prediction' param from generated model options - #1135

Merged
AlemTuzlak merged 1 commit into
mainfrom
fix/openrouter-prediction-param
Aug 18, 2026
Merged

fix(ai-openrouter): exclude unsupported 'prediction' param from generated model options#1135
AlemTuzlak merged 1 commit into
mainfrom
fix/openrouter-prediction-param

Conversation

@tombeckenham

@tombeckenhamtombeckenham commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🎯 Changes

Main CI went red after the OpenRouter model-metadata sync (#1048):

  • The OpenRouter API newly reports prediction as a supported parameter, so the generator emitted Pick<OpenRouterBaseOptions, ... | 'prediction'> for 9 models — but @openrouter/sdk@0.13.20's ChatRequest does not declare that field (its outbound schema would strip it at runtime), so packages/ai-openrouter no longer compiled (TS2344 in model-meta.ts, dts generation fails, which cascades into every example/e2e typecheck).
  • The same sync added grok-4.5 / grok-4.6 to GROK_CHAT_MODELS without updating the ai-grok unit test that pins the list, so test:lib was red too.

Fix:

  • Add prediction to the sync script's excludedParams set (same rationale as the existing entries: the SDK strips undeclared keys, so exposing it would silently no-op user input) and strip it from the generated model-meta.ts.
  • Update the stale GROK_CHAT_MODELS test expectation.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr (targeted: @tanstack/ai-openrouter build/test:lib/test:types and @tanstack/ai-grok test:lib are green; the full suite was red on main because of this very breakage).

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected OpenRouter model options by removing unsupported prediction settings from affected Mistral Codestral and GPT-4o models.
    • Prevented generated model configurations from exposing incompatible prediction parameters.
  • New Features

    • Added support for recognizing Grok 4.5 and Grok 4.6 models.

…ated model options
The OpenRouter model-metadata sync (#1048) started emitting 'prediction'
in the generated per-model option Picks, but @openrouter/sdk's ChatRequest
does not declare that field (its outbound schema would strip it at
runtime), so packages/ai-openrouter no longer compiled and main CI went
red. Add 'prediction' to the generator's excludedParams set (same
rationale as the existing entries) and strip it from the generated
model-meta.
Also update the stale GROK_CHAT_MODELS test expectation that the same
sync commit broke by adding grok-4.5 / grok-4.6.
@tombeckenham
tombeckenham requested a review from a team as a code ownerAugust 18, 2026 07:28
@coderabbitai

coderabbitaiBot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e52fb5a-a1b7-45b1-b25c-172b40099c51

📥 Commits

Reviewing files that changed from the base of the PR and between bc8c5e8 and 50d1be0.

📒 Files selected for processing (4)
  • .changeset/fix-openrouter-prediction-param.md
  • packages/ai-grok/tests/grok-adapter.test.ts
  • packages/ai-openrouter/src/model-meta.ts
  • scripts/convert-openrouter-models.ts
💤 Files with no reviewable changes (1)
  • packages/ai-openrouter/src/model-meta.ts

Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The PR excludes prediction from generated OpenRouter options and affected model metadata. It also updates the Grok adapter test to include grok-4.5 and grok-4.6.

Changes

OpenRouter prediction compatibility

Layer / File(s)Summary
OpenRouter option generation and metadata
scripts/convert-openrouter-models.ts, packages/ai-openrouter/src/model-meta.ts, .changeset/fix-openrouter-prediction-param.md
The converter omits prediction from generated options. Affected OpenRouter capability metadata and option mappings no longer include prediction. A patch changeset documents the update.

Grok model coverage

Layer / File(s)Summary
Supported Grok model test
packages/ai-grok/tests/grok-adapter.test.ts
The expected supported model list now includes grok-4.5 and grok-4.6.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk:⚪ Minimal · up to 50d1b

The change removes an unsupported OpenRouter option from generated metadata and updates the affected model-list expectation; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers:alemtuzlak

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and concisely describes the primary OpenRouter change: excluding the unsupported prediction parameter.
Description check✅ PassedThe description explains the cause and fixes, completes the required checklist, and documents the published-code release impact.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/openrouter-prediction-param

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloudBot commented Aug 18, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 50d1be0

CommandStatusDurationResult
nx run-many --targets=build --exclude=examples/...✅ Succeeded3sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-18 07:30:03 UTC

@pkg-pr-new

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@1135

@tanstack/ai-acp

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-acp@1135

@tanstack/ai-angular

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-angular@1135

@tanstack/ai-anthropic

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@1135

@tanstack/ai-bedrock

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-bedrock@1135

@tanstack/ai-byteplus

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-byteplus@1135

@tanstack/ai-claude-code

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-claude-code@1135

@tanstack/ai-client

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@1135

@tanstack/ai-code-mode

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode@1135

@tanstack/ai-code-mode-snippets

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode-snippets@1135

@tanstack/ai-codex

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-codex@1135

@tanstack/ai-cohere

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-cohere@1135

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@1135

@tanstack/ai-durable-stream

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-durable-stream@1135

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-elevenlabs@1135

@tanstack/ai-event-client

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-event-client@1135

@tanstack/ai-fal

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-fal@1135

@tanstack/ai-gemini

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@1135

@tanstack/ai-grok

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@1135

@tanstack/ai-grok-build

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok-build@1135

@tanstack/ai-groq

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-groq@1135

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-cloudflare@1135

@tanstack/ai-isolate-daytona

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-daytona@1135

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-node@1135

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs@1135

@tanstack/ai-isolate-quickjs-bun

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs-bun@1135

@tanstack/ai-mcp

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mcp@1135

@tanstack/ai-memory

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-memory@1135

@tanstack/ai-mistral

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mistral@1135

@tanstack/ai-ollama

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@1135

@tanstack/ai-openai

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@1135

@tanstack/ai-opencode

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-opencode@1135

@tanstack/ai-openrouter

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@1135

@tanstack/ai-perplexity

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-perplexity@1135

@tanstack/ai-persistence

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-persistence@1135

@tanstack/ai-preact

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@1135

@tanstack/ai-react

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@1135

@tanstack/ai-react-ui

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@1135

@tanstack/ai-sandbox

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox@1135

@tanstack/ai-sandbox-cloudflare

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-cloudflare@1135

@tanstack/ai-sandbox-daytona

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-daytona@1135

@tanstack/ai-sandbox-docker

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-docker@1135

@tanstack/ai-sandbox-local-process

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-local-process@1135

@tanstack/ai-sandbox-sprites

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-sprites@1135

@tanstack/ai-sandbox-vercel

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-vercel@1135

@tanstack/ai-solid

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@1135

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@1135

@tanstack/ai-svelte

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@1135

@tanstack/ai-utils

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-utils@1135

@tanstack/ai-vercel-gateway

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vercel-gateway@1135

@tanstack/ai-vue

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@1135

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@1135

@tanstack/openai-base

npm i https://pkg.pr.new/TanStack/ai/@tanstack/openai-base@1135

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@1135

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@1135

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@1135

commit: 50d1be0

@AlemTuzlak
AlemTuzlak merged commit fe42d82 into mainAug 18, 2026
9 checks passed
@AlemTuzlak
AlemTuzlak deleted the fix/openrouter-prediction-param branch August 18, 2026 08:39
@github-actionsgithub-actionsBot mentioned this pull request Aug 18, 2026
Sign up for freeto 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.

2 participants

@tombeckenham@AlemTuzlak