#[coding help]Deepseek v3.1 doesn't activate reasoning

2 messages · Page 1 of 1 (latest)

jovial ermine
#

Hey, I implemented the reasoning into my API code here:

body: JSON.stringify({
  model: model,
  "reasoning": {
    "enabled": true
  },
  temperature: parseFloat(localStorage.temperature || 0.7),
  messages: [
    { role: "system", content: system },
    { role: "user",   content: prompt }
  ]
})

But it doesn't work, I can't see it.
I also tried this:



      const response = await fetch(url, {
        method : "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${token}`
        },
        body: JSON.stringify({
          model: model,
          temperature: parseFloat(localStorage.temperature || 0.7),
          messages: [
            { role: "system", content: system },
            { role: "user",   content: prompt }
          ],
          "reasoning": {
            // Optional: Default is false. All models support this.
            "exclude": false, // Set to true to exclude reasoning tokens from response


            // Or enable reasoning with the default parameters:
            "enabled": true // Default: inferred from `effort` or `max_tokens`
          }
        }),
        signal                                      // ← abort signal
      });

I grabbed the code part for the reasoning from here:
https://openrouter.ai/docs/use-cases/reasoning-tokens#enable-reasoning-with-default-config

You can test the API on my website and edit the source code:
https://perchance.org/6pujv6ntxm#edit

(You will need the password to save it permanently)
You need to insert your own API key and change it to
deepseek/deepseek-chat-v3.1:free

jovial ermine
#

I removed the code, tried then
deepseek/deepseek-r1-0528:free
And it worked. I switched back to V3.1 AND I erased the code, but it still worked and it could use reasoning with v3.1

But I think the trigger is not the script, it's telling the AI to think about it and giving it a task with more deeper context.