add gpt 5.2 models to model meta #166
main fromrefs/pull/166/head·merged by AlemTuzlak View on GitHub🎯 Changes#
Adds gpt5.2 models
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested this code locally with
pnpm run test:pr.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Summary by CodeRabbit#
Release Notes#
- New Features
- Added support for three new OpenAI GPT‑5.2 models (standard, Pro, and Chat) with full chat availability, extended context windows, updated token limits, and comprehensive input/output modality support.
- Chores
- Published a changeset marking a patch release to roll out GPT‑5.2 support.
- 1
View your CI Pipeline Execution ↗ for commit c885dd6bc138cbccc2e2d2d5e98571bd15e6b843
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 1m 6s View ↗ nx run-many --targets=build --exclude=examples/**✅ Succeeded 37s View ↗
☁️ Nx Cloud last updated this comment at
2025-12-20 14:32:49UTC@tanstack/ai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@166@tanstack/ai-anthropic
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@166@tanstack/ai-client
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@166@tanstack/ai-devtools-core
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@166@tanstack/ai-gemini
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@166@tanstack/ai-ollama
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@166@tanstack/ai-openai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@166@tanstack/ai-react
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@166@tanstack/ai-react-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@166@tanstack/ai-solid
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@166@tanstack/ai-solid-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@166@tanstack/ai-svelte
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@166@tanstack/ai-vue
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@166@tanstack/ai-vue-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@166@tanstack/react-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@166@tanstack/solid-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@166commit:
c885dd6Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/typescript/ai-openai/src/model-meta.ts (1)
135-162: Consider addingOpenAIToolsOptionsfor consistency withfunction_callingsupport.The model includes
function_callingin features but omitsOpenAIToolsOptionsfrom provider options. Compare withGPT_5_1_CHAT(lines 1560-1567), which has the samefunction_callingfeature but includesOpenAIToolsOptions.If users can call custom tools via
function_calling, they may need access totool_choice,parallel_tool_calls, andmax_tool_callsoptions.🔎 Suggested fix
} as const satisfies ModelMeta< OpenAIBaseOptions & OpenAIReasoningOptions & OpenAIStructuredOutputOptions & + OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions >Also update the type mapping at lines 1769-1773:
[GPT5_2_CHAT.name]: OpenAIBaseOptions & OpenAIReasoningOptions & OpenAIStructuredOutputOptions & + OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 254b248e2c7dd1f23556b6a22163da40ca0d0f51 and d691a44aad052bf8ce1a386ab2bc2ff1c717cbde.
📒 Files selected for processing (1)
packages/typescript/ai-openai/src/model-meta.ts(4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use tree-shakeable adapter architecture for provider implementations - export specialized adapters (text, embedding, summarize, image) as separate imports from/adapterssubpath rather than monolithic adapters Use Zod for runtime schema validation and type inference, particularly for tool input/output definitions withtoolDefinition()and Zod schema inference Implement isomorphic tool system usingtoolDefinition()with.server()and.client()implementations for dual-environment execution Use type-safe per-model configuration with provider options typed based on selected model to ensure compile-time safety Implement stream processing with StreamProcessor for handling chunked responses and support partial JSON parsing for streaming AI responsesFiles:
packages/typescript/ai-openai/src/model-meta.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use camelCase for function and variable names throughout the codebase
Files:
packages/typescript/ai-openai/src/model-meta.ts
packages/typescript/*/src/model-meta.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Maintain model metadata files that define provider options and capabilities per model for per-model type safety
Files:
packages/typescript/ai-openai/src/model-meta.ts
🧠 Learnings (2)
📚 Learning: 2025-12-13T17:09:09.794Z
Learnt from: CR Repo: TanStack/ai PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-13T17:09:09.794Z Learning: Applies to packages/typescript/*/src/model-meta.ts : Maintain model metadata files that define provider options and capabilities per model for per-model type safetyApplied to files:
packages/typescript/ai-openai/src/model-meta.ts
📚 Learning: 2025-12-13T17:09:09.794Z
Learnt from: CR Repo: TanStack/ai PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-13T17:09:09.794Z Learning: Applies to **/*.{ts,tsx} : Use type-safe per-model configuration with provider options typed based on selected model to ensure compile-time safetyApplied to files:
packages/typescript/ai-openai/src/model-meta.ts
🧬 Code graph analysis (1)
packages/typescript/ai-openai/src/model-meta.ts (1)
packages/typescript/ai-openai/src/text/text-provider-options.ts (6)
OpenAIBaseOptions(17-125)OpenAIReasoningOptions(136-156)OpenAIStructuredOutputOptions(184-190)OpenAIToolsOptions(192-213)OpenAIStreamingOptions(215-225)OpenAIMetadataOptions(227-235)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (4)
packages/typescript/ai-openai/src/model-meta.ts (4)
107-133: LGTM!The GPT5_2_PRO model definition is internally consistent. The provider options correctly omit
OpenAIStructuredOutputOptionssincestructured_outputsis not in the features array.
1648-1652: LGTM!The new models are correctly added to the
OPENAI_CHAT_MODELSarray under the "Frontier models" section.
1762-1778: Type mappings are consistent with model definitions.The provider options type mappings for the three new models correctly mirror their respective
ModelMetatype parameters. Note that ifOpenAIToolsOptionsis added toGPT5_2_CHATper the earlier suggestion, this mapping should be updated accordingly.
1947-1950: LGTM!The input modalities type mappings correctly reference the
supports.inputarrays from the new model constants.@@ -66,0 +86,21 @@86+ 'code_interpreter',87+ 'mcp',88+ ],89+ },90+ pricing: {91+ input: {92+ normal: 1.75,93+ cached: 0.175,94+ },95+ output: {96+ normal: 14,97+ },98+ },99+} as const satisfies ModelMeta<100+ OpenAIBaseOptions &101+ OpenAIReasoningOptions &102+ OpenAIStructuredOutputOptions &103+ OpenAIToolsOptions &104+ OpenAIStreamingOptions &105+ OpenAIMetadataOptions106+>⚠️ Potential issue | 🔴 Critical
Update knowledge_cutoff date for GPT-5.2 from 2024-08-31 to 2025-08-31.
The model identifier
gpt-5.2matches OpenAI's API correctly. However, the knowledge cutoff should reflect August 31, 2025, not August 31, 2024.🤖 Prompt for AI Agents
In packages/typescript/ai-openai/src/model-meta.ts around lines 67 to 106, the GPT5_2 entry has an incorrect knowledge_cutoff value; change knowledge_cutoff from '2024-08-31' to '2025-08-31' preserving the surrounding object shape and type assertion so the ModelMeta typing remains valid.Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/typescript/ai-openai/src/model-meta.ts (1)
135-162: Consider addingOpenAIToolsOptionssincefunction_callingis supported.The model has
function_callingin features (line 144) but the type assertion omitsOpenAIToolsOptions. Even with an emptytoolsarray, users can still define custom tools and would benefit from options liketool_choice,max_tool_calls, andparallel_tool_calls.For comparison,
GPT_5_1_CHAT(lines 1560-1567) includesOpenAIToolsOptionsdespite having no built-in tools.🔎 Proposed fix
} as const satisfies ModelMeta< OpenAIBaseOptions & OpenAIReasoningOptions & OpenAIStructuredOutputOptions & + OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions >Also update the corresponding entry in
OpenAIChatModelProviderOptionsByName(lines 1769-1773) to includeOpenAIToolsOptions.📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between d691a44aad052bf8ce1a386ab2bc2ff1c717cbde and 0a13988d75385e24f7a3eb32a2a6488589f94359.
📒 Files selected for processing (2)
.changeset/spotty-tables-drum.md(1 hunks)packages/typescript/ai-openai/src/model-meta.ts(4 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changeset/spotty-tables-drum.md
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use tree-shakeable adapter architecture for provider implementations - export specialized adapters (text, embedding, summarize, image) as separate imports from/adapterssubpath rather than monolithic adapters Use Zod for runtime schema validation and type inference, particularly for tool input/output definitions withtoolDefinition()and Zod schema inference Implement isomorphic tool system usingtoolDefinition()with.server()and.client()implementations for dual-environment execution Use type-safe per-model configuration with provider options typed based on selected model to ensure compile-time safety Implement stream processing with StreamProcessor for handling chunked responses and support partial JSON parsing for streaming AI responsesFiles:
packages/typescript/ai-openai/src/model-meta.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use camelCase for function and variable names throughout the codebase
Files:
packages/typescript/ai-openai/src/model-meta.ts
packages/typescript/*/src/model-meta.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Maintain model metadata files that define provider options and capabilities per model for per-model type safety
Files:
packages/typescript/ai-openai/src/model-meta.ts
🧠 Learnings (2)
📚 Learning: 2025-12-13T17:09:09.794Z
Learnt from: CR Repo: TanStack/ai PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-13T17:09:09.794Z Learning: Applies to packages/typescript/*/src/model-meta.ts : Maintain model metadata files that define provider options and capabilities per model for per-model type safetyApplied to files:
packages/typescript/ai-openai/src/model-meta.ts
📚 Learning: 2025-12-13T17:09:09.794Z
Learnt from: CR Repo: TanStack/ai PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-13T17:09:09.794Z Learning: Applies to **/*.{ts,tsx} : Use type-safe per-model configuration with provider options typed based on selected model to ensure compile-time safetyApplied to files:
packages/typescript/ai-openai/src/model-meta.ts
🧬 Code graph analysis (1)
packages/typescript/ai-openai/src/model-meta.ts (1)
packages/typescript/ai-openai/src/text/text-provider-options.ts (6)
OpenAIBaseOptions(17-125)OpenAIReasoningOptions(136-156)OpenAIStructuredOutputOptions(184-190)OpenAIToolsOptions(192-213)OpenAIStreamingOptions(215-225)OpenAIMetadataOptions(227-235)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (5)
packages/typescript/ai-openai/src/model-meta.ts (5)
107-133: LGTM!The PRO variant follows established patterns: higher pricing (~12x), no cached pricing tier, and type assertion correctly excludes
OpenAIStructuredOutputOptionssincestructured_outputsis not in features.
1650-1652: LGTM!The new models are correctly placed at the top of the frontier models section, maintaining the pattern of listing newer models first.
1763-1778: Type mappings are consistent with model definitions.The type entries correctly mirror each model's type assertion. Note: If
OpenAIToolsOptionsis added toGPT5_2_CHAT's model definition as suggested above, this entry (lines 1769-1773) should also be updated accordingly.
1948-1950: LGTM!The input modality mappings correctly use
typeofto reference each model'ssupports.input, ensuring type-safe consistency with the model definitions.
67-106: Verify PRO model pricing and API compatibility.GPT-5.2 is priced at $1.75/1M input tokens and $14/1M output tokens, which differs from the pricing comment's suggestion of a 12x premium. More critically, GPT-5.2 pro is available in the Responses API only, not Chat Completions API. If GPT5_2_PRO is listed in OPENAI_CHAT_MODELS, remove it or ensure it's correctly restricted to Responses API use only. Confirm the PRO variant pricing in the code matches the official API rates.
⛔ Skipped due to learnings
Learnt from: CR Repo: TanStack/ai PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-13T17:09:09.794Z Learning: Applies to packages/typescript/*/src/model-meta.ts : Maintain model metadata files that define provider options and capabilities per model for per-model type safetyjherr approved these changes
AlemTuzlak merged this2615fd7
AlemTuzlak closed this
Sign in to join this conversation.
Warning
Rate limit exceeded#
@AlemTuzlak has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 25 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📥 Commits
Reviewing files that changed from the base of the PR and between 0a13988d75385e24f7a3eb32a2a6488589f94359 and c885dd6bc138cbccc2e2d2d5e98571bd15e6b843.
📒 Files selected for processing (1)
packages/typescript/ai-openai/src/model-meta.ts(4 hunks)Walkthrough#
Adds three GPT-5.2 family models (GPT5_2, GPT5_2_PRO, GPT5_2_CHAT) with full metadata and type assertions; updates the chat-model list and extends type mappings for provider options and input modalities. Also adds a changeset entry announcing support for gpt 5.2.
Changes#
packages/typescript/ai-openai/src/model-meta.tsGPT5_2,GPT5_2_PRO,GPT5_2_CHATmodel metadata objects (name, context_window, max_output_tokens, knowledge_cutoff, supports, pricing) usingas const satisfies ModelMeta<...>. Inserts their names intoOPENAI_CHAT_MODELS. ExtendsOpenAIChatModelProviderOptionsByNameandOpenAIModelInputModalitiesByNamewith entries for the three models..changeset/spotty-tables-drum.md@tanstack/ai-openaiwith description "add support for gpt 5.2 models". No code changes beyond metadata/types.Estimated code review effort#
🎯 2 (Simple) | ⏱️ ~10 minutes
model-meta.tsadditions for consistent structure and correct use ofsatisfies ModelMeta<...>.OPENAI_CHAT_MODELSinsertion order and any runtime assumptions relying on that list.OpenAIChatModelProviderOptionsByName,OpenAIModelInputModalitiesByName) compile and map to the rightsupportsshapes..changesetfor accuracy of release note.Poem#
Pre-merge checks and finishing touches#
✅ Passed checks (3 passed)
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