Skip to content

[Cursor] Grok 4.5 import sends invalid modelId "grok-4.5" to AgentService #29

Description

@pengpengzi

Summary

Importing a local Cursor subscription exposes cursor/grok-4.5 in OpenCodex, but requests fail with:

stream disconnected before completion: Cursor 流结束错误:Model name is not valid: "grok-4.5"

The Cursor subscription and authentication are valid. The failure is caused by OpenCodex sending the imported base slug grok-4.5 directly as the Cursor AgentService modelId, while Cursor Agent CLI requires an effort-qualified selector such as cursor-grok-4.5-high.

Environment

  • macOS, Apple Silicon
  • OpenCodex 1.1.1 installed locally
  • Cursor Agent 2026.07.23-e383d2b
  • Cursor Desktop 3.14.7
  • The same relevant code is still present in OpenCodex v1.1.2 / current master (20b73d09)

Steps to reproduce

  1. Import a local Cursor subscription in OpenCodex.
  2. The provider test succeeds and reports that Cursor models were fetched.
  3. Select cursor/grok-4.5 with reasoning effort high.
  4. Send any prompt through Codex Desktop / /v1/responses.
  5. The stream ends with Model name is not valid: "grok-4.5".

Cursor model IDs reported for this account

cursor-agent --list-models reports these valid Grok selectors:

cursor-grok-4.5-low
cursor-grok-4.5-low-fast
cursor-grok-4.5-medium
cursor-grok-4.5-medium-fast
cursor-grok-4.5-high
cursor-grok-4.5-high-fast

It does not report a bare grok-4.5 selector.

Root cause

The imported catalog entry is effectively:

{
  "slug": "cursor/grok-4.5",
  "backend_model": "grok-4.5",
  "backend_provider": "cursor",
  "default_reasoning_level": "medium"
}

The routing path does not combine the backend model with the selected reasoning effort:

  • router.ts assigns cursorModelForRequest = ... || upstreamModel.
  • router.ts passes that value directly to streamCursorChat.
  • cursor_protocol.ts writes it directly into ModelDetails.modelId.

As a result, modelId is grok-4.5, and the separately selected reasoning_effort=high never becomes part of Cursor's required model selector.

The current provider test only proves that AvailableModels can be fetched, so it reports a healthy Cursor subscription even though an actual AgentService generation request fails.

Verified local workaround

Changing only the imported catalog entry to:

"backend_model": "cursor-grok-4.5-high"

made the same local /v1/responses request complete successfully with response.completed. This workaround may be overwritten when models are re-imported.

Suggested fix

  1. Normalize Cursor AgentService model selectors before streamCursorChat, using the selected reasoning effort. For this model:

    grok-4.5 + low    -> cursor-grok-4.5-low
    grok-4.5 + medium -> cursor-grok-4.5-medium
    grok-4.5 + high   -> cursor-grok-4.5-high
    
  2. Prefer preserving or deriving AgentService-valid IDs from Cursor's actual CLI/model metadata instead of assuming the imported base slug is directly callable.

  3. Add an end-to-end provider test that performs a minimal AgentService generation, rather than only fetching the model catalog.

  4. Add a regression test asserting that cursor/grok-4.5 with high effort sends modelId=cursor-grok-4.5-high.

Expected behavior

Selecting cursor/grok-4.5 should generate a valid Cursor AgentService model selector from the chosen effort and complete the response normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions