Skip to content

feat(ai): add GPT-5.2 models support - #181

Merged
2witstudios merged 5 commits into
masterfrom
claude/add-gpt-5.2-models-8hYp2
Jan 12, 2026
Merged

2witstudios merged 5 commits into
masterfrom
claude/add-gpt-5.2-models-8hYp2

Conversation

@2witstudios

@2witstudios 2witstudios commented Jan 12, 2026 •

Copy link
Copy Markdown
Owner

Add GPT-5.2 model family to PageSpace AI providers:

  • gpt-5.2, gpt-5.2-codex, gpt-5.2-mini (OpenAI direct)
  • openai/gpt-5.2, openai/gpt-5.2-codex, openai/gpt-5.2-mini (OpenRouter)

Includes vision capabilities, pricing ($12/$48 per 1M tokens for full model), and context windows (500k tokens for full models, 256k for mini).

Summary by CodeRabbit

  • New Features
    • Added GPT-5.2 family (gpt-5.2, gpt-5.2-codex, gpt-5.2-mini, gpt-5.2-nano) across provider listings and made them available via OpenAI and OpenRouter.
    • Extended vision-capability coverage to include GPT-5.2 and additional GPT-5.1 aliases.
  • Chores
    • Updated pricing and context-window configurations and added explicit context-window handling for GPT-5.2 / GPT-5.1 variants.

✏️ Tip: You can customize this high-level summary in your review settings.

Add GPT-5.2 model family to PageSpace AI providers:
- gpt-5.2, gpt-5.2-codex, gpt-5.2-mini (OpenAI direct)
- openai/gpt-5.2, openai/gpt-5.2-codex, openai/gpt-5.2-mini (OpenRouter)

Includes vision capabilities, pricing ($12/$48 per 1M tokens for full model),
and context windows (500k tokens for full models, 256k for mini).
@coderabbitai

coderabbitai Bot commented Jan 12, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 42 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command 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 54f4863 and 24144dd.

📒 Files selected for processing (1)
  • apps/web/src/lib/ai/core/ai-providers-config.ts
📝 Walkthrough

Walkthrough

Adds GPT-5.2 family model keys across provider configs, marks GPT-5.2/GPT-5.1 aliases as vision-capable, and extends monitoring/pricing and context-window constants plus context-window selection logic for GPT-5.2 and GPT-5.1.

Changes

Cohort / File(s) Summary
AI Provider Configuration
apps/web/src/lib/ai/core/ai-providers-config.ts
Added GPT-5.2 family model keys (gpt-5.2, gpt-5.2-codex, gpt-5.2-mini, gpt-5.2-nano) in OpenAI listings and corresponding openai/... entries in OpenRouter models.
Vision Capability Registry
apps/web/src/lib/ai/core/model-capabilities.ts
Added GPT-5.2 family aliases (and additional GPT-5.1 aliases) to VISION_CAPABLE_MODELS, marking them as vision-capable.
Monitoring: Pricing & Context Windows
packages/lib/src/monitoring/ai-monitoring.ts
Extended AI_PRICING with GPT-5.2 family (both openai/... and direct gpt-5.2 variants). Added MODEL_CONTEXT_WINDOWS entries for GPT-5.2 family with context sizes (400000 tokens for full models, 256000 for mini/nano variants).
Context Window Selection Logic
packages/lib/src/monitoring/ai-context-calculator.ts
Inserted GPT-5.2 and GPT-5.1 branches before existing GPT-5 handling: GPT-5.2 → mini/nano = 256000, others = 400000; GPT-5.1 → 400000; preserved prior GPT-5.0 logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A hop for models, a twitch for code,
GPT‑5.2 joins the meadow road,
Mini, codex, nano, grand,
Tokens counted, mappings planned,
I nibble carrots, cheer the load.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(ai): add GPT-5.2 models support' accurately and concisely describes the main change—adding support for the GPT-5.2 model family across multiple provider configurations and capability tracking.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bcdc0d9e78

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +198 to +200
'openai/gpt-5.2': 500000,
'openai/gpt-5.2-codex': 500000,
'openai/gpt-5.2-mini': 256000,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align gpt-5.2 context sizing with calculator

The new GPT‑5.2 context windows are declared here, but the runtime sizing logic used by getContextWindowSize in packages/lib/src/monitoring/ai-context-calculator.ts still treats all gpt-5* models as 272k (or 128k for mini/nano). When a user selects gpt-5.2 or gpt-5.2-mini, calculateTotalContextSize will therefore flag truncation and/or trim messages earlier than necessary even though the model supports 500k/256k. This mismatch will only appear for GPT‑5.2 models, and it was introduced by adding these IDs without updating the calculator.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8bd930e and bcdc0d9.

📒 Files selected for processing (3)
  • apps/web/src/lib/ai/core/ai-providers-config.ts
  • apps/web/src/lib/ai/core/model-capabilities.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Use camelCase for variable and function names
Use UPPER_SNAKE_CASE for constants
Use PascalCase for type and enum names
Use kebab-case for filenames, except React hooks (camelCase with use prefix), Zustand stores (camelCase with use prefix), and React components (PascalCase)
Lint with Next/ESLint as configured in apps/web/eslint.config.mjs
Message content should always use the message parts structure with { parts: [{ type: 'text', text: '...' }] }
Use centralized permission functions from @pagespace/lib/permissions (e.g., getUserAccessLevel, canUserEditPage) instead of implementing permission logic locally
Always use Drizzle client from @pagespace/db package for database access
Use ESM modules throughout the codebase

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Write code that is explicit over implicit and self-documenting

Files:

  • apps/web/src/lib/ai/core/model-capabilities.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: React hook files should use camelCase matching the exported hook name (e.g., useAuth.ts)
Zustand store files should use camelCase with use prefix (e.g., useAuthStore.ts)

Files:

  • apps/web/src/lib/ai/core/model-capabilities.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Format code with Prettier

Files:

  • apps/web/src/lib/ai/core/model-capabilities.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
apps/web/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/src/**/*.{ts,tsx}: Use message parts structure for message content: { parts: [{ type: 'text', text: '...' }] }
For database access, always use Drizzle client from @pagespace/db: import { db, pages } from '@pagespace/db';
Use centralized Drizzle ORM with PostgreSQL for all database operations - no direct SQL or other ORMs
Use Socket.IO for real-time collaboration features - imported from the realtime service at port 3001
Use Vercel AI SDK with async/await for all AI operations and streaming
Use Next.js 15 App Router and TypeScript for all routes and components

Files:

  • apps/web/src/lib/ai/core/model-capabilities.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
**/*ai*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Vercel AI SDK for AI integrations

Files:

  • packages/lib/src/monitoring/ai-monitoring.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
🧠 Learnings (2)
📚 Learning: 2025-12-14T14:54:45.713Z
Learnt from: CR
Repo: 2witstudios/PageSpace PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-14T14:54:45.713Z
Learning: When adding AI providers, follow the integration pattern documented in `docs/3.0-guides-and-tools/adding-ai-provider.md`

Applied to files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
📚 Learning: 2025-12-22T20:04:40.910Z
Learnt from: CR
Repo: 2witstudios/PageSpace PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T20:04:40.910Z
Learning: Applies to **/*ai*.{ts,tsx} : Use Vercel AI SDK for AI integrations

Applied to files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
⏰ 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). (1)
  • GitHub Check: Unit Tests
🔇 Additional comments (4)
apps/web/src/lib/ai/core/model-capabilities.ts (1)

15-21: LGTM! GPT-5.2 vision capability entries are correctly added.

GPT-5.2 is a flagship-level reasoning model released in December 2025 by OpenAI with computer vision capabilities. The vision-capable entries for both direct OpenAI and OpenRouter-prefixed variants are appropriately included.

packages/lib/src/monitoring/ai-monitoring.ts (1)

198-200: Context window entries added correctly.

The 500k token context for full models and 256k for mini variant matches the PR description and maintains consistency between OpenRouter and OpenAI Direct sections.

Also applies to: 274-276

apps/web/src/lib/ai/core/ai-providers-config.ts (2)

25-27: OpenRouter GPT-5.2 model entries added correctly.

The entries follow the established pattern for OpenRouter models with the openai/ prefix and appropriate display names.


166-170: OpenAI direct GPT-5.2 model entries added correctly.

The entries are well-organized with a section comment and follow the same pattern as the existing GPT-5.1 entries. All three variants (base, codex, mini) are consistently added across:

  • Provider configuration (this file)
  • Vision capabilities (model-capabilities.ts)
  • Pricing and context windows (ai-monitoring.ts)

Based on learnings, this follows the documented integration pattern for adding AI providers.

Comment thread packages/lib/src/monitoring/ai-monitoring.ts Outdated
- Fix ai-context-calculator.ts to properly detect GPT-5.2 models
  (500k for full models, 256k for mini) instead of falling through
  to generic GPT-5 logic (272k/128k)
- Update pricing to official OpenAI rates: $1.75/$14.00 per 1M tokens
  for GPT-5.2/codex, $0.35/$2.80 for mini variant

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/lib/src/monitoring/ai-context-calculator.ts:
- Around line 142-152: The GPT-5.2 branch currently returns 500_000 tokens but
the correct full-model context window is 400_000; change the return in the
modelLower.includes('gpt-5.2') block from 500_000 to 400_000, keep the mini
branch returning 256_000, and add a check for a 'nano' variant
(modelLower.includes('nano')) mirroring how GPT-5.0 is handled so the GPT-5.2
branch treats 'mini' and 'nano' consistently with the rest of the calculator
logic.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bcdc0d9 and efeddca.

📒 Files selected for processing (2)
  • packages/lib/src/monitoring/ai-context-calculator.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/lib/src/monitoring/ai-monitoring.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Use camelCase for variable and function names
Use UPPER_SNAKE_CASE for constants
Use PascalCase for type and enum names
Use kebab-case for filenames, except React hooks (camelCase with use prefix), Zustand stores (camelCase with use prefix), and React components (PascalCase)
Lint with Next/ESLint as configured in apps/web/eslint.config.mjs
Message content should always use the message parts structure with { parts: [{ type: 'text', text: '...' }] }
Use centralized permission functions from @pagespace/lib/permissions (e.g., getUserAccessLevel, canUserEditPage) instead of implementing permission logic locally
Always use Drizzle client from @pagespace/db package for database access
Use ESM modules throughout the codebase

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Write code that is explicit over implicit and self-documenting

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: React hook files should use camelCase matching the exported hook name (e.g., useAuth.ts)
Zustand store files should use camelCase with use prefix (e.g., useAuthStore.ts)

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Format code with Prettier

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
**/*ai*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Vercel AI SDK for AI integrations

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
⏰ 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). (1)
  • GitHub Check: Unit Tests

Comment thread packages/lib/src/monitoring/ai-context-calculator.ts Outdated
- Update full GPT-5.2 models from 500k to 400k context window
- Add nano variant handling to GPT-5.2 branch for consistency
- Update MODEL_CONTEXT_WINDOWS in ai-monitoring.ts to match
Add gpt-5.2-nano model to all configuration files:
- ai-providers-config.ts: model list
- model-capabilities.ts: vision support
- ai-monitoring.ts: pricing ($0.07/$0.56) and context window (256k)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @apps/web/src/lib/ai/core/ai-providers-config.ts:
- Around line 25-27: The OpenRouter paid models mapping is missing the
'openai/gpt-5.2-nano' entry; add a key/value pair for 'openai/gpt-5.2-nano'
(label it e.g. 'GPT-5.2 Nano') alongside the existing 'openai/gpt-5.2',
'openai/gpt-5.2-codex', and 'openai/gpt-5.2-mini' entries in the same exported
models object in ai-providers-config.ts so the OpenRouter list matches the
direct OpenAI models and VISION_CAPABLE_MODELS references.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efeddca and 54f4863.

📒 Files selected for processing (4)
  • apps/web/src/lib/ai/core/ai-providers-config.ts
  • apps/web/src/lib/ai/core/model-capabilities.ts
  • packages/lib/src/monitoring/ai-context-calculator.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Use camelCase for variable and function names
Use UPPER_SNAKE_CASE for constants
Use PascalCase for type and enum names
Use kebab-case for filenames, except React hooks (camelCase with use prefix), Zustand stores (camelCase with use prefix), and React components (PascalCase)
Lint with Next/ESLint as configured in apps/web/eslint.config.mjs
Message content should always use the message parts structure with { parts: [{ type: 'text', text: '...' }] }
Use centralized permission functions from @pagespace/lib/permissions (e.g., getUserAccessLevel, canUserEditPage) instead of implementing permission logic locally
Always use Drizzle client from @pagespace/db package for database access
Use ESM modules throughout the codebase

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Write code that is explicit over implicit and self-documenting

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
  • apps/web/src/lib/ai/core/model-capabilities.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: React hook files should use camelCase matching the exported hook name (e.g., useAuth.ts)
Zustand store files should use camelCase with use prefix (e.g., useAuthStore.ts)

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
  • apps/web/src/lib/ai/core/model-capabilities.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Format code with Prettier

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
  • apps/web/src/lib/ai/core/model-capabilities.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
**/*ai*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Vercel AI SDK for AI integrations

Files:

  • packages/lib/src/monitoring/ai-context-calculator.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
  • packages/lib/src/monitoring/ai-monitoring.ts
apps/web/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/src/**/*.{ts,tsx}: Use message parts structure for message content: { parts: [{ type: 'text', text: '...' }] }
For database access, always use Drizzle client from @pagespace/db: import { db, pages } from '@pagespace/db';
Use centralized Drizzle ORM with PostgreSQL for all database operations - no direct SQL or other ORMs
Use Socket.IO for real-time collaboration features - imported from the realtime service at port 3001
Use Vercel AI SDK with async/await for all AI operations and streaming
Use Next.js 15 App Router and TypeScript for all routes and components

Files:

  • apps/web/src/lib/ai/core/model-capabilities.ts
  • apps/web/src/lib/ai/core/ai-providers-config.ts
🧠 Learnings (2)
📚 Learning: 2025-12-14T14:54:45.713Z
Learnt from: CR
Repo: 2witstudios/PageSpace PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-14T14:54:45.713Z
Learning: When adding AI providers, follow the integration pattern documented in `docs/3.0-guides-and-tools/adding-ai-provider.md`

Applied to files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
📚 Learning: 2025-12-22T20:04:40.910Z
Learnt from: CR
Repo: 2witstudios/PageSpace PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T20:04:40.910Z
Learning: Applies to **/*ai*.{ts,tsx} : Use Vercel AI SDK for AI integrations

Applied to files:

  • packages/lib/src/monitoring/ai-monitoring.ts
⏰ 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: Lint & TypeScript Check
  • GitHub Check: Unit Tests
🔇 Additional comments (7)
packages/lib/src/monitoring/ai-monitoring.ts (4)

24-27: LGTM! GPT-5.2 OpenRouter pricing entries are complete and consistent.

All four GPT-5.2 variants (base, codex, mini, nano) are added with appropriate pricing tiers.


97-101: LGTM! OpenAI Direct pricing entries mirror OpenRouter entries correctly.

The pricing values are consistent across both provider sections, ensuring accurate cost calculations regardless of the access path.


200-203: LGTM! Context window sizes align with PR specifications.

The 400k tokens for full models and 256k for mini/nano variants are correctly applied to OpenRouter entries.


277-280: LGTM! OpenAI Direct context windows match OpenRouter entries.

Context window consistency is maintained across both provider sections.

packages/lib/src/monitoring/ai-context-calculator.ts (1)

142-152: LGTM! Context window logic correctly handles GPT-5.2 and GPT-5.1 model families.

The ordering is correct—checking gpt-5.2 and gpt-5.1 before the generic gpt-5 branch ensures proper matching. The mini/nano distinction for GPT-5.2 (256k vs 400k) aligns with the MODEL_CONTEXT_WINDOWS constants.

apps/web/src/lib/ai/core/model-capabilities.ts (1)

15-30: LGTM! Vision capability entries are comprehensive for GPT-5.2 and GPT-5.1 families.

All variants are explicitly registered with both direct model IDs and openai/ prefixed versions. The fallback logic at line 122 (gpt-5 pattern) provides additional coverage for any variants not explicitly listed.

apps/web/src/lib/ai/core/ai-providers-config.ts (1)

166-170: LGTM! OpenAI direct model entries are complete.

All four GPT-5.2 variants (base, codex, mini, nano) are properly registered with appropriate display names.

Comment thread apps/web/src/lib/ai/core/ai-providers-config.ts
@2witstudios
2witstudios merged commit c6b3057 into master Jan 12, 2026
3 checks passed
@2witstudios
2witstudios deleted the claude/add-gpt-5.2-models-8hYp2 branch January 29, 2026 02:29
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.

2 participants