Skip to content

Removing thinking tokens from nano-gpt provider #2531

Closed

Description

@code728

I'm trying to strip thinking tokens from various models served by nano-gpt.com. There are two methods. I have verified they work with direct curl commands, but when I set it up in the opencode config, I either get an API error or the thinking tokens are not stripped (so the option is not forwarded).

Here's a sample config that generates an AI_APICallError (works fine without the :reasoning-exclude suffix):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "nanogpt": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://nano-gpt.com/api/v1"
      },
      "models": {
        "Qwen/Qwen3-235B-A22B-Thinking-2507:reasoning-exclude": {}
      }
    }
  }
}

Another sample config that works but fails to strip thinking tokens:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "nanogpt/Qwen/Qwen3-235B-A22B-Thinking-2507",
  "provider": {
    "nanogpt": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "NanoGPT",
      "options": {
        "baseURL": "https://nano-gpt.com/api/v1"
      },
      "models": {
        "Qwen/Qwen3-235B-A22B-Thinking-2507": {
          "options": {
            "NanoGPT": {
              "reasoning": { "exclude": true }
            }
          }
        }
      }
    }
  }
}

Nano-gpt documentation here: https://docs.nano-gpt.com/api-reference/endpoint/chat-completion

This curl command works fine and strips the think tokens:

curl -sS https://nano-gpt.com/api/v1/chat/completions \
  -H "Authorization: Bearer $NEVER_ECHO_MY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model":"Qwen/Qwen3-235B-A22B-Thinking-2507:reasoning-exclude",
    "messages":[{"role":"user","content":"Say hi"}]
  }'

gpt5 is sending me in circles and I can't figure this out. I used Qwen as an example here but the issues hold true for other models too. Somehow the suffix is breaking the request?

Activity

  1. arsham commented on Sep 10, 2025

    @arsham

    Would this help? I think you can try to log the object to see what you can delete from.

  2. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

    [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions