Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Cursor Native Agent fails when using glm-5.2 through an OpenAI-compatible custom provider.
The error returned by Cursor is:
Unauthorized User API key
However, this does not appear to be a globally invalid API key or provider configuration issue.
The same API key and endpoint work correctly in Cursor with another model from the same provider, kimi-k2.7-code.
The same glm-5.2 model also works correctly outside Cursor in other coding agents, including Mimo Code, Z Code, and OpenCode’s own tooling.
Provider configuration:
Provider: OpencodeGo
Protocol: OpenAI-compatible
Chat completions endpoint: https://opencode.ai/zen/go/v1/chat/completions
Models endpoint: https://opencode.ai/zen/go/v1/models
Model ID: glm-5.2
The /models endpoint lists glm-5.2, so the model ID appears to be valid.
Only this specific combination fails:
Cursor Native Agent + OpenAI-compatible custom provider + glm-5.2
I also found a similar public report from another user using Volcengine Ark / Ark Coding Plan where glm-5.2 started failing in Cursor with Unauthorized User API key, even after recreating the key and updating the request URL. This suggests the issue may not be limited to OpencodeGo and may involve Cursor Native Agent’s handling of glm-5.2 through third-party / OpenAI-compatible coding providers.
My suspicion is that Cursor Native Agent may be sending a request shape or model capability configuration that causes glm-5.2 to fail, possibly related to tools, tool calling, streaming, reasoning parameters, tool result message format, or agent-loop context handling.
Steps to Reproduce
- Configure an OpenAI-compatible custom provider in Cursor.
- Use the following chat completions endpoint:
https://opencode.ai/zen/go/v1/
- Use a valid OpencodeGo API key.
- Set the model ID to:
glm-5.2
- Start a Cursor Native Agent request.
- Cursor fails with:
ERROR_BAD_USER_API_KEY
Invalid API key.
Unauthorized User API key
Control checks:
- The same API key and endpoint work in Cursor with kimi-k2.7-code.
- The same glm-5.2 model works in Mimo Code.
- The same glm-5.2 model works in Z Code.
- The same glm-5.2 model works in OpenCode’s own tooling.
- The provider’s /models endpoint lists glm-5.2.
Operating System
MacOS
Version Information
Version: 3.8.23
VS Code Extension API: 1.105.1
Commit: 7cf19b7482706625cdb70db3211b7dd035b7aa30
Date: 2026-06-23T14:57:42.334Z
Layout: glass
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Darwin arm64 25.5.0
For AI issues: which model did you use?
glm-5.2
For AI issues: add Request ID with privacy disabled
Request ID: 7bc44b41-704e-4927-8fbc-b926ec6c1d50 {“error”:“ERROR_BAD_USER_API_KEY”,“details”:{“title”:“Invalid API key.”,“detail”:“Unauthorized User API key”,“isRetryable”:false,“additionalInfo”:{},“buttons”:,“planChoices”:,“analyticsMetadata”:{“actionRequired”:“config”}},“isExpected”:true} Unauthorized User API key Invalid API key. Unauthorized User API key ActionRequiredError: Invalid API key. Unauthorized User API key at $ME (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:11960:27378) at n4h (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:11960:26526) at wYS (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:11961:11427) at Object.classify (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:11961:15943) at WME (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:11961:5707) at async AYg.runWithSharedTurnRunner (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:11961:15295) at async Bue.runAgentLoop (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:21284:3043) at async KFv.streamFromAgentBackend (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:24462:13711) at async KFv.getAgentStreamResponse (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:24462:22563) at async Cft.submitChatMaybeAbortCurrent (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.glass.main.js:12048:2095)
Does this stop you from using Cursor
Yes - Cursor is unusable