Skip to content

[BUG] Default api_base is always set to GLM provider #680

@iambpn

Description

@iambpn

Quick Summary

Environment & Tools

  • PicoClaw Version: 0.1.2-189-g4cc8b90 (git: 4cc8b90)
  • Go Version: 1.26.0
  • AI Model & Provider: Deepseek and Github Copilot
  • Operating System: Ubuntu 24
  • Channels: None

📸 Steps to Reproduce

  1. Create a config file and add the deepseek model in model list but omit api_base to use the default api_base url.
"model_list": [
    {
      "model_name": "deepseek-chat",
      "model": "deepseek/deepseek-chat",
      "api_key": "......"
    }
}
  1. Run this command: picoclaw agent -m "hello"

❌ Actual Behavior

Returns this error:

2026/02/23 15:04:36 [2026-02-23T09:19:36Z] [ERROR] agent: LLM call failed {agent_id=main, iteration=1, error=API request failed:
  Status: 401
  Body:   {"error":{"code":"401","message":"令牌已过期或验证不正确"}}}
Error: LLM call failed after retries: API request failed:
  Status: 401
  Body:   {"error":{"code":"401","message":"令牌已过期或验证不正确"}}

✅ Expected Behavior

Api call should be successful and LLM should respond.

💬 Additional Context

During debugging, I discovered that if the api_base key is not specified in the config file, the system falls back to the default GLM provider’s base URL. This occurs because the default config struct is pre-populated with the full model list. When config.json is parsed, the same struct instance is passed to json.Unmarshal. As a result, only the fields explicitly defined in config.json overwrite the existing values, while any omitted optional fields retain their default values.

To resolve this, the model list should be removed from the default config struct so that omitted fields do not unintentionally inherit preset values.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions