Repository navigation
Description
Summary
thv llm setup --client cursor reports success and patches ~/Library/Application Support/Cursor/User/settings.json with:
"cursor.general.openAIBaseURL": "http://localhost:14000/v1",
"cursor.general.openAIAPIKey": "thv-proxy"(pkg/client/config.go:517-519, via ConfigureLLMGateway in pkg/client/llm_gateway.go). The gateway proxy (thv llm proxy start) starts and responds correctly. But nothing changes in Cursor: Settings → Models → "Override OpenAI Base URL" stays off, and manually switching it on shows the stock default (https://api.openai.com/v1), not the value from settings.json.
Root cause
Checked directly against the installed Cursor client (workbench.desktop.main.js, Cursor 3.15.19). The keys ToolHive writes — openAIBaseURL / openAIAPIKey (with that exact casing, under cursor.general.*) — do not appear anywhere in the bundle. The feature Cursor actually has is openAIBaseUrl (lowercase Url) plus a separate useOpenAIKey boolean, and both are read and written exclusively through Cursor's own internal state store, not the standard VS Code configuration service:
this.reactiveStorageService.applicationUserPersistentStorage.openAIBaseUrl ?? "https://api.openai.com/v1"
...
i.setApplicationUserPersistentStorage("openAIBaseUrl", v)
i.setApplicationUserPersistentStorage("useOpenAIKey", !0)There is no code path in the bundle that reads cursor.general.openAIBaseURL (or any cursor.general.* key) from settings.json for this feature. So ConfigureLLMGateway for Cursor patches a file/key that the current app never consults — thv llm setup succeeds and reports nothing wrong, but the integration silently does nothing.
I have not yet located where applicationUserPersistentStorage actually persists to disk — a search of ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb's ItemTable for openai/baseurl/apikey-like keys came up empty, so it's under a different key format, a different table, or a different storage file entirely.
Why this needs care, not just a key-name fix
applicationUserPersistentStorage is Cursor's own internal, undocumented storage mechanism — not a stable public API surface the way settings.json is. Even once the correct persistence location is found, writing into it directly is inherently more fragile than the settings.json approach ToolHive uses for every other client, and could silently break again on a future Cursor release. Worth deciding whether:
- It's worth reverse-engineering and writing to Cursor's private storage anyway (accepting the fragility), or
- Cursor should be marked as unsupported for the LLM gateway proxy-mode integration until/unless Cursor exposes a supported configuration surface for this, or
- Some other integration point exists (e.g. a documented settings key for a different mechanism, or an extension-based approach) that hasn't been checked yet.
Impact
Every thv llm setup --client cursor run to date has silently failed to configure Cursor, while reporting success. Given IsClientInstalled/DetectedLLMGatewayClients both consider Cursor supported and configured, this has presumably shipped since Cursor support was added and gone unnoticed.
References
pkg/client/config.go:485-521(Cursor'sclientAppConfig, including theLLMGatewayKeysspecs)pkg/client/llm_gateway.go:39-89(ConfigureLLMGateway, the JSON-Pointer patch path used for Cursor)- Related:
thv llm setupfalse-negative detection for Cursor/VSCode without shell PATH integration #6292 (Cursor/VSCode detection false negatives) — that issue is about detection; this one is about the actual configuration being applied being ineffective even when detection succeeds.
Activity
stantheman0128 commentedon Sep 4, 2026
I'd like to work on this.
This is the config write, not the detection miss in #6292 / #6481. After #6492, VS Code goes through
chatLanguageModels.json. Cursor still patchescursor.general.openAIBaseURL/openAIAPIKeyinsettings.json. On this Win11 box that file is%APPDATA%\Cursor\User\settings.json.I will wait to be assigned, and I will wait on a call among the three options in the issue (private storage vs mark unsupported vs another public surface). I will not open a PR that writes Cursor's undocumented store unless that is the chosen path.
stantheman0128 commentedon Sep 4, 2026
Follow-up from a Win11 box (Cursor 3.19.7). The Models UI store is not a key named openai/baseurl in ItemTable. It is nested JSON.
File:
%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdbTable: ItemTable
Key:
src.vs.platform.reactivestorage.browser.reactiveStorageServiceImpl.persistentStorage.applicationUserFields the UI actually reads:
openAIBaseUrl,useOpenAIKey. The API key is not in that blob. It sits under a separate ItemTable key,secret://cursorAuth/openAIKey(VS Code SecretStorage).A dummy
thv llm setup --client cursor --lazyon this machine wrote the deadcursor.general.openAIBaseURL/openAIAPIKeykeys insettings.jsonand left the sqlite blob on the stock default (https://api.openai.com/v1,useOpenAIKeyfalse). Teardown restored settings.json.There is no
%APPDATA%\\Cursor\\User\\chatLanguageModels.jsonhere, and the workbench bundle has nochatLanguageModelsstring. VS Code on the same box does have that file. That public surface is #6492, not Cursor.So option 3 looks empty on current Cursor. Option 1 would mean writing that JSON plus SecretStorage while Cursor has the DB open (WAL, ~7GB here). I still will not do that unless this is assigned and that path is the call.
blkt commentedon Sep 4, 2026
Hi @stantheman0128 please be aware that Cursor routes all requests through their remote servers and rejects private addresses like the one set by
thv llm setup(docs here). I'm sharing this so that you don't waste time trying to implement this or to get this to work while we figure out internally what to do with it.stantheman0128 commentedon Sep 4, 2026
Thanks. I will leave the private-storage write alone and wait on the internal call. The store mapping above can stay for whenever you decide.