Developing an Extension to Automatically Toggle OpenAI Proxy Based on Selected Model

Hi everyone,

I’m currently developing an extension for Cursor to automatically toggle the OpenAI proxy based on the selected model. As of now, the proxy management system in Cursor is quite limited (just ON/OFF).

In my case, I’d like the proxy to activate automatically if the Llama model is selected and deactivate if I switch to GPT-4.

I’ve already identified the necessary information in the state.vscdb file to detect which model is selected in the composer and whether the proxy is ON or OFF. I’ve also found a VSCode command in the shortcuts to toggle the proxy.

However, I still need to figure out how to detect if the Quick Chat is open or closed (cmd+k). Does anyone have any ideas on how to do this? Maybe a hook or a method to monitor this state?

Thanks in advance for your suggestions!

1 Like

Also intersted in this, since turning on the OpenAI Proxy seems to interfere with some of the advanced Agent Cursor functionality.

@system Can you help for this case ?

@Mckay I’m thinking an initial version already has value, even without the Quick Chat detection!

And quessing you already went through the Events at VS Code API | Visual Studio Code Extension API, and none of them helped.

Hello everyone,

After some testing, I’ve noticed that the data extracted from state.vscdb is not always up-to-date, making it quite difficult to reliably detect the selected model and proxy state. The detection is currently very inconsistent in this regard.

The only thing I can reliably detect at the moment is the model via cmd+k, which consistently returns the correct information. However, for everything else, it would be extremely helpful if the Cursor team could provide a more reliable way to access this data or suggest a better approach.