Skip to content

realtime 2.1 support - #142

Merged
tleyden merged 1 commit into
mainfrom
latest_realtime_model
Jul 12, 2026
Merged

realtime 2.1 support#142
tleyden merged 1 commit into
mainfrom
latest_realtime_model

Conversation

@tleyden

@tleyden tleyden commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added support for selecting the GPT Realtime 2.1 model.
    • Saved preferences now recognize the new model option.
    • Usage costs are calculated using the appropriate pricing for GPT Realtime 2.1.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds gpt-realtime-2.1 to realtime model selection and persisted preference validation, and registers its token and audio pricing for usage cost calculation.

Changes

Realtime model support

Layer / File(s) Summary
Model preference support
lib/realtimeModelPreference.ts
Adds gpt-realtime-2.1 to the exported model type, selectable options, and runtime validation.
Token pricing support
lib/tokenUsageTracker.ts
Adds the new model to priced-model typing and registers its input, cached-input, output, and audio rates.

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

Possibly related PRs

  • tleyden/arty#139: Earlier realtime model plumbing changes that this PR extends for gpt-realtime-2.1.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding support for the realtime 2.1 model.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch latest_realtime_model

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.

@github-actions

Copy link
Copy Markdown

OSSF Scorecard (PR vs base)

  • Base score: 4.4
  • PR score: 4.4
  • Change: 0.00 (unchanged)

@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.

🧹 Nitpick comments (1)
lib/realtimeModelPreference.ts (1)

33-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider deriving isRealtimeModel from REALTIME_MODEL_OPTIONS to avoid duplication.

The model ID "gpt-realtime-2.1" now appears in the RealtimeModel type, the REALTIME_MODEL_OPTIONS array, and the isRealtimeModel type guard — all manually synchronized. If a future model is added to the type or options but the type guard is missed, loadRealtimeModelPreference will silently fall back to the default for that model. Deriving the check from the options array eliminates this risk.

♻️ Proposed refactor
-const isRealtimeModel = (value: string): value is RealtimeModel =>
-  value === "gpt-realtime" ||
-  value === "gpt-realtime-2" ||
-  value === "gpt-realtime-2.1";
+const VALID_MODELS = REALTIME_MODEL_OPTIONS.map((o) => o.value) as readonly string[];
+const isRealtimeModel = (value: string): value is RealtimeModel =>
+  (VALID_MODELS as readonly string[]).includes(value);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/realtimeModelPreference.ts` around lines 33 - 36, Update isRealtimeModel
to derive membership from REALTIME_MODEL_OPTIONS instead of manually listing
model IDs, ensuring the type guard stays synchronized with the available
realtime model options and loadRealtimeModelPreference accepts newly added
models.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lib/realtimeModelPreference.ts`:
- Around line 33-36: Update isRealtimeModel to derive membership from
REALTIME_MODEL_OPTIONS instead of manually listing model IDs, ensuring the type
guard stays synchronized with the available realtime model options and
loadRealtimeModelPreference accepts newly added models.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 86890309-3a64-4332-a87c-631140a05365

📥 Commits

Reviewing files that changed from the base of the PR and between 969da37 and 3cfd173.

📒 Files selected for processing (2)
  • lib/realtimeModelPreference.ts
  • lib/tokenUsageTracker.ts

@tleyden
tleyden merged commit 2b07782 into main Jul 12, 2026
9 checks passed
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.

1 participant