Grok-4.7 run rejects advertised context 500k

Where does the bug appear (feature/product)?

Cursor SDK

Describe the Bug

I call Cursor.models.list() and grok-4.7 advertises context values 256k and 500k. Its default variant is context 500k with reasoning_effort high and fast true. Agent.create accepts a selection with context 500k, but my run fails with: AI Model Not Found Invalid parameters for registry model: “grok-4.7”. The same high-fast selection with context 256k finishes. Passing only context 500k fails the same way. The SDK forwards the listed value and the registry rejects it.

Steps to Reproduce

  • Use @cursorcursor/sdk 1.0.31.
  • Call Cursor.models.list({ apiKey }).
  • grok-4.7 includes context values 256k and 500k, and the isDefault variant uses 500k.
  • Call Agent.create({ apiKey, model: { id: "grok-4.7", params: [{ id: "context", value: "500k" }] }, local: { cwd: process.cwd() } })
  • Send “Reply with the single word pong.”, and wait.
  • Observe run status is error with the message: AI Model Not Found Invalid parameters for registry model: “grok-4.7”.
  • Repeat with value “256k” - Observe that run succeeds

Expected Behavior

I expect a run that passes a context value advertised by Cursor.models.list(), including the default variant, to succeed. If 500k is not supported, I expect list() not to offer it or mark it as the default.

Version Information

@cursor/sdk 1.0.31, Node v22.22.1, Linux 7.0.0-31-generic x86_64, model grok-4.7

Hey, thanks for the detailed report. You read everything correctly.

The context: 500k option for Grok 4.7 is the max-context variant. Runs created through the local SDK path local: { cwd } can’t enable that mode right now, so the backend rejects the selection even though models.list() advertises it and marks it as default. So the model list and the local runtime are out of sync. That shouldn’t happen, and it’s not something in your integration. I’ve passed this to the team and we’re tracking it.

Workaround for now:

  • Pass context: 256k with any reasoning_effort and fast. This is the standard Grok 4.7 context and it works today.
  • If you need the full 500k right now, create a cloud agent via POST /v1/agents with the full set of default-variant params: context 500k, reasoning_effort high, fast true. The cloud path resolves the max variant correctly. It’s important to send all three params, not just context: 500k.

I can’t share an exact ETA yet, but I’ll reply here when there’s an update.

Same cause, and for Claude and GPT it fails silently: on the local SDK path their 1M variants don’t error like Grok’s 500K, they run at the standard window (300K for Claude Opus 5.5, 272K for GPT-5.6 Sol) and get auto-compacted there. In today’s Cursor.models.list(), 17 of the 19 models whose default variant sets context default to 1M (500K for Grok 4.7), so the default selection hits this.

Repro (@cursor/sdk 1.0.35; the code is unchanged in 1.0.36), Node 24, Linux:

import { Agent, Cursor } from "@cursor/sdk";

const apiKey = process.env.CURSOR_API_KEY;
const models = await Cursor.models.list({ apiKey });
for (const [id, context] of [["claude-opus-5-5", "1m"], ["claude-opus-5-5", "300k"], ["gpt-5.6-sol", "1m"], ["grok-4.7", "500k"]]) {
  const base = models.find((m) => m.id === id).variants.find((v) => v.isDefault).params;
  const model = { id, params: base.map((p) => (p.id === "context" ? { ...p, value: context } : p)) };
  const agent = await Agent.create({ apiKey, model, local: { cwd: process.cwd() } });
  const result = await (await agent.send("Reply with the single word pong.", { model })).wait();
  console.log(id, context, result.status, result.requestId);
  agent.close();
}
Selection Request ID Result Context limit in the conversation checkpoint
claude-opus-5-5, context=1m c973fce7-a2af-424c-9fa4-647cb9447cda finished 300,000
claude-opus-5-5, context=300k 8a3b073a-a76a-479c-8ee0-25afd6be055d finished 300,000
gpt-5.6-sol, context=1m bd322cb2-2307-43e3-b1eb-0f83f5481f06 finished 272,000
grok-4.7, context=500k af7df776-9da4-4b54-8328-4159e16c7037 error: Invalid parameters for registry model –
CLI 2026.10.01-e373342, --model 'claude-opus-5-5[context=1m,effort=medium,fast=false]' a19c4dd8-fde0-46b7-a004-b826fa07c0bf finished 1,000,000

Privacy mode was on for these requests.

It isn’t only the number: in a reading test of about 470K tokens, SDK runs with context=1m were compacted and lost the raw text of the earlier files, while the same test through the CLI reached 852K of 1M with nothing dropped.

Where it comes from: the local runtime builds agent.v1.RequestedModel as {modelId:t.model.id,parameters:(t.model.params??[]).map(…)} (dist/cjs/867.js in 1.0.36, 689.js in 1.0.35) and never sets max_mode. ModelSelection has no field for it, passing maxMode, max_mode or max as a param changes nothing, and models.list() variants don’t say which ones need Max Mode. Setting max_mode: true on that one object in-process was enough in our tests: the Opus run got 1,000,000 and Grok 4.7 ran at 500K. We now run a preload that adds maxMode there whenever the context param is <N>m.

What would fix it, in order of preference:

  1. The local runtime sets max_mode from the selected variant, as the CLI has done since Selecting Opus5 1m context through CLI args isn't possible.
  2. Or ModelSelection gets a maxMode field and models.list() marks the variants that need it.
  3. Until then, models.list() doesn’t default to variants the local runtime can’t run.

It also affects tools built on the SDK: T3 Code’s Cursor provider offers 1M by default, but every thread runs at the standard window and Grok 4.7 fails at its default ([Bug]: Cursor 1M and 500K context tiers are ignored or rejected because the SDK request never sets Max Mode · Issue #15788 · pingdotgg/t3code · GitHub).

Hey, thanks for the detailed breakdown, especially the part about the silent fallback. The fact that on the local SDK path Claude and GPT don’t return an error like Grok does, but instead quietly run on the standard window and go into auto-compaction with the raw text getting lost, is an important finding. I passed this to the team along with your repro steps and Request ID.

The root cause is the same as in the original report. Right now the local runtime does not set max_mode on RequestedModel, so the max-context variants that models.list() returns as isDefault do not resolve. That means 500k for Grok 4.7 and 1M for the others. With Grok this shows up as an Invalid parameters for registry model error. With Claude and GPT it fails quietly through compaction. This is not something caused by your integration. We’re tracking it.

Current workarounds:

  • The CLI resolves the max variant from the selected variant correctly. If you need the full window, that path works. In your case, Opus reached 1M through the CLI.
  • The cloud agent through POST /v1/agents with the full set of default-variant params also resolves max correctly.
  • On the local SDK, pin an explicit non-max context for the specific model, like 256k, 272k, or 300k, so there’s no silent mismatch between what list() reports and what actually runs. Your in-process preload with max_mode: true is a working hack, but it’s not an official path, and behavior there could change in future versions.

I can’t give an exact ETA yet, but I’ll post here when there’s an update.