Skip to content

[FEATURE]: Support reasoning effort (thinking intensity) for xAI Grok 4.5 #39448

Description

@MagicSpirit007

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

When using xAI Grok 4.5 in OpenCode (via xAI API / OAuth / @ai-sdk/xai), there is no way to adjust thinking / reasoning intensity (low / medium / high). The model effectively always runs at the provider default (high), and OpenCode does not expose effort variants for this model.

This matters for both latency and cost: Grok 4.5's default is high effort, so simple coding tasks burn more reasoning tokens than necessary if low/medium cannot be selected.

xAI API support

Per xAI Reasoning docs:

  • grok-4.5 supports reasoning_effort / reasoning.effort
  • Accepted values: low / medium / high
  • Default: high
  • Reasoning cannot be disabled (no none)

Also documented on the Grok 4.5 overview.

Example (chat completions style):

{
  "model": "grok-4.5",
  "reasoning_effort": "low",
  "messages": [{ "role": "user", "content": "" }]
}

Current OpenCode behavior

In packages/opencode/src/provider/transform.ts, variants() only special-cases grok-3-mini for Grok reasoning effort:

// see: https://docs.x.ai/docs/guides/reasoning#control-how-hard-the-model-thinks
if (id.includes("grok") && id.includes("grok-3-mini")) {
  // only low / high
  return {
    low: { reasoningEffort: "low" },
    high: { reasoningEffort: "high" },
  }
}

grok-4.5 (and related Grok 4.x models that now expose effort) fall through and do not get low/medium/high variants in the model picker / Ctrl+T cycling / config.

reasoningEffort() already maps @ai-sdk/xai{ reasoningEffort: effort }, so the missing piece is mainly exposing the correct effort variants for Grok 4.5 (and wiring models.dev / capabilities if needed).

Expected behavior

For Grok 4.5 (and preferably other Grok models that support effort):

  1. OpenCode exposes low / medium / high as selectable reasoning variants (same UX as other models with effort controls).
  2. Selecting a variant sends the correct reasoningEffort / reasoning.effort to xAI.
  3. Works for both xAI API key and Grok OAuth paths.
  4. Do not offer none for Grok 4.5 (API rejects disabling reasoning).

Why this matters

Effort Use case
low Fast agent loops, simple edits, latency-sensitive work
medium Balanced coding sessions
high (default) Hard debugging / architecture / multi-step reasoning

Without this control, every request is effectively stuck on high, which is slower and more expensive than necessary for everyday agentic coding.

Related

Suggested implementation sketch

  1. Extend the Grok branch in ProviderTransform.variants() beyond grok-3-mini to cover grok-4.5 (and ideally a broader grok-4 / models.dev-driven set).
  2. For Grok 4.5 specifically, expose:
    • low{ reasoningEffort: "low" }
    • medium{ reasoningEffort: "medium" }
    • high{ reasoningEffort: "high" }
  3. For OpenRouter / compatible providers, use the matching { reasoning: { effort } } shape already used for other models.
  4. Prefer driving this from models.dev reasoning_options if available, so future Grok models do not need one-off hardcoding.

Happy to test a PR once this lands.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions