Skip to content

Instantly share code, notes, and snippets.

@YoraiLevi
Created August 11, 2026 01:03
Show Gist options
  • Select an option

  • Save YoraiLevi/28dbdb03b6f5739976856bedd91e982f to your computer and use it in GitHub Desktop.

Select an option

Save YoraiLevi/28dbdb03b6f5739976856bedd91e982f to your computer and use it in GitHub Desktop.
OmniRoute: Cursor Grok (cu/grok-4.5) in Claude Code — CLI + Web UI tutorials

Cursor Grok in Claude Code — Web UI only

What this does: from the OmniRoute dashboard alone, make cu/grok-4.5 appear in Claude Code’s /model list and route Claude’s effort onto Cursor’s real models (-medium / -high / -xhigh).

Why you need three UI steps: Cursor has no bare grok-4.5. A custom model makes the name exist; Expose makes Claude list it; Reasoning routing stops 400 AI Model Not Found by rewriting to a real Cursor id.

Assumes: OmniRoute dashboard open (default http://127.0.0.1:20128), Cursor IDE provider connected and enabled, Claude already pointed at OmniRoute with gateway model discovery on.

Companion: if Expose looks On but Claude still has no mirror, use the sqlite fix in omniroute-cursor-grok-in-claude.md (known UI key mismatch).


Before

  1. Open Providers → Cursor IDE.
  2. Under Available Models / playground model picker, confirm you see grok-4.5-medium, grok-4.5-high, grok-4.5-xhigh — and not a bare grok-4.5 yet.
  3. In Claude Code, /model — no cu/grok-4.5 (OmniRoute).

1. Custom Models — create the bare id

  1. Go to Providers → Cursor IDE
    (/dashboard/providers/cursor)
  2. Scroll to Custom Models.
  3. Fill:
    • Model ID: grok-4.5
    • Display Name: optional (e.g. Grok 4.5)
    • Leave API Format = Chat Completions, Target Format = Default
  4. Click Add.
  5. Confirm the list no longer says “No custom models added yet” and shows grok-4.5.

Worked if: playground Model dropdown now includes grok-4.5 (catalog may show it as cu/grok-4.5 elsewhere).


2. Expose in Claude Code — mirror for /model

Still on Providers → Cursor IDE, scroll to Expose in Claude Code (claude/…).

  1. Provider default: leave Inherit (or Off). Do not turn the whole provider On unless you want every Cursor model mirrored.
  2. Find Override for cu/grok-4.5 (or add one):
    • Model id field → type cu/grok-4.5 (try grok-4.5 if the page only accepts bare ids)
    • Add override → set the dropdown to On
  3. Leave other grok effort overrides Off unless you want them (effort-suffixed ids usually won’t appear in Claude’s picker anyway).

Worked if: quit and reopen Claude (OmniRoute profile), run /model, and you see cu/grok-4.5 (OmniRoute) under From gateway.

If the override says On but Claude still doesn’t list it: the dashboard sometimes saves the wrong internal key (cursor/… instead of cu/…). Don’t keep clicking — use the fix in the companion doc, then re-check /model.


3. Reasoning routing — remap bare → real Cursor ids

Without this, picking cu/grok-4.5 in Claude returns API Error: 400 AI Model Not Found.

  1. Go to Configuration → Global Routing
    (/dashboard/settings/routing)
  2. Scroll to Reasoning routing policies.
  3. For each row below, fill the form and click Add rule:

Same on every rule

Field Choose
Scope Model
Source model *cu/grok-4.5
Effort mode Inherit client
Routing target Other model
Thinking budget Preserve
Priority 10

One rule per effort

Name Source effort Target model
cu grok → medium (missing) Not specified cu/grok-4.5-medium
cu grok → medium medium cu/grok-4.5-medium
cu grok → medium (low) low cu/grok-4.5-medium
cu grok → high high cu/grok-4.5-high
cu grok → xhigh xhigh cu/grok-4.5-xhigh
cu grok → xhigh (max) max cu/grok-4.5-xhigh
  1. On the same card, Simulate rule:
    • Model: cu/grok-4.5
    • Effort: high
    • Click Simulate without upstream
    • Result must route to cu/grok-4.5-high

Worked if: the rule list shows all six enabled, and simulate matches the table.


After (prove it in the UI)

A. Playground on Cursor page (optional quick check)

  1. Providers → Cursor IDE → Playground
  2. Model: pick grok-4.5 if listed, or use Claude for the real path below
  3. Prefer the Claude path — that’s what you actually care about

B. Claude Code (required)

  1. Restart Claude on the OmniRoute profile
  2. /model → select cu/grok-4.5 (OmniRoute)
  3. Send: Reply with exactly: OK
  4. Open OmniRoute Dashboard → Logs (or Analytics / call logs)
  5. Latest request should show routed model grok-4.5-medium (not bare grok-4.5), status 200

C. Effort (optional)

  1. In Claude: /effort high (or use the effort control if shown)
  2. Send another short prompt
  3. In Logs, routed model should be grok-4.5-high

Rollback (Web UI)

  1. Global Routing → Reasoning routing policies → Delete each cu grok → … rule
  2. Providers → Cursor IDE → Expose in Claude Code → set cu/grok-4.5 override to Off or remove it
  3. Custom Models → delete grok-4.5
  4. Restart Claude so /model drops the entry

Troubleshooting (UI symptoms)

What you see Likely cause What to do in the UI
Custom model added; Claude has no cu/grok-4.5 Expose not effective Re-check Expose override = On; restart Claude; if still missing, companion doc sqlite fix
Claude lists it; first message = 400 AI Model Not Found No remap rules Finish step 3; re-run Simulate
Simulate says no match Wrong Source model pattern Use exactly *cu/grok-4.5 (not *grok-4.5)
Always medium; effort ignored Missing high/xhigh rules Add those Source effort rows
Logs still show bare grok-4.5 Rules disabled or not saved Confirm toggles On; Add rule again; hard-refresh the routing page

Make Cursor Grok usable in Claude Code (cu/grok-4.5 + effort)

What this does: adds a bare cu/grok-4.5 entry Claude Code can pick in /model, and remaps Claude’s effort (slider / /effort) onto Cursor’s real ids (-medium / -high / -xhigh).

Why: Cursor has no bare grok-4.5. OmniRoute can advertise a custom bare id, but without a remap Cursor returns 400 AI Model Not Found. Claude’s discovery also only lists ids that look like claude…, so non-Claude models need an Expose mirror.

Tradeoff: bare id is OmniRoute fiction; effort is enforced by OmniRoute rules, not by Cursor understanding Claude’s output_config.effort.

Assumes: OmniRoute running (default http://127.0.0.1:20128), Cursor provider connected, Claude pointed at OmniRoute with gateway discovery on (CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1).

Web UI only: see omniroute-cursor-grok-in-claude-webui.md (clicks, no sqlite/API).


Before (baseline)

# Set token from your OmniRoute key (Dashboard → API Keys, or ~/.omniroute/.env OMNIROUTE_API_KEY)
$base = "http://127.0.0.1:20128"
(Invoke-RestMethod "$base/v1/models" -Headers @{ Authorization = "Bearer $env:ANTHROPIC_AUTH_TOKEN" }
).data.id | Where-Object { $_ -match 'grok-4\.5' }

Before success looks like: cu/grok-4.5-medium|high|xhigh (and maybe gc/…) — no bare cu/grok-4.5, no claude/cu/grok-4.5.


1. Add a bare custom model (catalog entry)

  1. Open http://127.0.0.1:20128/dashboard/providers/cursor
  2. Custom ModelsModel ID = grok-4.5Add
  3. Leave API format / defaults alone

Check: re-run the baseline filter. You should now see cu/grok-4.5 (or cursor/grok-4.5 if prefix mode differs).


2. Expose it to Claude Code (mirror)

OmniRoute gates mirrors with keys like model:cu/grok-4.5 (short catalog prefix). The Cursor page UI often saves model:cursor/…, which does not enable the mirror. Prefer verify-by-effect.

  1. On the same Cursor page → Expose in Claude Code (claude/…)
  2. Keep Provider default = Inherit/Off (don’t expose every Cursor model)
  3. Set Override for cu/grok-4.5 = On (or Add override for grok-4.5 / cu/grok-4.5)
  4. Confirm the gate key OmniRoute actually uses:
sqlite3 "$env:USERPROFILE\.omniroute\storage.sqlite" `
  "SELECT key, value FROM key_value WHERE namespace='ccDiscoveryAliases' AND key LIKE '%grok-4.5%';"

You need a row model:cu/grok-4.5 = on. If you only see model:cursor/…, fix it:

sqlite3 "$env:USERPROFILE\.omniroute\storage.sqlite" `
  "INSERT OR REPLACE INTO key_value (namespace, key, value) VALUES ('ccDiscoveryAliases', 'model:cu/grok-4.5', 'on');"

Check: baseline filter must include claude/cu/grok-4.5.

Restart Claude (or delete %USERPROFILE%\.claude\profiles\<profile>\cache\gateway-models.json) so /model refreshes. You should see cu/grok-4.5 (OmniRoute).


3. Remap bare id → real Cursor effort ids

Without this, Claude picking cu/grok-4.5 → Cursor 400 AI Model Not Found.

  1. Open http://127.0.0.1:20128/dashboard/settings/routing
  2. Reasoning routing policies → add one rule per row (then Add rule):

Shared fields every time:

Field Value
Scope Model
Source model *cu/grok-4.5
Effort mode Inherit client
Routing target Other model
Thinking budget Preserve
Priority 10
Name Source effort Target model
cu grok → medium (missing) Not specified cu/grok-4.5-medium
cu grok → medium medium cu/grok-4.5-medium
cu grok → medium (low) low cu/grok-4.5-medium
cu grok → high high cu/grok-4.5-high
cu grok → xhigh xhigh cu/grok-4.5-xhigh
cu grok → xhigh (max) max cu/grok-4.5-xhigh
  1. Simulate: Model cu/grok-4.5, Effort high → target must be cu/grok-4.5-high.

If you inserted rules via sqlite instead of the UI, restart OmniRoute so the in-memory rule cache reloads.


After (same probe)

$body = @{
  model = "cu/grok-4.5"
  max_tokens = 32
  messages = @(@{ role = "user"; content = "Reply with exactly: OK" })
} | ConvertTo-Json -Depth 5

Invoke-RestMethod "$base/v1/messages" -Method POST -Headers @{
  Authorization = "Bearer $env:ANTHROPIC_AUTH_TOKEN"
  "Content-Type" = "application/json"
  "anthropic-version" = "2023-06-01"
} -Body $body

After success: HTTP 200 and response model is grok-4.5-medium (not bare grok-4.5). Call log / Dashboard → Logs should show grok-4.5-medium (or -high if you sent effort).

In Claude: /modelcu/grok-4.5 → optional /effort high → send a short prompt.


Rollback

# Stop exposing / remove custom model gate
sqlite3 "$env:USERPROFILE\.omniroute\storage.sqlite" `
  "DELETE FROM key_value WHERE namespace='ccDiscoveryAliases' AND key='model:cu/grok-4.5';"

# Remove reasoning rules
sqlite3 "$env:USERPROFILE\.omniroute\storage.sqlite" `
  "DELETE FROM reasoning_routing_rules WHERE name LIKE 'cu grok →%';"

# Remove custom model from Cursor (UI: Custom Models → delete grok-4.5)
# or clear that provider's customModels list carefully in sqlite after backup

Restart OmniRoute after sqlite changes that affect cached rules.


Troubleshooting

Symptom Cause Fix
cu/grok-4.5 in catalog but no claude/cu/grok-4.5 Expose key is model:cursor/… Insert model:cu/grok-4.5=on (step 2)
/model missing entry Stale Claude gateway cache Restart Claude; clear profile cache/gateway-models.json
400 AI Model Not Found Bare id reached Cursor Add/enable reasoning rules (step 3); restart OmniRoute
Effort doesn’t change variant No rule for that source effort Add the matching Source effort → Target model row
Pattern matches Grok Build Pattern too broad (*grok-4.5) Use *cu/grok-4.5 only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment