Repository navigation
fix(ai-openrouter): add GPT-6.1 Terra reasoning levels - #2343
Closed
adamkasper wants to merge 1 commit into
Closed
adamkasper wants to merge 1 commit into
adamkasper wants to merge 1 commit into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
🦋 Changeset detectedLatest commit: 62f081d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
6 of 7 tasks
Author
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.
chat({ reasoning })has no effect for GPT-6.1 Terra on OpenRouter. The adapter sends noreasoningfield, and the types reject every level. This PR adds the levels that OpenRouter lists foropenai/gpt-6.1-terra,openai/gpt-6.1-terra-pro, and their:batchids.🎯 Changes
model-meta.ts: Terra and Terra batch getofftomax(EFFORT_NONE_LOW_TO_MAX). Terra Pro and Terra Pro batch getlowtomax(EFFORT_LOW_TO_MAX). All four ids are now inOPENROUTER_REASONING.off. Terra Pro acceptsmaxand rejectsoff.terracase inopenrouter-reasoning-wire.spec.tschecks that the request hasreasoning: { effort: 'low' }.@tanstack/ai-openrouter.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
Root cause
Issue. For the four Terra ids,
chat({ reasoning })is a type error. At runtime, the adapter sends noreasoningfield, so OpenRouter uses its default effort (medium).Cause. The four ids have no entry in
OPENROUTER_MODEL_REASONING.resolveReasoning()inadapters/text.tsgetsundefinedand returns no effort. The daily sync does not add the entry, becausescripts/convert-openrouter-models.tsonly copies the shapes thatmodel-meta.tsalready has.Fix. Add the four entries with the efforts from the OpenRouter catalog. The types and the request path read the same map, so both now work.
Possible alternatives
Test plan
Commands run
NX_BASE=origin/main pnpm test:pr: passed.pnpm --filter @tanstack/ai-e2e test:e2e --workers=1: 868 passed, 4 skipped.pnpm --filter @tanstack/ai-e2e test:e2e tests/openrouter-reasoning-wire.spec.ts: onmainwith only the test changes of this PR, theterracase fails (Expected: {"effort": "low"},Received: undefined). On this branch, all three cases pass.main(a7501eb0a) and on this branch. The script callschat({ reasoning })with every level that the catalog lists, and records thereasoning.effortof the request.main:This branch:
Repro script (
node repro.mjs <checkout>, afterpnpm build)Manual test
main, runpnpm build, then run the script above. Every level shows(missing).pnpm build, then run the script again. Every level is sent.How this PR makes testing easy: the type test and the E2E
terracase are on the branch. CI runs both.Risk / rollback
Low risk. Only the four Terra ids change. A call without
reasoningsends the same request as before. To undo, revert this PR.Public API change
Before
After