Skip to content

feat(cursor-proxy): support model selection via CURSOR_MODEL env var#3421

Closed
aulorbe wants to merge 1 commit into
macos-local-cursor-cli-bug-fixfrom
cursor-proxy-model-picking
Closed

feat(cursor-proxy): support model selection via CURSOR_MODEL env var#3421
aulorbe wants to merge 1 commit into
macos-local-cursor-cli-bug-fixfrom
cursor-proxy-model-picking

Conversation

@aulorbe
Copy link
Copy Markdown
Collaborator

@aulorbe aulorbe commented May 20, 2026

Summary

Stacked on #3420.

The Cursor proxy previously hardcoded "openrouter/auto" for all OpenRouter API calls, always reported Claude Sonnet 4.6 as the default model, and offered no way to pick a different model.

This PR:

  • Model env var: adds modelEnvVar: "CURSOR_MODEL" to the Cursor agent config so the orchestrator injects the user's model choice into .spawnrc
  • Dynamic model list: replaces the hardcoded model list in the proxy with a dynamic fetch from OpenRouter's /api/v1/models endpoint (cached after first fetch, falls back to a default if it fails)
  • Proxy model routing: the bidi proxy reads CURSOR_MODEL from the environment and forwards it to OpenRouter; the unary proxy's GetDefaultModelForCli and GetUsableModels responses reflect the configured model
  • Searchable model picker: replaces the freeform "Model ID" text input in the interactive setup flow with a searchable autocomplete picker populated from OpenRouter's model list (falls back to text input if the fetch fails)

Users can set their preferred model via:

  1. The "Custom model" toggle in the interactive setup options (now shows a searchable picker)
  2. MODEL_ID env var
  3. ~/.config/spawn/preferences.json

Test plan

  • bunx @biomejs/biome check src/ passes
  • bun test src/__tests__/cursor-proxy.test.ts — all 13 tests pass
  • bun test src/__tests__/cmd-interactive-cov.test.ts — all 10 tests pass
  • Manual: toggle "Custom model" in setup options → verify searchable picker appears
  • Manual: pick a model → verify it's used in the Cursor CLI session
  • Manual: test with fetch failure (offline) → verify fallback text input works

Copy link
Copy Markdown
Collaborator Author

aulorbe commented May 20, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@aulorbe aulorbe force-pushed the cursor-proxy-model-picking branch 2 times, most recently from aafe08b to 7ac7ef6 Compare May 20, 2026 21:12
@aulorbe aulorbe marked this pull request as ready for review May 20, 2026 21:14
… tests

- Export promptModelPicker for testability
- Filter models to Cursor-compatible providers (OpenAI, Anthropic,
  Google, xAI) with tool/function calling support
- Add 12 unit tests covering: provider filtering, tool filtering,
  fetch failure fallback, cancel handling, spinner messages, and
  empty filter results
@aulorbe aulorbe force-pushed the cursor-proxy-model-picking branch from 7ac7ef6 to 2dddbcc Compare May 20, 2026 21:16
@aulorbe aulorbe deleted the branch macos-local-cursor-cli-bug-fix May 20, 2026 21:27
@aulorbe aulorbe closed this May 20, 2026
@aulorbe aulorbe deleted the cursor-proxy-model-picking branch May 20, 2026 21:28
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.

1 participant