How to tell whether this is the cause

The request doesn’t return an error. It takes much longer than usual and comes back empty: in the OpenAI-compatible API, choices[0].message.content arrives as empty text; in your program, that usually ends in “the response is not valid JSON” or a blank cell. If you repeat it, it happens again.

The clue is in the tokens used. In the case of this guide, the response showed completion_tokens 3,661 and total 4,096: exactly the size of the context. The model didn’t freeze; it ran out of room before it got to write the answer.

Fix 1: turn off reasoning

If the task is pulling out data, classifying or filling in a JSON, it usually doesn’t need to think. Each way of using Ollama has its own switch. In Windows PowerShell, use Invoke-RestMethod instead of curl, which is a different command there and doesn’t get along with JSON quotes.

Be careful with --hidethinking: according to Ollama’s official announcement, it only hides the reasoning on screen; it does not turn it off. The model keeps thinking and using up context.

Turn off think depending on how you use Ollama
  1. Console: ollama run qwen3.5:9b --think=false
  2. Inside an ollama run session: /set nothink
  3. Native API (/api/chat or /api/generate): add "think": false to the request body
  4. PowerShell: $body = @{ model = "qwen3.5:9b"; stream = $false; think = $false; messages = @(@{ role = "user"; content = "Summarize in one sentence: the meeting is postponed to Monday." }) } | ConvertTo-Json -Depth 5
  5. PowerShell: Invoke-RestMethod -Uri http://127.0.0.1:11434/api/chat -Method Post -ContentType "application/json" -Body $body
  6. OpenAI-compatible API (/v1/chat/completions): "reasoning_effort": "none"

"think": false and "reasoning_effort": "none" were tested with Ollama 0.40.14; --think=false and /set nothink come from Ollama’s documentation.

Fix 2: let it think, but with more room

If you want it to reason (multi-step problems, reviewing a text with traps), raise the context so that your message, the reflection and the answer all fit. With 32,768 tokens, the small models we tested worked, and the speed dropped only slightly (86, 55 and 80 tokens per second with qwen3.5:4b, qwen3.5:9b and gemma4:12b). We didn’t measure how much qwen3.5:9b thinks with that room, so also set a maximum time in your program.

The OpenAI-compatible API doesn’t let you change the context on each request; Ollama’s documentation says to create your own model with a Modelfile.

Raise the context
  1. Server (PowerShell): $env:OLLAMA_CONTEXT_LENGTH = "16384"; ollama serve
  2. Native API: "options": { "num_ctx": 16384 }
  3. For /v1: Modelfile with FROM qwen3.5:9b and PARAMETER num_ctx 16384; then ollama create qwen9b-16k -f Modelfile

Commands from Ollama’s documentation (FAQ and Modelfile).

How to check that it’s fixed

Repeat the same request and look at three things: the time (from about 60 s to a few seconds; in our test, 3.6 s), that completion_tokens is small and well below the context, and that the content isn’t empty and is valid JSON if you asked for it. In the native API, with thinking enabled, the reflection appears in a separate field (thinking) and the answer in content: if content is empty and thinking is full, this is the problem.

And protect your program so it doesn’t swallow the problem silently: if the content comes back empty, make it fail with a clear message instead of saving a blank row.

Check in Python
  1. content = d["choices"][0]["message"].get("content") or ""
  2. if not content.strip():
  3. raise ValueError("the model returned an empty response (did it run out of context while thinking?)")

Check used in the tests.

Why it happens

Models like qwen3.5 think by default: they write a reasoning before the final answer. Those tokens take up room in the context just like your message. With the context Ollama picked on the test PC (4,096 tokens; the log says so in the “vram-based default context” line), a message of about 435 tokens left about 3,600 for thinking and answering, and the reasoning used up all of it.

How much a model thinks is hard to predict. With another local server and a much larger model, we measured 54,512 tokens of hidden reasoning in a single answer. It is not a rare bug: it is what these models do if nothing holds them back.

The test numbers

Test PC with Windows 11 Pro, an NVIDIA graphics card with 16 GB and Ollama 0.40.14. Task: pull the actions out of some meeting minutes as JSON, calling qwen3.5:9b through the OpenAI-compatible API (/v1) with a response_format of type json_object.

  • Without turning off the reasoning: two attempts, about 60 s each, empty text; completion_tokens 3,661 out of a total of 4,096.
  • With reasoning_effort "none": 3.6 s and valid JSON.
  • But the fix does not improve quality: qwen3.5:9b left the owner and date fields empty instead of writing “PENDING”, and the automatic check sent the minutes for review with 4 warnings (5 in the second set of minutes). gemma4:12b, with the same request, took 11.2 s and passed without warnings.
  • In the rest of the local tests (speed, document search, invoice reading and quality) the native API was called with "think": false from the start.

Other empty responses that aren’t reasoning

  • The message no longer fits: an agent like OpenCode sent 22,919 tokens before your request, with a 4,096 context (7,440 with an empty global configuration). The model never gets to see what you are asking. We explain it in OpenCode with Ollama not working.
  • The model doesn’t accept think: the documentation says to check /api/show; if it doesn’t support it, the switch changes nothing.
  • gpt-oss uses levels (low, medium and high) instead of on and off, according to Ollama’s documentation.
  • The model doesn’t load: if it is bigger than your VRAM, it can end in a 500 error. That happened to qwen3.6:35b on 16 GB: Ollama error 500 “unable to load model”.

Frequently asked questions

How do I turn off thinking in Ollama?In the console, --think=false when you start it or /set nothink inside the session; in the native API, "think": false; in the OpenAI-compatible one, "reasoning_effort": "none", which is what we used in the test.

How do I turn off Qwen’s thinking in Ollama?The same as with any model that reasons: with qwen3.5:9b, "reasoning_effort": "none" through /v1 solved it.

Do I lose quality by turning it off?It depends on the task. For pulling out data with good instructions, gemma4:12b without reasoning met 24 of 24 criteria in a batch of meeting minutes with JSON output. We didn’t measure the same task with reasoning and a large context.

Is it enough to hide it?No: --hidethinking only hides the reflection; the model keeps spending context and time.