Failed to use GPT-4.1 using custom OpenAI API key

Describe the Bug

Failed to use GPT-4.1 using custom OpenAI API key, but for o-series models it worked without issue. The name of model is just gpt-4.1. Here’s the request info:

Request ID: 978468cf-9482-4e30-bb39-90175d4fc24d
{"error":"ERROR_OPENAI","details":{"title":"Unable to reach the model provider","detail":"We encountered an issue when using your API key: Provider was unable to process your request\n\nAPI Error:\n\n```\nRequest failed with status code 400: {\n  \"error\": {\n    \"message\": \"Invalid 'messages[3].tool_calls[0].id': string too long. Expected a string with maximum length 40, but got a string with length 81 instead.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"messages[3].tool_calls[0].id\",\n    \"code\": \"string_above_max_length\"\n  }\n}\n```","additionalInfo":{},"buttons":[]},"isExpected":true}
ConnectError: [invalid_argument] Error
    at x9a.$endAiConnectTransportReportError (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4757:223764)
    at hir.S (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:17741)
    at hir.Q (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:17519)
    at hir.M (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:16607)
    at hir.L (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:15708)
    at Bwt.value (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:14500)
    at ve.B (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:48:2398)
    at ve.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:48:2617)
    at Git.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4744:10379)
    at u.onmessage (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6968:12271)

Steps to Reproduce

  1. Set up and verify Open AI API key
  2. Open a new chat or existing chat
  3. Choose gpt-4.1 in either mode.
  4. Type any message and send it then
  5. Get the error request info

Expected Behavior

To be able to use the model like using other models.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.2.4 (Universal)
VSCode Version: 1.99.3
Commit: a8e95743c5268be73767c46944a71f4465d05c90
Date: 2025-07-10T16:55:16.443Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.5.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, let me know if you currently have a Pro subscription.

I do

I just checked and this model works with my API key. There might have been temporary issues with OpenAI. Can you confirm if the problem persists?

works now, thanks for the help!

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.