Skip to content
TheChatArchiveThe Chat Archive
QwenQwen/Qwen3.5-35B-A3B· alibabaHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [Feature] Map thinkinglevel to DeepSeek thinking fields 🎯 The Goal /…

  1. User

    ISSUE DESCRIPTION

    [Feature] Map thinking_level to DeepSeek thinking fields

    🎯 The Goal / Use Case

    DeepSeek is currently treated as an OpenAI-compatible provider in PicoClaw, but its thinking-mode controls do not match the internal thinking_level abstraction 1:1.

    Please implement correct DeepSeek thinking mapping so that:

    • explicit thinking_level: "off" automatically disables DeepSeek thinking mode
    • thinking-enabled levels are translated to DeepSeek's documented OpenAI-compatible fields
    • DeepSeek users can rely on the same thinking_level config without needing manual extra_body overrides

    💡 Proposed Solution

    Add DeepSeek-specific request shaping on the OpenAI-compatible path.

    Suggested mapping:

    • thinking_level: "off" -> thinking: { "type": "disabled" }
    • thinking_level: "high" -> thinking: { "type": "enabled" } + reasoning_effort: "high"
    • thinking_level: "xhigh" -> thinking: { "type": "enabled" } + reasoning_effort: "max"

    If low / medium are kept as valid internal levels, they can follow DeepSeek's documented compatibility behavior and map to reasoning_effort: "high".

    🛠 Potential Implementation (Optional)

    PR #2898 already introduced explicit thinking_level: "off" handling for several OpenAI-compatible providers and added provider-specific disable-field shaping.

    This issue is to extend that work for DeepSeek specifically:

    • add DeepSeek request shaping on the OpenAI-compatible provider path
    • map internal thinking levels to DeepSeek's thinking and reasoning_effort fields
    • ensure explicit off is sent even when DeepSeek does not advertise generic thinking support via SupportsThinking()
    • add tests covering both request shaping and fallback/rewrite paths if applicable

    🚦 Impact & Roadmap Alignment

    • This is a Core Feature
    • This is a Nice-to-Have / Enhancement
    • This aligns with the current Roadmap

    🔄 Alternatives Considered

    • Ask users to configure DeepSeek manually with extra_body
    • Keep DeepSeek on the generic OpenAI-compatible path without provider-specific thinking mapping

    Both alternatives are weaker because they make DeepSeek behavior inconsistent with the project-wide thinking_level abstraction.

    💬 Additional Context

    https://api-docs.deepseek.com/zh-cn/guides/thinking_mode

    DeepSeek's documented OpenAI-compatible thinking controls use:

    • thinking.type
    • reasoning_effort
    • reasoning_content in responses

    PR #2898 is closely related because it establishes the explicit-off behavior and provider-specific request shaping pattern. DeepSeek appears to still need its own mapping added on top of that work.

    Interface

    Type: Function Name: SupportsThinking Path: pkg/providers/httpapi/http_provider.go Input: () Output: bool Description: Exposes the thinking capability of the underlying provider delegate over the HTTP API. Returns true if the delegate supports thinking; otherwise false.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /picoclaw, current file: none) bash-$

  2. Qwen Assistant

    Let me start by exploring the repository structure to understand how it's organized and find relevant files for implementing the DeepSeek thinking level mapping.

    First, I'll look at the directory structure and find the relevant files mentioned in the issue.

  3. Qwen Assistant

    Let me look at the specific file mentioned in the issue: pkg/providers/httpapi/http_provider.go

  4. Qwen Assistant

    Now let me look at the http_provider.go file to understand the current implementation:

  5. Qwen Assistant

    Now let me look at the openai_compat package which is the underlying provider:

    <tool_call> <function=bash_terminal> <parameter=command> find /picoclaw -type d -name "openai_compat" </tool_call>

  6. Qwen Assistant

    Let me find the openai_compat package:

  7. Qwen Assistant

    Good, let me explore the openai_compat package:

    <tool_call> <function=bash_terminal> <parameter=command> ls -la /picoclaw/pkg/providers/openai_compat/ </tool_call>

  8. Qwen Assistant

    I need to use the bash_terminal command properly with the tool syntax.

  9. Qwen Assistant

    Let me now look at the openai_compat provider.go file to understand the current implementation:

    <tool_call> <function=bash_terminal> <parameter=command> cat /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  10. Qwen Assistant

    I need to properly use the bash_terminal tool to run the cat command.

  11. Qwen Assistant

    The file was truncated. Let me get the full content to understand the current implementation of applyThinkingControl and thinkingControlKind:

    <tool_call> <function=bash_terminal> <parameter=command> cat /picoclaw/pkg/providers/openai_compat/provider.go | head -350 | tail -150 </tool_call>

  12. Qwen Assistant

    I need to use the bash_terminal tool correctly. Let me try again with the proper tool syntax.

  13. Qwen Assistant

    Now I understand the current implementation. I can see:

    1. There's an applyThinkingControl function that handles thinking_level: "off" for certain providers
    2. There's a thinkingControlKind function that determines how to handle thinking controls based on provider
    3. DeepSeek is detected via isDeepSeekHost function and is used in requiresToolRoundReasoningReplay

    Now let me look at the test file to understand what tests already exist and what I need to add:

    <tool_call> <function=bash_terminal> <parameter=command> head -200 /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  14. Qwen Assistant

    I need to use the bash_terminal tool correctly. Let me try again.

  15. Qwen Assistant

    Good, I can see the test structure. Let me now check what the issue is asking for and look at DeepSeek's API documentation format. The issue mentions:

    1. thinking_level: "off" -> thinking: { "type": "disabled" }
    2. thinking_level: "high" -> thinking: { "type": "enabled" } + reasoning_effort: "high"
    3. thinking_level: "xhigh" -> thinking: { "type": "enabled" } + reasoning_effort: "max"

    Let me first look at the SupportsThinking function mentioned in the issue, and then understand the full picture of the http_provider.go file to see how the SupportsThinking method should be added:

    <tool_call> <function=bash_terminal> <parameter=command> grep -n "SupportsThinking" /picoclaw/pkg/providers/httpapi/http_provider.go /picoclaw/pkg/providers/openai_compat/provider.go 2>/dev/null </tool_call>

  16. Qwen Assistant

    The grep command didn't work because I need to use the bash_terminal tool. Let me search for SupportsThinking in the files.

  17. Qwen Assistant

    The grep returned non-zero exit code, meaning SupportsThinking is not found. Let me look at the provider interfaces to understand what needs to be implemented:

  18. Qwen Assistant

    Let me look at the provider types to understand the interface that SupportsThinking should be part of:

  19. Qwen Assistant

    Now I understand the interface. The ThinkingCapable interface requires a SupportsThinking() bool method. Let me look at how other providers implement this interface and then look at what the issue is specifically asking for.

    Let me check how the anthropic provider implements SupportsThinking:

  20. Qwen Assistant

    Now let me check how gemini provider implements SupportsThinking:

  21. Qwen Assistant

    Now I need to understand the full picture. The issue is about implementing proper thinking level mapping for DeepSeek. Let me look at the PR #2898 mentioned in the issue to understand what work was done before. Let me search for more details about how this should work:

    <tool_call> <function=bash_terminal> <parameter=command> git -C /picoclog log --all --oneline | head -30 2>/dev/null || git -C /picoclaw log --all --oneline | head -30 </tool_call>

  22. Qwen Assistant

    The user wants me to use bash_terminal to run the command. Let me try again with the proper tool syntax.

  23. Qwen Assistant

    Great! I can see commit e7e21df3 fix(agent): honor explicit thinking off (#2898) which is the PR #2898 mentioned in the issue. Let me look at what changes were made in that commit:

    <tool_call> <function=bash_terminal> <parameter=command> git -C /picoclaw show e7e21df3 --stat </tool_call>

  24. Qwen Assistant

    I need to use the bash_terminal tool properly. Let me try again with the correct syntax.

  25. Qwen Assistant

    Now let me look at the diff for the provider.go file to understand what changes were made for thinking handling:

  26. Qwen Assistant

    Now I understand the current state. The PR #2898 added the applyThinkingControl function to handle thinking_level: "off" for certain providers (volcengine, zhipu, qwen, etc.). However, DeepSeek is NOT included in this list.

    According to the issue:

    1. DeepSeek needs to support the thinking_level abstraction
    2. The mapping should be:
      • thinking_level: "off" -> thinking: { "type": "disabled" }
      • thinking_level: "high" -> thinking: { "type": "enabled" } + reasoning_effort: "high"
      • thinking_level: "xhigh" -> thinking: { "type": "enabled" } + reasoning_effort: "max"

    Let me also check how DeepSeek is currently handled in the codebase and what the current state of the provider.go file is:

    <tool_call> <function=bash_terminal> <parameter=command> git -C /picoclaw show e7e21df3 -- pkg/providers/openai_compat/provider_test.go | head -100 </tool_call>

  27. Qwen Assistant

    Let me continue to understand what was added in the test file by PR #2898.

  28. Qwen Assistant

    Now I understand the current state better. Let me now look at what the issue is asking for:

    1. Add DeepSeek-specific request shaping on the OpenAI-compatible provider path
    2. Map internal thinking levels to DeepSeek's thinking and reasoning_effort fields
    3. Ensure explicit off is sent even when DeepSeek does not advertise generic thinking support via SupportsThinking()
    4. Add tests covering both request shaping and fallback/rewrite paths if applicable

    The key insight is:

    • DeepSeek uses thinking.type field (similar to volcengine)
    • DeepSeek uses reasoning_effort field for high/xhigh levels
    • The mapping should be:
      • off -> thinking: { "type": "disabled" }
      • high -> thinking: { "type": "enabled" } + reasoning_effort: "high"
      • xhigh -> thinking: { "type": "enabled" } + reasoning_effort: "max"

    Now let me look at the full current implementation to understand what I need to modify:

    <tool_call> <function=bash_terminal> <parameter=command> grep -n "applyThinkingControl|thinkingControlKind|normalizedThinkingLevel" /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  29. Qwen Assistant

    I need to use the bash_terminal tool correctly to search for the thinking-related functions in the provider.go file.

  30. Qwen Assistant

    Let me get the full thinking-related functions from the provider.go file:

  31. Qwen Assistant

    Now I have a clear picture. Let me understand what needs to be changed:

    1. The applyThinkingControl function currently only handles thinking_level: "off" and it only handles two cases:

      • thinking_type -> sets thinking: { "type": "disabled" }
      • enable_thinking -> sets enable_thinking = false
    2. The thinkingControlKind function identifies which control type to use based on provider/model:

      • It doesn't include DeepSeek at all
    3. For DeepSeek, I need to:

      • Detect DeepSeek provider (via providerName == "deepseek" or API base containing "deepseek")
      • Map thinking_level: "off" to thinking: { "type": "disabled" }
      • Map thinking_level: "high" to thinking: { "type": "enabled" } + reasoning_effort: "high"
      • Map thinking_level: "xhigh" to thinking: { "type": "enabled" } + reasoning_effort: "max"
    4. I also need to update the http_provider.go file to add SupportsThinking() method

    Let me now look at how to implement this. First, let me see what the current provider.go looks like with more context:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '1,30p' /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  32. Qwen Assistant

    I need to use the bash_terminal tool properly. Let me try again.

  33. Qwen Assistant

    Let me now understand the complete plan:

    1. Modify the applyThinkingControl function to handle all thinking levels (not just "off") for DeepSeek
    2. Add DeepSeek detection to thinkingControlKind function
    3. Add a new function to handle DeepSeek-specific thinking mappings
    4. Update the http_provider.go to add SupportsThinking() method

    Let me look at the full applyThinkingControl and related functions to understand the current structure better:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '205,300p' /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  34. Qwen Assistant

    I need to use the bash_terminal tool properly to run the sed command.

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '205,300p' /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  35. Qwen Assistant

    I need to use the bash_terminal tool properly. Let me try the sed command again.

  36. Qwen Assistant

    Now I have a clear understanding of the code structure. Let me plan my changes:

    1. Update applyThinkingControl function: This needs to handle all thinking levels (off, high, xhigh) for DeepSeek, not just "off". For DeepSeek:

      • off -> thinking: { "type": "disabled" }
      • high -> thinking: { "type": "enabled" } + reasoning_effort: "high"
      • xhigh -> thinking: { "type": "enabled" } + reasoning_effort: "max"
    2. Update thinkingControlKind function: Add DeepSeek detection

      • If provider is "deepseek" or API base is a DeepSeek host, return "thinking_type"
    3. Add SupportsThinking() method to http_provider.go: This is required by the ThinkingCapable interface

    Let me start by modifying the provider.go file. I'll update the applyThinkingControl function to handle DeepSeek-specific mapping:

  37. Qwen Assistant

    Now I understand the current structure. I need to:

    1. Add DeepSeek detection to thinkingControlKind function
    2. Modify applyThinkingControl to handle all thinking levels (off, high, xhigh) for DeepSeek with proper mapping to thinking.type and reasoning_effort
    3. Add SupportsThinking() method to http_provider.go

    Let me start by modifying the provider.go file to add DeepSeek support:

  38. Qwen Assistant

    Now let me verify the changes were applied correctly:

  39. Qwen Assistant

    Now let me check that the isDeepSeekHost function was added:

  40. Qwen Assistant

    I see there's a duplicate isDeepSeekHost function. Let me check the current state and fix any duplicates:

  41. Qwen Assistant

    I see there's a duplicate isDeepSeekHost function. Let me remove the second one:

  42. Qwen Assistant

    Now let me verify the changes:

  43. Qwen Assistant

    Now let me verify the entire thinking-related section is correct:

  44. Qwen Assistant

    Let me check if the isDeepSeekHost function is properly defined and also fix any formatting issues:

  45. Qwen Assistant

    Now I need to add the SupportsThinking() method to the http_provider.go file. Let me check the current state:

  46. Qwen Assistant

    Now I need to add the SupportsThinking() method to the HTTPProvider. The method should check if the delegate provider supports thinking. Let me update the http_provider.go file:

  47. Qwen Assistant

    Now I need to add SupportsThinking() method to the openai_compat provider. Let me check if it has one:

  48. Qwen Assistant

    The grep returned non-zero exit code, meaning SupportsThinking is not found. I need to add a SupportsThinking() method to the openai_compat provider. The method should return true for providers that support thinking, including DeepSeek.

    Let me look at how the gemini provider implements this:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '1,50p' /picoclaw/pkg/providers/httpapi/gemini_provider.go | head -60 </tool_call>

  49. Qwen Assistant

    Let me use bash_terminal to search for the SupportsThinking implementation in the gemini_provider.go file.

  50. Qwen Assistant

    Now I need to add a SupportsThinking() method to the openai_compat provider. This method should return true if the provider supports thinking. For DeepSeek and other providers that support the thinking.type field, this should return true.

    Let me look at the structure of the provider.go file to find the right place to add this method:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '75,130p' /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  51. Qwen Assistant

    Let me try a different approach and search for where provider methods are defined to find the right place to add SupportsThinking().

  52. Qwen Assistant

    I need to add a SupportsThinking() method to the openai_compat provider. Let me look at where SupportsNativeSearch is defined since it's a similar method:

  53. Qwen Assistant

    I need to add a SupportsThinking() method to the openai_compat provider. This method should return true if the provider supports thinking features. For DeepSeek, this should return true.

    Let me update the provider.go file to add the SupportsThinking() method:

    <tool_call> <function=bash_terminal> <parameter=command> cat > /tmp/add_supports_thinking_openai_compat.py << 'EOF'

    Read the original file

    with open('/picoclaw/pkg/providers/openai_compat/provider.go', 'r') as f: content = f.read()

    Add SupportsThinking method after SupportsNativeSearch method

    old_content = '''func (p *Provider) SupportsNativeSearch() bool { return isNativeSearchHost(p.apiBase) }'''

    new_content = '''func (p *Provider) SupportsNativeSearch() bool { return isNativeSearchHost(p.apiBase) }

    // SupportsThinking implements providers.ThinkingCapable. func (p *Provider) SupportsThinking() bool { return p.thinkingControlKind("") != "" || isDeepSeekHost(p.apiBase) }'''

    content = content.replace(old_content, new_content)

    Write the modified content back

    with open('/picoclaw/pkg/providers/openai_compat/provider.go', 'w') as f: f.write(content)

    print("Provider.go updated successfully") EOF python3 /tmp/add_supports_thinking_openai_compat.py </tool_call>

  54. Qwen Assistant

    I need to use the bash_terminal tool to run Python commands. Let me do that.

  55. Qwen Assistant

    Now let me verify the change was applied correctly:

    <tool_call> <function=bash_terminal> <parameter=command> grep -n "SupportsThinking" /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  56. Qwen Assistant

    I need to use bash_terminal to run the grep command.

  57. Qwen Assistant

    Good, the SupportsThinking method was added. Let me verify the implementation by looking at the context:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '818,835p' /picoclaw/pkg/providers/openai_compat/provider.go </tool_call>

  58. Qwen Assistant

    I need to use bash_terminal properly to run the sed command.

  59. Qwen Assistant

    Now let me also verify the http_provider.go file has the SupportsThinking method:

    <tool_call> <function=bash_terminal> <parameter=command> cat /picoclaw/pkg/providers/httpapi/http_provider.go </tool_call>

  60. Qwen Assistant

    I need to use bash_terminal to run the cat command.

  61. Qwen Assistant

    Now let me verify the changes by checking the Go code compiles correctly:

    <tool_call> <function=bash_terminal> <parameter=command> cd /picoclaw && go build ./pkg/providers/openai_compat/... </tool_call>

  62. Qwen Assistant

    I need to use bash_terminal to run the go build command.

  63. Qwen Assistant

    I need to set up the cache environment first. Let me try again with the cache set.

    <tool_call> <function=bash_terminal> <parameter=command> export GOCACHE=/tmp/gocache && cd /picoclaw && go build ./pkg/providers/openai_compat/... </tool_call>

  64. Qwen Assistant

    Let me run the command properly to set the environment and build.

  65. Qwen Assistant

    The build succeeded. Now let me also build the httpapi package to make sure it compiles:

    <tool_call> <function=bash_terminal> <parameter=command> export GOCACHE=/tmp/gocache && cd /picoclaw && go build ./pkg/providers/httpapi/... </tool_call>

  66. Qwen Assistant

    I need to use bash_terminal to run the go build command for the httpapi package.

  67. Qwen Assistant

    Both packages compiled successfully. Now let me run the existing tests to make sure the changes don't break anything:

    <tool_call> <function=bash_terminal> <parameter=command> export GOCACHE=/tmp/gocache && cd /picoclaw && go test ./pkg/providers/openai_compat/... -v -run "Thinking" </tool_call>

  68. Qwen Assistant

    Let me run the thinking-related tests to verify the implementation is correct.

  69. Qwen Assistant

    Now let me add tests for DeepSeek thinking level mapping. I need to add tests that verify:

    1. thinking_level: "off" maps to thinking: { "type": "disabled" }
    2. thinking_level: "high" maps to thinking: { "type": "enabled" } + reasoning_effort: "high"
    3. thinking_level: "xhigh" maps to thinking: { "type": "enabled" } + reasoning_effort: "max"

    Let me add these tests to the provider_test.go file:

    <tool_call> <function=bash_terminal> <parameter=command> tail -50 /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  70. Qwen Assistant

    I need to use bash_terminal to see the end of the test file to find where to add the new tests.

  71. Qwen Assistant

    Now I'll add the DeepSeek thinking tests to the test file. Let me create a script to add the new tests:

    <tool_call> <function=bash_terminal> <parameter=command> cat > /tmp/add_deepseek_tests.py << 'EOF'

    Read the original file

    with open('/picoclaw/pkg/providers/openai_compat/provider_test.go', 'r') as f: content = f.read()

    New tests to add

    new_tests = '''

    func TestBuildRequestBody_DeepSeekThinkingOff(t *testing.T) { p := NewProvider("key", "https://api.deepseek.com/v1", "") p.SetProviderName("deepseek")

    body := p.buildRequestBody(
    	[]Message{{Role: "user", Content: "hi"}},
    	nil,
    	"deepseek-chat",
    	map[string]any{"thinking_level": "off"},
    )
    
    thinking, ok := body["thinking"].(map[string]any)
    if !ok {
    	t.Fatalf("thinking = %#v, want map", body["thinking"])
    }
    if got := thinking["type"]; got != "disabled" {
    	t.Fatalf("thinking.type = %#v, want %q", got, "disabled")
    }
    if _, ok := body["reasoning_effort"]; ok {
    	t.Fatalf("reasoning_effort should be omitted when thinking is disabled, got %v", body["reasoning_effort"])
    }
    

    }

    func TestBuildRequestBody_DeepSeekThinkingHigh(t *testing.T) { p := NewProvider("key", "https://api.deepseek.com/v1", "") p.SetProviderName("deepseek")

    body := p.buildRequestBody(
    	[]Message{{Role: "user", Content: "hi"}},
    	nil,
    	"deepseek-chat",
    	map[string]any{"thinking_level": "high"},
    )
    
    thinking, ok := body["thinking"].(map[string]any)
    if !ok {
    	t.Fatalf("thinking = %#v, want map", body["thinking"])
    }
    if got := thinking["type"]; got != "enabled" {
    	t.Fatalf("thinking.type = %#v, want %q", got, "enabled")
    }
    if got := body["reasoning_effort"]; got != "high" {
    	t.Fatalf("reasoning_effort = %#v, want %q", got, "high")
    }
    

    }

    func TestBuildRequestBody_DeepSeekThinkingXHigh(t *testing.T) { p := NewProvider("key", "https://api.deepseek.com/v1", "") p.SetProviderName("deepseek")

    body := p.buildRequestBody(
    	[]Message{{Role: "user", Content: "hi"}},
    	nil,
    	"deepseek-chat",
    	map[string]any{"thinking_level": "xhigh"},
    )
    
    thinking, ok := body["thinking"].(map[string]any)
    if !ok {
    	t.Fatalf("thinking = %#v, want map", body["thinking"])
    }
    if got := thinking["type"]; got != "enabled" {
    	t.Fatalf("thinking.type = %#v, want %q", got, "enabled")
    }
    if got := body["reasoning_effort"]; got != "max" {
    	t.Fatalf("reasoning_effort = %#v, want %q", got, "max")
    }
    

    }

    func TestBuildRequestBody_DeepSeekThinkingPreservedWhenNotExplicit(t *testing.T) { p := NewProvider("key", "https://api.deepseek.com/v1", "") p.SetProviderName("deepseek")

    // When thinking_level is not set or is low/medium/adaptive, no thinking fields should be added
    // to preserve existing behavior
    for _, level := range []string{"low", "medium", "adaptive"} {
    	t.Run(level, func(t *testing.T) {
    		body := p.buildRequestBody(
    			[]Message{{Role: "user", Content: "hi"}},
    			nil,
    			"deepseek-chat",
    			map[string]any{"thinking_level": level},
    		)
    
    		if _, ok := body["thinking"]; ok {
    			t.Fatalf(
    				"thinking should be omitted for %q to preserve existing behavior, got %#v",
    				level,
    				body["thinking"],
    			)
    		}
    		if _, ok := body["reasoning_effort"]; ok {
    			t.Fatalf(
    				"reasoning_effort should be omitted for %q, got %#v",
    				level,
    				body["reasoning_effort"],
    			)
    		}
    	})
    }
    

    }

    func TestBuildRequestBody_DeepSeekViaAPIBase(t *testing.T) { // Test that DeepSeek thinking works when detecting via API base instead of provider name p := NewProvider("key", "https://platform.deepseek.com/api/v1", "") // No provider name set

    body := p.buildRequestBody(
    	[]Message{{Role: "user", Content: "hi"}},
    	nil,
    	"deepseek-chat",
    	map[string]any{"thinking_level": "off"},
    )
    
    thinking, ok := body["thinking"].(map[string]any)
    if !ok {
    	t.Fatalf("thinking = %#v, want map", body["thinking"])
    }
    if got := thinking["type"]; got != "disabled" {
    	t.Fatalf("thinking.type = %#v, want %q", got, "disabled")
    }
    

    }

    func TestHTTPProviderSupportsThinking_DeepSeek(t *testing.T) { p := NewHTTPProvider("key", "https://api.deepseek.com/v1", "") p.SetProviderName("deepseek")

    if !p.SupportsThinking() {
    	t.Fatalf("HTTPProvider.SupportsThinking() = false, want true for DeepSeek")
    }
    

    }

    func TestOpenAICompatSupportsThinking_DeepSeek(t *testing.T) { p := openai_compat.NewProvider("key", "https://api.deepseek.com/v1", "") p.SetProviderName("deepseek")

    if !p.SupportsThinking() {
    	t.Fatalf("openai_compat.Provider.SupportsThinking() = false, want true for DeepSeek")
    }
    

    } '''

    Find the last test function and insert before the closing brace

    The file ends with the TestSerializeMessages_StripsSystemParts test

    old_end = '''func TestSerializeMessages_StripsSystemParts(t *testing.T) { messages := []protocoltypes.Message{ { Role: "system", Content: "you are helpful", SystemParts: []protocoltypes.ContentBlock{ {Type: "text", Text: "you are helpful"}, }, }, } result := common.SerializeMessages(messages)

    data, _ := json.Marshal(result)
    raw := string(data)
    if strings.Contains(raw, "system_parts") {
    	t.Fatal("system_parts should not appear in serialized output")
    }
    

    } '''

    new_end = new_tests + '''func TestSerializeMessages_StripsSystemParts(t *testing.T) { messages := []protocoltypes.Message{ { Role: "system", Content: "you are helpful", SystemParts: []protocoltypes.ContentBlock{ {Type: "text", Text: "you are helpful"}, }, }, } result := common.SerializeMessages(messages)

    data, _ := json.Marshal(result)
    raw := string(data)
    if strings.Contains(raw, "system_parts") {
    	t.Fatal("system_parts should not appear in serialized output")
    }
    

    } '''

    content = content.replace(old_end, new_end)

    Write the modified content back

    with open('/picoclaw/pkg/providers/openai_compat/provider_test.go', 'w') as f: f.write(content)

    print("Tests added successfully") EOF python3 /tmp/add_deepseek_tests.py </tool_call>

  72. Qwen Assistant

    Let me run the Python script to add the tests.

  73. Qwen Assistant

    The file wasn't created. Let me try again with a different approach - I'll use the edit command to add the tests directly.

    First, let me check the current end of the test file to see what I need to add:

    <tool_call> <function=bash_terminal> <parameter=command> wc -l /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  74. Qwen Assistant

    Let me use bash_terminal to run the wc command.

  75. Qwen Assistant

    Now let me add the test content to the end of the file. I'll use sed to insert the new tests before the final closing brace.

  76. Qwen Assistant

    Let me verify the tests were added correctly:

  77. Qwen Assistant

    There's an extra closing brace. Let me fix that by removing the duplicate:

    <tool_call> <function=bash_terminal> <parameter=command> head -n -1 /picoclaw/pkg/providers/openai_compat/provider_test.go > /tmp/test_fixed.go && mv /tmp/test_fixed.go /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  78. Qwen Assistant

    Let me use bash_terminal to run the head command to fix the extra closing brace.

  79. Qwen Assistant

    Now let me verify the file is correctly formatted and the tests compile:

    <tool_call> <function=bash_terminal> <parameter=command> tail -20 /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  80. Qwen Assistant

    Let me check the end of the test file using bash_terminal.

  81. Qwen Assistant

    Now let me verify the tests compile and run correctly. First, let me check if there's a missing closing brace for the package:

  82. Qwen Assistant

    I need to verify the file has the correct number of closing braces. Let me check if the package is correctly closed.

  83. Qwen Assistant

    There's a syntax error in the test file. Let me check the structure around line 2057:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '2045,2065p' /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  84. Qwen Assistant

    I need to check the file around line 2045-2065 to see the syntax error.

  85. Qwen Assistant

    I see the problem - the TestSerializeMessages_StripsSystemParts function is missing its closing brace. Let me fix this:

  86. Qwen Assistant

    I see - the TestSerializeMessages_StripsSystemParts function is missing its closing brace }. Let me fix this by adding the missing closing brace:

  87. Qwen Assistant

    Let me verify the fix:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '2050,2070p' /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  88. Qwen Assistant

    Let me check the fix was applied correctly by using bash_terminal.

  89. Qwen Assistant

    There's an extra } on line 2056. Let me remove it:

    <tool_call> <function=bash_terminal> <parameter=command> sed -i '2056d' /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  90. Qwen Assistant

    Let me use bash_terminal to delete the extra closing brace on line 2056.

  91. Qwen Assistant

    Now let me verify the fix was applied correctly and the tests compile:

    <tool_call> <function=bash_terminal> <parameter=command> export GOCACHE=/tmp/gocache && cd /picoclaw && go test ./pkg/providers/openai_compat/... -v -run "DeepSeek" </tool_call>

  92. Qwen Assistant

    Let me use bash_terminal to run the Go test command to verify the tests compile and pass.

  93. Qwen Assistant

    Still having issues with the file structure. Let me look at the area around line 2057 again to see what's wrong:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '2050,2065p' /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  94. Qwen Assistant

    I need to use bash_terminal to check the file around line 2057.

  95. Qwen Assistant

    The closing brace is still missing. Let me add it before line 2057:

  96. Qwen Assistant

    Now let me verify the fix and run the tests:

  97. Qwen Assistant

    The test needs to import the httpapi package to use NewHTTPProvider. Let me check the import statement and add the import:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '1,30p' /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  98. Qwen Assistant

    Let me check the import statements in the test file and add the httpapi import if needed.

  99. Qwen Assistant

    I need to add the httpapi import to the test file. Let me modify the imports:

  100. Qwen Assistant

    Now I need to update the test to use the httpapi package. Let me check the test function that uses NewHTTPProvider:

    <tool_call> <function=bash_terminal> <parameter=command> grep -n "NewHTTPProvider" /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  101. Qwen Assistant

    Let me use bash_terminal to find the NewHTTPProvider calls in the test file.

  102. Qwen Assistant

    Now I need to change NewHTTPProvider to httpapi.NewHTTPProvider in the test:

  103. Qwen Assistant

    Let me verify the change and run the tests again:

    <tool_call> <function=bash_terminal> <parameter=command> export GOCACHE=/tmp/gocache && cd /picoclaw && go test ./pkg/providers/openai_compat/... -v -run "DeepSeek" </tool_call>

  104. Qwen Assistant

    Let me run the tests to see if they pass now:

  105. Qwen Assistant

    There's an issue with the import path. Let me check what I added to the imports:

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '1,22p' /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  106. Qwen Assistant

    Let me check the imports to see what's wrong with the httpapi import:

  107. Qwen Assistant

    The import looks correct. The issue might be that the httpapi package has circular dependencies or something similar. Let me check if the httpapi package depends on openai_compat:

    <tool_call> <function=bash_terminal> <parameter=command> grep -n "openai_compat" /picoclaw/pkg/providers/httpapi/*.go </tool_call>

  108. Qwen Assistant

    Let me check if the httpapi package depends on openai_compat, which might cause a circular import issue.

  109. Qwen Assistant

    I see - the httpapi package imports openai_compat, and if I add openai_compat to import httpapi, it will cause a circular import.

    Instead, let me remove the httpapi test from the openai_compat tests and add it separately in the httpapi tests. Or I can just test the SupportsThinking functionality through the openai_compat provider directly without needing to test through httpapi.

    Let me update the test to remove the httpapi dependency:

  110. Qwen Assistant

    I need to remove the TestHTTPProviderSupportsThinking_DeepSeek test from the openai_compat test file since it causes a circular import issue. Instead, I'll test it in the httpapi test file. Let me remove that test function:

  111. Qwen Assistant

    Let me also remove the httpapi import since it's no longer needed in this file:

    <tool_call> <function=bash_terminal> <parameter=command> sed -i '/github.com/sipeed/picoclaw/pkg/providers/httpapi/d' /picoclaw/pkg/providers/openai_compat/provider_test.go </tool_call>

  112. Qwen Assistant

    Let me run sed to remove the httpapi import from the test file.

  113. Qwen Assistant

    Let me verify the imports and run the tests:

    <tool_call> <function=bash_terminal> <parameter=command> export GOCACHE=/tmp/gocache && cd /picoclaw && go test ./pkg/providers/openai_compat/... -v -run "DeepSeek" </tool_call>

  114. Qwen Assistant

    Let me run the tests to check if they pass now.

  115. Qwen Assistant

    All the DeepSeek tests pass. Now let me also add a test for the HTTPProvider in the httpapi package to test the SupportsThinking method. Let me check if there's an existing test file for httpapi:

    <tool_call> <function=bash_terminal> <parameter=command> ls -la /picoclaw/pkg/providers/httpapi/*.go </tool_call>

  116. Qwen Assistant

    I need to use bash_terminal to list the files in the httpapi directory.

  117. Qwen Assistant

    There's no http_provider_test.go file. Let me create one with a test for the SupportsThinking method. Actually, I notice that the existing test file for httpapi is gemini_provider_test.go. Let me add the SupportsThinking test there or create a new file. Let me first check if there's a pattern for testing in this project.

    Actually, let me just run all the existing tests for the httpapi package to make sure my changes don't break anything:

  118. Qwen Assistant

    All tests pass. Now let me run all the openai_compat tests to make sure everything is working:

  119. Qwen Assistant

    All tests pass. Now let me also run a broader set of tests to make sure nothing is broken:

  120. Qwen Assistant

    Let me set up the module cache and run the tests again:

  121. Qwen Assistant

    All the provider tests pass. Now let me review the changes I made to ensure they match the requirements from the issue:

    1. ✅ Added DeepSeek-specific request shaping on the OpenAI-compatible provider path
    2. ✅ Mapping:
      • thinking_level: "off" -> thinking: { "type": "disabled" }
      • thinking_level: "high" -> thinking: { "type": "enabled" } + reasoning_effort: "high"
      • thinking_level: "xhigh" -> thinking: { "type": "enabled" } + reasoning_effort: "max"
    3. ✅ Added SupportsThinking() method to both HTTPProvider and openai_compat.Provider
    4. ✅ Added tests covering both request shaping and SupportsThinking functionality

    Let me verify the current state of the modified files:

  122. Qwen Assistant

    Let me now review the changes to make sure they're correct:

  123. Qwen Assistant

    The changes look correct. Let me now review the test file changes:

    <tool_call> <function=bash_terminal> <parameter=command> git -C /picoclaw diff pkg/providers/openai_compat/provider_test.go | head -150 </tool_call>

  124. Qwen Assistant

    I need to use bash_terminal to view the git diff for the test file.

  125. Qwen Assistant

    The changes look correct. Let me run one more comprehensive test to make sure everything works as expected:

    <tool_call> <function=bash_terminal> <parameter=command> export GOCACHE=/tmp/gocache && export GOMODCACHE=/tmp/gomodcache && cd /picoclaw && go test ./pkg/providers/... -count=1 </tool_call>

  126. Qwen Assistant

    I need to use bash_terminal to run the comprehensive test command.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.