Skip to content

🤖 feat: add Grok 4.5 priority processing - #3798

Merged
ammario merged 1 commit into
mainfrom
grok-models-82pt
Aug 5, 2026
Merged

🤖 feat: add Grok 4.5 priority processing#3798
ammario merged 1 commit into
mainfrom
grok-models-82pt

Conversation

@ammar-agent

@ammar-agent ammar-agent commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds Grok 4.5 as the sole curated xAI model and integrates xAI Priority Processing with Mux's shared thinking and Fast mode controls, exact billed-cost tracking, and native web/X search.

Background

xAI exposes grok-4.5 with configurable low/medium/high reasoning effort. Earlier built-in Grok entries were retired on May 15, 2026 and now redirect to newer models, so keeping them in Mux's curated index is misleading. xAI Priority Processing uses service_tier: "priority" and is billed at 2× standard token rates when granted.

Implementation

  • replaces the curated Grok 4.1 Fast and Grok Code entries with xai:grok-4.5
  • adds Grok 4.5 token limits, tiered pricing, capabilities, and a low/medium/high reasoning policy
  • plugs Grok into the shared ThinkingSelector; the configured minimum-thinking floor controls whether Low is shown, and Grok never exposes Off or Pro mode
  • generalizes the shared Fast mode selector, keyboard shortcut, command palette action, and closed-state indicator to the active direct provider
  • keeps OpenAI and xAI Fast mode state independent: OpenAI uses its existing restore-tier behavior, while Grok toggles xAI between default and priority
  • hides xAI Fast mode on gateway routes and for legacy/non-Grok-4.5 xAI model strings
  • adds an xAI provider setting for standard or fast processing with serialized, failure-aware persistence
  • injects xAI's service_tier request field through the provider fetch wrapper
  • uses the xAI Responses path for Grok 4.5 and reconciles usage to exact costInUsdTicks billing metadata across multi-step turns
  • updates and patches the xAI SDK for current Responses limits, then translates existing xAI Live Search configuration into Responses-native web and X search tools, including source filters, disabled mode, and required first-step search for mode: "on" on direct xAI routes
  • keeps older custom Grok strings on Chat Completions for legacy compatibility
  • updates compaction coverage and regenerates model documentation and embedded skill content

Validation

  • make static-check
  • targeted unit suite for Fast mode provider resolution, service-tier persistence, command availability, provider config, provider service, and settings regressions: 154 tests passed
  • full-app Jest UI integration covering shared thinking controls and Fast mode for OpenAI and Grok 4.5
  • targeted Grok/provider regression suite covering aliases, pricing metadata, exact billing, thinking policy, native search tools, provider options, request shaping, and routing
  • real xAI Grok 4.5 priority inference test in the CI integration harness
  • mobile-width Storybook verification at 375px with no horizontal overflow

Risks

Moderate but localized. Grok 4.5 moves to xAI's Responses implementation and the shared Fast mode UI now resolves provider state from the selected model. Route-aware gates keep provider-native options off gateway paths, and older custom Grok model strings retain the legacy Chat Completions path.


Generated with mux • Model: openai:gpt-5.6-sol • Thinking: high • Cost: $152.19

@mintlify

mintlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Mux 🟢 Ready View Preview Aug 5, 2026, 3:49 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the Grok 4.5 model registry, reasoning policy, and xAI Priority Processing request path.

@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: 8fd9e85e8f

ℹ️ 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 thread src/node/services/providerModelFactory.ts
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Updated the stale compaction integration expectation after removing the legacy Grok model. The focused integration test and make static-check now pass locally.

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Addressed Codex finding “Account for priority-tier xAI billing”:

  • Grok 4.5 now uses the xAI Responses API path, which exposes costInUsdTicks from the exact billed response.
  • Per-step xAI cost ticks are accumulated across tool/model steps.
  • Live and persisted usage costs reconcile to the exact billed USD amount, covering Priority Processing, caching, and server-side tools.
  • Older custom Grok strings remain on Chat Completions for legacy compatibility.

Validated with focused billing tests, the compaction integration test, the full Grok regression set, and make static-check.

@codex review

@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: 7b23429349

ℹ️ 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 thread src/common/utils/ai/providerOptions.ts
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Final update: removed the stale model-filter assertion for the retired Grok alias. Exact xAI billing, focused integration coverage, and make static-check are green locally.

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Addressed Codex finding “Preserve Grok live search when routing to Responses”:

  • Grok 4.5 now registers xAI Responses-native web_search and x_search tools by default.
  • Existing providers.xai.searchParameters source filters are translated to native domain/X-handle/date filters.
  • mode: "off" continues to disable native search.
  • The prompt allowlist and runtime toolset now both advertise the Grok 4.5 native tools.

Validated with focused native-tool tests, the full Grok regression set, the compaction integration test, and make static-check.

@codex review

@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: f20a5b6965

ℹ️ 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 thread src/node/services/providerModelFactory.ts Outdated
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Added a real xAI integration test to the existing IPC integration harness. CI now receives XAI_API_KEY and makes a Grok 4.5 priority inference call, asserting successful streaming and exact billed costInUsdTicks metadata.

Local live execution reached xAI but the provided key currently returns permission-denied because its team has no credits or licenses. The CI secret will exercise the test on this revision; if it is the same unfunded team, xAI credits/license must be added for the required check to pass.

@codex review

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Addressed Codex finding “Route Grok 4.5 aliases to Responses”:

  • Responses routing now uses the shared isGrok45Model predicate for grok-4.5 aliases such as grok-4.5-latest.
  • Runtime native web/X tool registration and the prompt tool allowlist use the same predicate.
  • Added coverage for alias Responses routing and native search availability.

Validated with focused alias tests and make static-check.

@codex review

@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: 79b96eb6a7

ℹ️ 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 thread src/node/services/providerModelFactory.ts
Comment thread src/common/utils/tools/tools.ts Outdated
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

The new real Grok 4.5 integration test is wired into CI and is reaching xAI successfully, but xAI returns permission-denied because the key's team has no credits or licenses. The required integration check will remain red until credits/license are added and the failed job is rerun.

The key was also shared in chat, so it should be rotated; update the XAI_API_KEY GitHub Actions secret with the replacement key before rerunning CI.

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Addressed the latest Codex findings:

  • Exact billed cost: added a factory-level test against the installed @ai-sdk/xai Responses implementation proving usage.cost_in_usd_ticks becomes providerMetadata.xai.costInUsdTicks; this is the metadata Mux accumulates and reconciles into live/persisted costs.
  • RSS-only search: RSS-only legacy configs now retain search capability through Responses-native web search, scoped to the RSS feed hostname. Added focused coverage.

Validated with the focused tests and make static-check.

@codex review

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Addressed the latest Codex findings:

  • Updated and patched the xAI SDK's stale 10-handle validator to xAI's documented 20-handle limit; request-preparation coverage exercises 11 handles.
  • Allowed/excluded domain and X-handle filters are no longer emitted together. All exclusions are subtracted from configured allowlists; exclusion-only configurations emit only exclusions.
  • Added coverage for mixed and exclusion-only configurations.
  • Nix offline dependency setup now includes Bun patch files. The local environment lacks Nix, so CI will report the replacement fixed-output hash, which will be applied in the next update.

@codex review

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Applied the Nix fixed-output hash reported by CI for the updated xAI SDK and Bun patch. Local make static-check remains green.

@codex review

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Bun patch files are now included in the published package and the lockfile-free CLI validation fixture. make check-bench-agent and make static-check pass locally.

The package manifest changed, so CI will calculate one final Nix fixed-output hash update.

@codex review

@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: 90ab58380f

ℹ️ 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 thread src/common/utils/tools/tools.ts Outdated
Comment thread src/common/utils/tools/tools.ts Outdated
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Addressed the latest Codex findings:

  • Persisted sources is now treated as untrusted data: non-array values and malformed source entries are ignored rather than throwing and blocking Grok requests.
  • Source fields are sanitized as string arrays before translation.
  • The xAI provider import is now static at module scope, matching repository import conventions.
  • Added malformed-config recovery coverage.

Validated with focused hardening tests, make static-check, and make check-bench-agent.

@codex review

@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: 794844e633

ℹ️ 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 thread src/common/utils/tools/tools.ts Outdated
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

Addressed Codex finding “Validate xAI date filters before forwarding”:

  • Persisted fromDate/toDate values are accepted only when they are valid calendar dates in YYYY-MM-DD form.
  • Non-string, malformed, and impossible dates are omitted rather than passed to the native xAI tool.
  • Added explicit malformed-date assertions.

Validated with focused tests and make static-check.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 0e15cd3626

ℹ️ 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".

---

_Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `high` • Cost: `$152.19`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=high costs=152.19 -->
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Rebased onto current main (f579880a06) and integrated Grok 4.5 with the new shared thinking selector and Fast mode interface. Fast mode now resolves the selected direct provider, keeps OpenAI/xAI tiers independent, and is route-gated for Grok.

@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: 80a3582370

ℹ️ 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".

// cost metadata (including Priority Processing). Keep older custom model
// strings on Chat Completions for legacy search_parameters compatibility.
return Ok(
isGrok45Model(`xai:${modelId}`) ? provider.responses(modelId) : provider.chat(modelId)

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 Route mapped Grok 4.5 aliases through Responses

Fresh evidence here is that configured mappedToModel aliases still take the Grok 4.5 provider-options branch while this route check stays raw-id based: with providers.xai.models: [{ id: "team-grok", mappedToModel: "xai:grok-4.5" }], buildProviderOptions suppresses legacy searchParameters, but this creates a Chat Completions model and the native-tool registration uses the same raw predicate. Those requests get neither legacy Live Search nor Responses-native web_search/x_search; use the same mapped capability predicate for routing/tools, or keep legacy search for aliases that remain on chat.

Useful? React with 👍 / 👎.

@ammario
ammario merged commit 338b3c6 into main Aug 5, 2026
22 checks passed
@ammario
ammario deleted the grok-models-82pt branch August 5, 2026 21:34
ammario pushed a commit that referenced this pull request Aug 5, 2026
## Summary

Honor configured `mappedToModel` aliases that target Grok 4.5, and make
Grok 4.5 usage meters/pricing resolve known context limits for family
aliases.

## Background

#3798 added Grok 4.5 Responses routing and native search tools, but some
checks used the raw runtime model id. A provider entry like `{ id:
"team-grok", mappedToModel: "xai:grok-4.5" }` still took the Grok 4.5
provider-options path while model creation stayed on Chat Completions,
so those requests lost both legacy Live Search and Responses-native
`web_search`/`x_search`.

Separately, context usage could show "Unknown model limits" for Grok 4.5
when the selected/runtime id used a rolling alias (`-latest`) or mixed
case, because stats lookup only hit the exact `xai/grok-4.5` key.

## Implementation

- resolve mapped Grok 4.5 capability through `resolveModelForMetadata`
before choosing Responses vs Chat Completions
- pass the capability model into tool construction and forced first-step
search so native xAI tools and prompt allowlists stay aligned
- let Fast mode treat mapped Grok aliases as xAI priority-capable on
direct routes
- harden model-stats lookup for `-latest` and case variants, and publish
Grok 4.5 `max_output_tokens`
- add regression coverage for mapped alias routing, native tools, Fast
mode availability, and context-limit resolution

## Validation

- `bun test src/browser/utils/fastModeServiceTier.test.ts
src/common/utils/tools/tools.test.ts
src/node/services/providerModelFactory.test.ts
src/common/utils/tokens/modelStats.test.ts
src/common/utils/compaction/contextLimit.test.ts`
- `make static-check`

## Risks

Low. Behavior only expands known Grok 4.5 metadata resolution and
mapped-alias capability inheritance; unmapped legacy Grok strings remain
on Chat Completions.

---

_Generated with `mux` • Model: `xai:grok-4.5` • Thinking: `high` • Cost:
`$159.82`_

<!-- mux-attribution: model=xai:grok-4.5 thinking=high costs=159.82 -->
@mux-bot mux-bot Bot mentioned this pull request Aug 6, 2026
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