Use the models on your Cursor subscription inside the Pi Coding Agent. After you sign in, Pi can call Claude, GPT, Composer, Gemini, Grok, Kimi, and whatever else your Cursor account currently offers. No separate provider API key.
This package registers a cursor provider. It is a fork of @rahularya01/pi-cursor.
Unofficial. Not affiliated with Cursor / Anysphere. The protocol is reverse-engineered and can change. Use only on accounts you are allowed to access, and read the source before
/login cursor.
- Pi Coding Agent and Pi AI
>= 0.86.1(including Pi 1.3.0) - Bun
>= 1.4.0(the only supported runtime) - A Cursor account
Installs the release currently published on npm. How a release is published is in CONTRIBUTING.md.
pi install npm:@lykhoyda/pi-cursor-subscriptionRestart Pi or run /reload. To update this package later:
pi update npm:@lykhoyda/pi-cursor-subscription-
Sign in. If the Cursor desktop app is logged in on this machine (or the Cursor CLI on macOS), that login is reused. Otherwise:
/login cursor -
Pick a model. Open
/modeland choose acursor/…row, or list ids, context windows, and thinking levels:/cursor.modelsThe live catalog comes from Cursor after you sign in. It can differ by plan.
-
Chat. If something fails, run
/cursor.doctorfirst (token source, endpoint, last error).
| Command | What it does |
|---|---|
/login cursor |
Sign in (pick Sign in with an account; see Authentication); refreshes the model list |
/model cursor/<id> |
Select a Cursor model |
/cursor.models |
List models, context windows, and thinking levels |
/cursor.models all |
Include internal tab/chat variants |
/cursor.usage |
Print plan quota and on-demand spend |
/cursor.doctor |
Sanitized diagnostics |
Pi thinking levels (off, minimal, low, medium, high, xhigh, max) map onto Cursor variants when the model advertises them. Limit the picker with enabledModels in ~/.pi/agent/settings.json.
Credentials are tried in this order:
CURSOR_ACCESS_TOKEN- Pi OAuth store (
~/.pi/agent/auth.jsonfrom/login cursor) - Cursor CLI tokens in the macOS Keychain (
cursor-access-token/cursor-refresh-token) - Cursor IDE
globalStorage/state.vscdb(macOS, Linux, Windows, or WSL; on WSL, the current Windows user only)
/login cursor wins over harvested CLI/IDE tokens so another Cursor login on the machine does not silently override yours.
CURSOR_ACCESS_TOKEN is also registered as Pi's provider auth environment source,
so Pi can select and stream Cursor models with an empty Pi credential store.
The token is resolved at runtime and is not copied into Pi's auth file. Without
an environment token or a Pi login, Pi may still refuse model selection even if
the extension can resolve CLI/IDE credentials directly.
Because of that registration, /login cursor shows a chooser. Pick Sign in with
an account for the browser sign-in. Choosing Sign in with an API key overwrites the saved
Cursor sign-in in Pi's auth file, and the extension ignores that key: it falls back
to the other credentials above, or to none with PI_CURSOR_SYSTEM_CREDENTIALS=0.
To skip Keychain / IDE reuse:
export PI_CURSOR_SYSTEM_CREDENTIALS=0By default, Cursor-native shell, fetch, write, and delete run on the open Run RPC, outside Pi's sandbox and confirmation UI, so a session with no Pi tools can still act. read, ls, and grep always run on that channel.
The native shell runs with your user's filesystem permissions. The extension checks the starting directory. Use a container or VM for isolation, or turn native exec off with this setting.
export PI_CURSOR_NATIVE_EXEC=0With that set, privileged execs go through Pi tools (bash, edit, write) instead.
The native shell receives these parent variables when present.
- Linux, macOS, WSL, and Windows:
PATH,HOME,LANG,TMPDIR, and locale names matching^LC_[A-Z][A-Z0-9_]*$. - Native Windows also receives
SystemRoot,ComSpec,PATHEXT,USERPROFILE,TEMP, andTMPfrom the extension. Windows names are matched case-insensitively. Bun's Windows process launcher can also supply parent values for missingHOMEDRIVE,HOMEPATH,LOGONSERVER,PATH,SYSTEMDRIVE,SYSTEMROOT,TEMP,USERDOMAIN,USERNAME,USERPROFILE, andWINDIR.
If a tool needs an extra setting such as DEMO_COLOR, list its name in your own shell or a trusted launcher outside the workspace.
PI_CURSOR_SHELL_ENV_EXTRA='DEMO_COLOR'
pi --cursor-shell-env-extra "$PI_CURSOR_SHELL_ENV_EXTRA"In PowerShell, use $PI_CURSOR_SHELL_ENV_EXTRA = 'DEMO_COLOR' followed by the same Pi invocation. The launcher expands the comma-separated names into one quoted argument before Pi starts. The extension grants extras only through Pi's parsed flag. Exporting the variable or setting it in a workspace .env file grants zero extras on its own. Values for granted names come from Pi's process environment, which can include dotenv values. The child map always excludes the control variable itself and names that match the secret filter. See SECURITY.md.
Native fetch refuses loopback, private-network, link-local / cloud-metadata, and other internal addresses, including via redirects.
Cursor-hosted web search / Exa fetch prompts are rejected unless you opt in (PI_CURSOR_HOSTED_WEB=1). That flag is independent of native exec.
Cursor can see Pi's MCP tools. Cursor subagents are not supported and return an error.
| Variable | Default | Purpose |
|---|---|---|
CURSOR_ACCESS_TOKEN |
unset | Access token override |
PI_CURSOR_SYSTEM_CREDENTIALS |
on | Set 0 to disable Keychain / IDE harvest |
PI_CURSOR_NATIVE_EXEC |
on | Set 0 to reject privileged native exec |
PI_CURSOR_SHELL_ENV_EXTRA |
unset | Local name list to pass as --cursor-shell-env-extra |
PI_CURSOR_HOSTED_WEB |
off | Set 1 to auto-approve hosted web / Exa |
PI_CURSOR_CLIENT_VERSION |
bundled default | Pin the x-cursor-client-version header |
PI_CURSOR_AGENT_URL / CURSOR_AGENT_URL |
Cursor's agent host | Must be *.cursor.sh / *.cursor.com or localhost |
PI_CURSOR_STREAM_IDLE_TIMEOUT_MS |
180000 (3 min) |
Silence watchdog; 0 disables |
PI_CURSOR_CACHE_DIR |
~/.cache/pi-cursor |
Model catalog cache ($XDG_CACHE_HOME/pi-cursor if set) |
PI_CURSOR_PROVIDER_DEBUG |
off | Verbose debug log |
PI_PROXY_CURSOR / PI_PROXY / HTTPS_PROXY |
unset | HTTP CONNECT proxy |
No API provider registered for api: cursor-native:pi update npm:@lykhoyda/pi-cursor-subscriptionthen/reload.- 401 / not logged in:
/login cursor, or check/cursor.doctor(tokenSource). - Hung stream / wire errors:
/cursor.doctor(clientVersion,wireDrift). Try pinningPI_CURSOR_CLIENT_VERSION, or setPI_CURSOR_PROVIDER_DEBUG=1. - Stale model list: Open
/modelto refresh, or delete the cache underPI_CURSOR_CACHE_DIR.
See CONTRIBUTING.md.
Wire patterns from opencode-cursor and @pi-stef/cursor. Upstream: Rahularya01/pi-cursor.