Skip to content

Grok 4.5 with variants - #4

Merged
RawToast merged 3 commits into
masterfrom
grok
Jul 16, 2026
Merged

Grok 4.5 with variants#4
RawToast merged 3 commits into
masterfrom
grok

Conversation

@RawToast

@RawToast RawToast commented Jul 16, 2026

Copy link
Copy Markdown
Owner

What this PR does

Adds support for Grok 4.5 and its six named variants (base, fast, low-effort, low-fast, high-effort, high-fast) across the local-agent bridge and worker model catalog. The bridge normalizes public ids (including legacy grok-4-5 and cursorapi/… prefixes) and maps each variant to an SDK model selection with fast and optional effort parameters. The worker exposes the new variants in its model list and registers pricing entries sourced from the Cursor Grok 4.5 pricing page.

Repository owner deleted a comment from coderabbitai Bot Jul 16, 2026
@RawToast

Copy link
Copy Markdown
Owner Author

@kanri-san review

@kanri-san

kanri-san Bot commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Adds support for Grok 4.5 and its six named variants (base, fast, low-effort, low-fast, high-effort, high-fast) across the local-agent bridge and worker model catalog. The bridge normalizes public ids (including legacy grok-4-5 and cursorapi/… prefixes) and maps each variant to an SDK model selection with fast and optional effort parameters. The worker exposes the new variants in its model list and registers pricing entries sourced from the Cursor Grok 4.5 pricing page.

Changes

File Change Reason
scripts/cursor-sdk-local-agent-bridge.mjs Introduces GROK_45_VARIANTS table, normalizeGrok45Model (handles legacy grok-4-5 notation and prefix stripping) and grok45SdkModelSelection, and wires them into normalizeModel and sdkModelSelection. Lets callers request Grok 4.5 variants by public id and forwards correctly shaped fast/effort params to the Cursor SDK create/send options.
scripts/tests/cursor-sdk-local-agent-bridge.test.mjs Adds coverage for canonical Grok 4.5 normalization (including grok-4-5-low legacy form and prefixed ids) and asserts the SDK model selection params for all six variants across create and send options. Locks in the variant-to-SDK-param mapping so future regressions are caught.
worker/openai.ts Adds CURSOR_GROK_4_5_PRICING_SOURCE and six CURSOR_MODEL_PRICING entries (standard $2/$6, fast $4/$18) plus six matching modelItem entries in the modelList response. Exposes Grok 4.5 variants to clients of the worker's OpenAI-compatible model list and attaches accurate pricing metadata.
worker/tests/index.test.ts Extends the model list assertion to expect all six Grok 4.5 variant entries. Guards the new model catalog additions against accidental removal or rename.

Walkthrough by kanri

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

Issues

1. worker/cursor.ts resolveCursorModel normalizes Composer hyphenated aliases (e...

Location: worker/cursor.ts:64

Severity: warning

worker/cursor.ts resolveCursorModel normalizes Composer hyphenated aliases (e.g., composer-2-5-fast → composer-2.5-fast) but has no equivalent Grok 4.5 alias handling. A request with model=grok-4-5-fast falls through to return { id: model.trim() }, so the chat route sends the raw hyphenated id to the Cursor API and the cost path computes cost from the raw hyphenated string, omitting the cost field. Add Grok 4.5 alias normalization to resolveCursorModel and ensure cost/pricing lookups handle the aliases.

Verdict

Status: APPROVED

No critical defects found. The bridge and model list are consistent, but worker/cursor.ts needs the same Grok 4.5 alias normalization to avoid sending raw hyphenated ids to the Cursor API and omitting cost on SDK responses. The model-list test should also verify per-variant costs.

2 findings below min severity (warning) were omitted from posting.

The effective status was recalculated from current findings and prior Kanri threads: APPROVED.

Inline comments: 1


Reviewed by kanri | 1 new inline comments

expect.objectContaining({ id: "gpt-5.3-codex" }),
expect.objectContaining({ id: "gemini-3.1-pro" }),
expect.objectContaining({ id: "default" }),
expect.objectContaining({ id: "grok-4.5" }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING

The new /v1/models test only asserts that each Grok 4.5 variant id is present; it does not verify the per-variant cost field (e.g., grok-4.5 at 2/6 vs grok-4.5-fast at 4/18). A pricing regression such as copying the fast price to all variants would pass. Add cost assertions for each Grok 4.5 variant and include cost in the body type annotation.

Fix with AI
Verify the issue still exists before applying this fix.

The new /v1/models test only asserts that each Grok 4.5 variant id is present; it does not verify the per-variant cost field (e.g., grok-4.5 at 2/6 vs grok-4.5-fast at 4/18). A pricing regression such as copying the fast price to all variants would pass. Add cost assertions for each Grok 4.5 variant and include cost in the body type annotation.

In worker/__tests__/index.test.ts, inside the 'requires a bearer token for /v1/models' it block, after the existing arrayContaining assertion, add explicit per-id cost assertions: expect(body.data.find((m) => m.id === 'grok-4.5')?.cost).toEqual({ input: 2, output: 6 }); expect(body.data.find((m) => m.id === 'grok-4.5-fast')?.cost).toEqual({ input: 4, output: 18 }); expect(body.data.find((m) => m.id === 'grok-4.5-low')?.cost).toEqual({ input: 2, output: 6 }); expect(body.data.find((m) => m.id === 'grok-4.5-high')?.cost).toEqual({ input: 2, output: 6 }); expect(body.data.find((m) => m.id === 'grok-4.5-low-fast')?.cost).toEqual({ input: 4, output: 18 }); expect(body.data.find((m) => m.id === 'grok-4.5-high-fast')?.cost).toEqual({ input: 4, output: 18 }). Extend the body type annotation to include cost?: { input: number; output: number }.

Resolve legacy grok-4-5 ids in resolveCursorModel and pricing lookups,
and assert per-variant Grok 4.5 costs in the model list test.
@kanri-san

kanri-san Bot commented Jul 16, 2026

Copy link
Copy Markdown

Status: COMMENTED

The unresolved finding C2 has been fixed; no new issues remain in the recent changes.

The effective status was recalculated from current findings and prior Kanri threads: COMMENTED.

No inline comments on the diff.

Walkthrough summary/changes preserved from an earlier completed run and may not reflect the latest push.


Verdict by kanri

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RawToast, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aa82283c-54b5-4b6c-9a38-f462c3a1f5cb

📥 Commits

Reviewing files that changed from the base of the PR and between 4fcff0b and 050c0ae.

📒 Files selected for processing (6)
  • scripts/__tests__/cursor-sdk-local-agent-bridge.test.mjs
  • scripts/cursor-sdk-local-agent-bridge.mjs
  • worker/__tests__/cursor.test.ts
  • worker/__tests__/index.test.ts
  • worker/cursor.ts
  • worker/openai.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch grok

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.

kanri-san[bot]

This comment was marked as off-topic.

@RawToast
RawToast merged commit f5e421d into master Jul 16, 2026
2 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