OpenAI / ChatGPT BYOK models abort after brief reply in Cursor

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Since today, OpenAI / ChatGPT models used through BYOK in Cursor start replying briefly and then abort. The reply begins normally, but after a short partial answer the generation stops / aborts. This happens consistently and makes the model unusable in Cursor.

The same BYOK setup was working before. My proxy/API connection itself appears to be reachable, and the provider requests do not look like a normal authentication failure.

The model should stream the full response normally and complete the message.

Actual Behavior

The response starts, then aborts after a brief partial reply.

Additional Information

This started today. It may be related to existing BYOK/custom OpenAI endpoint issues where Cursor mixes Responses API-style payloads with /chat/completions, or where custom base URL routing behaves inconsistently.

Please let me know which logs would be most useful.

Steps to Reproduce

Steps to Reproduce
Open Cursor.
Enable OpenAI API Key / BYOK.
Use a custom OpenAI-compatible endpoint / proxy.
Select an OpenAI / ChatGPT model.
Send a normal prompt in Agent or Chat.
Observe that the model starts answering briefly, then the response aborts.
Expected Behavior

Expected Behavior

Cursor should give a normal response, working on a task until its finished.

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 3.9.8 (Universal)
VS Code Extension API: 1.105.1
Commit: 4aa8ff1b7877ed7bd01bcba308698f71a6735380
Date: 2026-06-25T01:39:30.490Z
Layout: glass
Build Type: Stable
Release Track: Nightly
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?

ChatGPT 5.5 High

Does this stop you from using Cursor

Yes - Cursor is unusable

Hi @user691!

Could you share a Request ID of an affected chat?

Thanks a lot for the fast reply; I usually use Privacy Mode. I changed to “Share Data” and ran the “Continue” prompt on the existing chat where the error occurred.
I hope you can access it.
Request ID: de0c4704-03c1-462d-a299-2e875ace1625

Works again, no idea why. I will keep “Share Data” on and reply again in case the same pattern re-emerges.

Thanks for taking the time to look int to it!

Yeah, please do! We pushed some changes last night in this area (BYOK OpenAI) and so I was not at all surprised to hear that something might have regressed.

Unfortunately, happened again:

53326b36-6819-41d2-858d-2c11af97518d

It explicitly aborts when I ask it to make changes to documents or write things. Reading and grepping work.

Additional update: Using GPT-5.5 and BYOK, Cursor in Agent Mode doesn’t write.MD files (or any other files; for example, for planning). If I switch it to Plan Mode and ask it to write an .MD file, it does so.

Haven’t used Cursor or my BYOK setting yesterday. I assume its the same error.

An additional Request ID:
7110c29a-47b5-4639-9a75-a4ed2b39359d

In that chat, the Agent was able to write files using GPT-5.5. However, after the first run, when trying to continue, I got the following error:
Provider returned error: { “error”: { “message”: “Invalid ‘input[142].call_id’: string too long. Expected a string with maximum length 64, but got a string with length 83 instead.”, “type”: “invalid_request_error”, “param”: “input[142].call_id”, “code”: “string_above_max_length” } }

Currently, I also encounter issues using sub-agents.

Request ID:

9c36e99b-ad45-4c47-9ab2-a026a4fb8ffb.

Agent comment: Subagent fanout was attempted but blocked by tool argument serialization.

I just post issues I face regarding BYOK and GPT-5.5 here. If the information provided is already sufficient, I can stop doing so.

Sub-agents work in a different workspace and repo, using a new chat and the classic IDE. No idea whether a difference between classic IDE and Agent Window can have an impact. I dont think so. The related Request ID:
c1446868-d80f-40e0-be17-758bece6daf1

The “starts normally, then aborts” part is the useful signal here.

That usually points to a streaming or payload-shape mismatch more than a plain auth problem. If the same endpoint works outside Cursor, the best evidence would be the final chunk or error returned by the proxy right when Cursor stops reading.

Hi Colin, I only recently managed to find the time to isolate the error. Based on my logs, I got the following, AI-generated report. I hope this helps in case other people encounter a similar error:

GPT-5.5 BYOK/custom endpoint: Shell tool works, ApplyPatch/custom_tool_call aborts

Request ID: 16b669ac-93b6-44fe-b9d7-4c33f150acbd

I am following up on my earlier BYOK/custom endpoint investigation. I ran a focused reproduction to separate three possible issues:

  1. Basic model access / authentication / endpoint routing
  2. Normal tool calls such as Shell
  3. Cursor file-editing via ApplyPatch / custom_tool_call

The result is that GPT-5.5 works for Shell tool calls, including shell-only file creation, but appears to abort or fail when the model returns an ApplyPatch / custom_tool_call.

Setup

  • Cursor with OpenAI BYOK enabled.
  • Override OpenAI Base URL enabled, pointing to a custom OpenAI-compatible endpoint.
  • Model selected in Cursor: GPT-5.5 High.
  • Tested in fresh Cursor chats.
  • I am intentionally describing the endpoint generically because I do not think the specific local forwarding/proxy setup is the relevant part of the bug.

Capability ladder before the focused repro

Before isolating the file-editing path, I tested the following:

  • pwd
  • grep/search
  • file reading
  • GitHub CLI command, e.g. gh pr list
  • harmless file write through terminal
  • repo file creation through terminal
  • MCP usage

These worked. That suggested the issue was not basic model access, not normal tool calling, not Shell execution, and not MCP routing.

The problem appeared specifically when the agent needed to write or edit files through Cursor’s editing tools.

Focused Test A: Shell-only file creation

Prompt used in a fresh Cursor chat:

Use only terminal. Do not use ApplyPatch, file edit tools, MCPs, or subagents.

Run exactly one shell command that creates plans/_gpt55_shell_only_write.md with 5 lines of markdown using a heredoc.

Then run exactly one shell command to read it back with sed -n '1,20p'.

Stop after reading it back.

Test A result

This worked.

The file plans/_gpt55_shell_only_write.md was created and read back. Endpoint logs show a normal Shell function call and a completed response with no upstream error.

So GPT-5.5 BYOK can use Shell and can create files through Shell.

Focused Test B: ApplyPatch-only file creation

Prompt used in a separate fresh Cursor chat:

Use ApplyPatch only. Do not use terminal, MCPs, or subagents.

Create exactly one file:

plans/_gpt55_applypatch_write.md

The file content must be exactly:

# GPT-5.5 ApplyPatch Write Test

Line 1: applypatch path
Line 2: file creation
Line 3: stop after verification

After creating the file, read it back using the normal file read tool. Stop after reading it back.

Test B result

This appeared to abort in Cursor. The file was not applied/read back in the expected way, and the chat did not produce a useful completion.

However, the endpoint logs do not show an upstream failure. They show that GPT-5.5 generated a valid ApplyPatch custom tool call, equivalent to:

*** Begin Patch
*** Add File: <workspace>/plans/_gpt55_applypatch_write.md
+# GPT-5.5 ApplyPatch Write Test
+
+Line 1: applypatch path
+Line 2: file creation
+Line 3: stop after verification
*** End Patch

The response metadata shows custom_tool_call, name: "ApplyPatch", status: "completed", followed by a completed response and no upstream error.

Key difference

The two tests differ by tool-call type:

Shell write:
  regular function/tool call
  Cursor executes it
  file is created

ApplyPatch write:
  custom_tool_call
  endpoint response completes successfully
  Cursor aborts / does not apply the patch or continue correctly

This makes the failure look like Cursor’s handling of ApplyPatch / custom_tool_call in the GPT-5.5 BYOK/custom endpoint path, rather than a general model, authentication, endpoint, or Shell-tool issue.

Why this does not look like an upstream failure

The same setup successfully handled normal Shell tool calls.

The failing ApplyPatch case also returned a completed endpoint response. GPT-5.5 generated the patch call successfully, and the endpoint response had no upstream error.

So the failure appears to happen after Cursor receives the completed ApplyPatch custom tool call, likely in Cursor’s local agent loop or custom tool execution layer.

Current workaround

GPT-5.5 BYOK/custom endpoint seems usable for:

planning
reading
grep / rg
GitHub CLI commands
CI monitoring
reviewing diffs
shell-only diagnostics
shell-only file creation

I am avoiding it for:

ApplyPatch
Cursor file-edit tools
direct repo edits
large implementation loops that require patching files

For now, my workaround is to use GPT-5.5 for planning/review/checking and another model/path for implementation and file editing.

Minimal repro summary

  1. Enable OpenAI BYOK in Cursor.
  2. Enable Override OpenAI Base URL to a custom OpenAI-compatible endpoint.
  3. Select GPT-5.5 High.
  4. Run a Shell-only file creation prompt. It works.
  5. Run an ApplyPatch-only file creation prompt. Cursor aborts or does not complete properly.
  6. Inspect endpoint logs: upstream returns a completed response with no upstream error, and the model generated a valid ApplyPatch / custom_tool_call.

This suggests a Cursor-side issue in ApplyPatch / custom_tool_call handling for GPT-5.5 BYOK/custom OpenAI-compatible endpoints.

Thanks @user691! That helps a lot.

ApplyPatch is an OpenAI “custom tool” (grammar-based), while Shell and the rest are standard function tools. It looks like on your custom endpoint the ApplyPatch custom tool isn’t surviving the round trip (the tool call never reaches Cursor) so file edits fail while everything else works.

If you run the proxy/forwarder yourself, make sure it passes type:"custom" tools through unchanged and relays the resulting custom_tool_call back verbatim, rather than dropping tools/tool-calls it doesn’t recognize.

To dig in further, could you share a bit about the endpoint:

  • What’s serving it (OpenRouter, LiteLLM, a custom forwarder, something else)?
  • Does it target /chat/completions or /responses?
  • Is it translating between the two APIs at all?
  • If you have endpoint logs: does the ApplyPatch custom_tool_call appear in the request it receives, and again in the response it sends back to Cursor?

Thanks a lot for taking the time, I hope this reply helps:

I dug into the traffic on my side and can confirm the ApplyPatch custom tool isn’t surviving the round trip. My endpoint sits in front of an upstream that speaks the newer Responses-style API, so requests get translated on the way there and the reply gets translated back into chat/completions for Cursor. The translation back is where it breaks:

  • The request going upstream is fine — the type:"custom" ApplyPatch tool passes through and the model does call it. Upstream returns a valid custom_tool_call.
  • But on the return translation, only standard function_call outputs get mapped into tool_calls. Anything that isn’t a function_call — i.e. the custom_tool_call — is silently dropped. Cursor gets back finish_reason:"stop" with content:null and tool_calls:null, so the edit just stalls.
  • Everything else works because all the other tools (Shell, read, search, etc.) are ordinary type:"function" tools, which translate correctly. ApplyPatch is the only type:"custom" one, so it’s the only thing that fails. That isolation made it easy to spot once I had logs.

Answering your questions as best I can without getting too into the weeds on my specific setup:

  • What’s serving it: a self-hosted forwarder in front of an upstream OpenAI-compatible provider (not OpenRouter).
  • Endpoint: Cursor hits /chat/completions.
  • Is it translating between the two APIs: yes — that’s the crux. It translates /chat/completions → the upstream’s Responses-style API and back. The forward direction handles custom tools fine; the reverse direction has no handler for custom_tool_call and drops it.
  • Endpoint logs: yes to both halves of your question — the ApplyPatch custom_tool_call does appear in the response the forwarder receives from upstream, but it does not appear in what gets sent back to Cursor. It’s lost precisely in the responses→chat/completions translation.

One thing worth flagging for anyone hitting this: it seems to have started when ApplyPatch moved to the grammar-based type:"custom" format. Setups that previously sent the edit tool as a plain function tool wouldn’t have seen it, which probably explains why it’s only surfacing now for a subset of custom-endpoint users. The fix on the forwarder side is exactly what you said, relay type:"custom" tools through unchanged and map the returned custom_tool_call back verbatim instead of dropping unrecognized tool-call types.