Skip to content

feat(cursor-proxy): add model picker with provider/tool filtering and tests#3427

Merged
la14-1 merged 1 commit into
graphite-base/3427from
cursor-proxy/model-selection
May 22, 2026
Merged

feat(cursor-proxy): add model picker with provider/tool filtering and tests#3427
la14-1 merged 1 commit into
graphite-base/3427from
cursor-proxy/model-selection

Conversation

@aulorbe
Copy link
Copy Markdown
Collaborator

@aulorbe aulorbe commented May 21, 2026

Summary

Stacked on #3426.

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

… tests

- Dynamic model list from OpenRouter API with caching
- CURSOR_MODEL env var support for proxy routing
- Searchable autocomplete picker filtered to Cursor-compatible providers
- Falls back to openrouter/auto when fetch fails
Copy link
Copy Markdown
Collaborator

@AhmedTMM AhmedTMM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice UX

@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented May 21, 2026

Merge activity

  • May 21, 11:26 PM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • May 21, 11:26 PM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

@la14-1 la14-1 merged commit d09d520 into graphite-base/3427 May 22, 2026
3 checks passed
@la14-1 la14-1 deleted the cursor-proxy/model-selection branch May 22, 2026 00:39
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.

3 participants