“Model name is not valid” error when using a custom OpenAI-compatible model

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I’m on the Ultra plan and trying to use a custom model from LM Studio (running locally, exposed via ngrok) through Cursor’s OpenAI-compatible endpoint settings.

The endpoint is configured correctly: curl https://thisis-some-stuff.ngrok-free.dev/v1/models returns all my models with the expected IDs, for example:

{
“id”: “qwen3-coder-next-mlx”,
“object”: “model”,
“owned_by”: “organization_owner”
}

After adding “qwen3-coder-next-mlx” via “Add Custom Model” and selecting it, every request fails with:

AI Model Not Found
Model name is not valid: “qwen3-coder-next-mlx”

Steps to Reproduce

  1. Start the LM Studio server locally (port 1234) and expose it via ngrok.
  2. Verify: curl h t t p s / /thisis-some-stuff.ngrok-free.dev/v1/models returns “qwen3-coder-next-mlx”.
  3. In Cursor Settings → Models, enable “Override OpenAI Base URL” and set it to https://thisis-some-stuff.ngrok-free.dev/v1.
  4. Enter and verify the API key.
  5. Click “Add Custom Model” and add “qwen3-coder-next-mlx”.
  6. Select this model in Chat/Agent and send any prompt.
  7. Error: AI Model Not Found — Model name is not valid: “qwen3-coder-next-mlx”.

Expected Behavior

Cursor should send the request to the configured OpenAI-compatible endpoint using the custom model ID and return the model’s response, since the same model ID is listed by /v1/models and works via curl.

Operating System

MacOS

Version Information

Cursor Version: 3.28.7
OS: macOS 27.2
LMStudio: 0.4.28 (Build 2)

For AI issues: which model did you use?

Custom model via OpenAI-compatible endpoint (LM Studio): qwen3-coder-next-mlx
Also tried other local models and aliasing a model as “GPT-4” — same error.

Additional Information

  • Plan: Ultra
  • LM Studio version: 0.4.28 (Build 2)
  • The endpoint works correctly outside Cursor via curl (/v1/models and /v1/chat/completions).
  • Also tried localhost:1234/v1 directly instead of ngrok — same error.
  • Tried different models and name overrides — the error is always the same.

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey there! This is almost always a config detail rather than your endpoint, and it’s quick to fix:

  1. Turn the OpenAI API Key toggle ON in Settings → Models - a saved key isn’t enough, and the switch can flip off after an update. Re-enter the key if needed.
  2. Use the exact model ID qwen3-coder-next-mlx, and don’t alias it to a built-in name like GPT-4 (that routes to Cursor’s own model and throws this same error).
  3. Keep the public ngrok URL, not localhost - BYOK requests route through Cursor’s servers, so localhost isn’t reachable.

Heads-up: while the OpenAI key is on, Cursor’s built-in models (Auto, Composer, Claude) can’t be used at the same time - it’s one or the other.

If it still errors after that, send a Request ID (chat top-right → Copy Request ID) and I’ll check whether your key is coming through.

Thank you this is help.