Custom OpenAI-compatible Ollama model rejected by native Cursor Agent — "Model name is not valid" (3.28.7)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Cursor IDE 3.28.7 rejects custom OpenAI-compatible models in the native Agent chat with the error:

AI Model Not Found — Model name is not valid: "qwencoder30b"

I am trying to use a locally hosted Ollama model (qwen3-coder:30b) through Cursor’s native Agent interface, using a custom OpenAI API key and an overridden API base URL.

The model is exposed through an authenticated Node.js reverse proxy and a Cloudflare HTTPS tunnel.

Both /v1/models and /v1/chat/completions work correctly when tested externally using curl. The chat completion endpoint successfully generates a response.

However, when I select the custom model in Cursor’s native Agent chat, Cursor rejects its identifier.

The issue occurred in Cursor 3.27.22 and persists after updating to 3.28.7.

I would like to know whether this is a bug in model validation or a limitation of the custom API integration in native Agent mode.

Steps to Reproduce

  1. Install Ollama and download the qwen3-coder:30b model.
  2. Expose Ollama’s OpenAI-compatible API through an authenticated HTTPS reverse proxy.
  3. Verify that /v1/models responds with HTTP 200.
  4. Verify that /v1/chat/completions successfully generates a response using curl.
  5. Open Cursor IDE → Settings → Models.
  6. Configure a custom OpenAI API key and enable Override OpenAI Base URL, pointing it to the HTTPS /v1 endpoint.
  7. Add a custom model named qwencoder30b.
  8. Open a new conversation in Cursor’s native Agent chat.
  9. Select qwencoder30b and send a simple message such as “Hello”.

Actual result:

ActionRequiredError: AI Model Not Found — Model name is not valid: "qwencoder30b"

The same issue occurs when using the original model identifier qwen3-coder:30b.

Expected Behavior

Cursor should recognize the custom model configured under Settings → Models and forward compatible requests to the specified OpenAI-compatible API endpoint.

I expect to be able to use my locally hosted Ollama model directly within Cursor’s native Agent chat, including coding assistance and tool execution where supported.

If arbitrary custom model identifiers are not supported in Agent mode, Cursor should clearly indicate this limitation instead of allowing the model to be configured and selected before returning “Model name is not valid”.

Operating System

MacOS

Version Information

Cursor IDE 3.28.7 (Universal)
Channel: Stable
Platform: macOS (darwin, arm64)
Agent layout: unifiedAgent

Also reproduced on Cursor IDE 3.27.22.

For AI issues: which model did you use?

Custom model: qwencoder30b

Underlying Ollama model: qwen3-coder:30b (Q4_K_M, 30.5B parameters).

Provider: Ollama, using its OpenAI-compatible API through an authenticated HTTPS reverse proxy.

I also tested the original identifier qwen3-coder:30b, with the same model validation error.

For AI issues: add Request ID with privacy disabled

writeInitialRequest
8358a48e79555aa3bbf7028994dde27d-0f9a0dfbca5435d8
Request ID unavailable. The request fails with “AI Model Not Found” during custom model validation. I can provide additional diagnostic information if required.

Additional Information

Environment and API verification

  • Cursor IDE: 3.28.7 (Stable)
  • OS: macOS, Apple Silicon (arm64)
  • RAM: 32 GB unified memory
  • Local model server: Ollama
  • Model: qwen3-coder:30b
  • API: OpenAI-compatible
  • Connection: Ollama → Node.js authenticated reverse proxy → Cloudflare HTTPS tunnel → Cursor

The external HTTPS API has been successfully tested:

  • GET /v1/models → HTTP 200
  • POST /v1/chat/completions → Successful response

Example API response:

{
  "object": "chat.completion",
  "model": "qwen3-coder:30b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "OK"
      },
      "finish_reason": "stop"
    }
  ]
}

Cursor Developer Tools error:

[composer] Error in AI response ActionRequiredError:
AI Model Not Found
Model name is not valid: "qwencoder30b"

at PDy (workbench.desktop.main.js:2027:131429)
at xKo._executeTurn (workbench.desktop.main.js:2027:153901)
at async xKo.executeTurn (workbench.desktop.main.js:2027:141985)
at async pme.runAgentLoop (workbench.desktop.main.js:2022:17115)
at async MLa.streamFromAgentBackend
at async MLa.getAgentStreamResponse

Additional errors:

[Extension Host:agent-exec] [otel.error]
writeInitialRequest
You can only call end() on a span once.

[composer] Failed to resolve hook model legacy slug undefined

Questions for the Cursor team:

  1. Does the native Cursor Agent support arbitrary custom OpenAI-compatible model identifiers?
  2. Is the model name being rejected by Cursor’s backend before the request is forwarded to the custom API?
  3. Is there an officially supported method for using locally hosted Ollama models within Cursor’s native Agent?
  4. Are custom OpenAI API keys and base URL overrides supported in Agent mode, including tool calling?

My goal is specifically to use the native Cursor Agent interface, not a separate chat extension.

Thank you for your assistance.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey there! Two things to try first:

  1. In Settings → Models, make sure the OpenAI API Key toggle is actually ON (a saved key alone isn’t enough), and use the exact model ID qwencoder30b without aliasing it to a built-in name like GPT-4.
  2. Keep your public HTTPS tunnel - localhost won’t work, since these requests route through Cursor’s servers.

That usually clears “Model name is not valid.” The bigger thing: custom OpenAI-compatible models (including a local Ollama model behind a tunnel) are built for the Ask / chat experience. The native Agent runs on Cursor’s own models, so an arbitrary custom model with full tool-calling isn’t the supported path there today and can fail even once the key connects. It’s a reasonable ask though, so we’ll track interest here.

If the key toggle is on and it still errors, drop a Request ID (chat top-right → Copy Request ID) and I’ll check whether your key is coming through. Bring your own API key