An open API service indexing awesome lists of open source software.

https://github.com/ttempaa/cursor-openai-enabler

Cursor IDE extension that automatically re-enables the "OpenAI API Key" toggle when it randomly resets itself.
https://github.com/ttempaa/cursor-openai-enabler

cursor cursor-ai cursor-ide fix openai

Last synced: about 1 month ago
JSON representation

Cursor IDE extension that automatically re-enables the "OpenAI API Key" toggle when it randomly resets itself.

Awesome Lists containing this project

README

          

# cursor-openai-enabler

Cursor IDE extension that automatically re-enables the "OpenAI API Key" toggle when it randomly resets itself.

## Problem

Cursor has a [known bug](https://forum.cursor.com/t/openai-api-key-randomly-toggling-off-in-settings/24724) where the "Override OpenAI Base URL" / "OpenAI API Key" toggle keeps turning off by itself. There is no official fix yet.

## How it works

1. The extension reads Cursor's internal SQLite database (`state.vscdb`) to detect when `useOpenAIKey` resets to `false`
2. When detected, it calls Cursor's built-in `aiSettings.usingOpenAIKey.toggle` command to re-enable it
3. Shows a notification when the fix is applied

Detection runs via:
- **File watcher** on `state.vscdb` (reacts in ~1 second)
- **Polling fallback** every 30 seconds

## Install

### From release

1. Download the latest `.vsix` from [Releases](https://github.com/ttempaa/cursor-openai-enabler/releases)
2. Install via CLI:
```
cursor --install-extension cursor-openai-enabler-x.x.x.vsix
```
Or in Cursor: `Ctrl+Shift+P` → "Extensions: Install from VSIX..."

### Build from source

Requires [Bun](https://bun.sh/).

```bash
bun install
bun run build
bun run package
```

## Commands

The extension provides two commands. Open the Command Palette (`Ctrl+Shift+P`) to run them.

Both commands are useful when you want to temporarily switch to a different model. They turn off the OpenAI key and prevent the extension from automatically re-enabling it.

The difference is which side is "primary":

- **Cursor OpenAI Enabler: Toggle Extension** (`cursor-openai-enabler.toggle`): controls the **extension itself**. When paused, all monitoring stops completely and the OpenAI key is turned off as a side effect. When resumed, monitoring starts and the key is re-enabled if needed. The state persists across Cursor restarts.
- **Cursor OpenAI Enabler: Toggle OpenAI Key** (`cursor-openai-enabler.toggleOpenAIKey`): controls the **key directly**. It toggles the OpenAI API Key setting in Cursor and the extension syncs its state to match. When the key is turned on, monitoring becomes active; when turned off, monitoring pauses.

The extension also shows a status bar button (`OpenAI Key`) that reflects the current state. Click it to run **Toggle Extension**.

## Logs

The extension writes diagnostic messages to the Output panel:

- Open `View` → `Output`
- Select `Cursor OpenAI Enabler`
- Log lines include timestamps with milliseconds

## How it finds the database

The path is derived automatically from the extension's `globalStorageUri`, so it works regardless of OS:

| OS | Path |
|---|---|
| Windows | `%APPDATA%\Cursor\User\globalStorage\state.vscdb` |
| macOS | `~/Library/Application Support/Cursor/User/globalStorage/state.vscdb` |
| Linux | `~/.config/Cursor/User/globalStorage/state.vscdb` |