Skip to content

[Bug] Opencode should use config's name instead of id when using siliconflow-cn. #6428

@Jostar1024

Description

@Jostar1024

Description

#5615
After the above issue we can fetch the siliconflow-cn's model but cannot use it.

To make siliconflow-cn works with opencode, it should use the name in the config instead of id.

OpenCode version

1.0.207

Steps to reproduce

Image

For example, I tested it with deepseek-ai/DeepSeek-V3.2-Exp. It returns Bad Request: Model does not exist. Please check it carefully.

I checked the data in ~/.local/share/opencode/storage/message/ses_491b34852ffeUXhAHgQZeQ6iLm/, the output are the following.

// request
{
  "id": "msg_b6e4cb7af001mvoKGrBM0hQ8F4",
  "sessionID": "ses_491b34852ffeUXhAHgQZeQ6iLm",
  "role": "user",
  "time": {
    "created": 1767082080178
  },
  "summary": {
    "title": "Summarizing test text",
    "diffs": []
  },
  "agent": "build",
  "model": {
    "providerID": "siliconflow-cn",
    "modelID": "deepseek-ai-deepseek-v3.2-exp"
  }
}
// response
{
  "id": "msg_b6e4cb7b7001R6QFm74Sy9ood0",
  "sessionID": "ses_491b34852ffeUXhAHgQZeQ6iLm",
  "role": "assistant",
  "time": {
    "created": 1767082080183,
    "completed": 1767082080453
  },
  "error": {
    "name": "APIError",
    "data": {
      "message": "Bad Request: Model does not exist. Please check it carefully.",
      "statusCode": 400,
      "isRetryable": false,
      "responseHeaders": {
        "connection": "keep-alive",
        "content-length": "87",
        "content-type": "application/json; charset=utf-8",
        "date": "Tue, 30 Dec 2025 08:08:00 GMT",
        "x-siliconcloud-trace-id": "ti_zhibn3p1k2bfikoist"
      },
      "responseBody": "{\"code\":20012,\"message\":\"Model does not exist. Please check it carefully.\",\"data\":null}"
    }
  },
  "parentID": "msg_b6e4cb7af001mvoKGrBM0hQ8F4",
  "modelID": "deepseek-ai-deepseek-v3.2-exp",
  "providerID": "siliconflow-cn",
  "mode": "build",
  "agent": "build",
  "path": {
    "cwd": "/Users/yucheng/.config/mpv",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "input": 0,
    "output": 0,
    "reasoning": 0,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}

After I changed the model's ID to its name in ~/.cache/opencode/models.json, opencode returns the correct result.

Image

Screenshot and/or share link

No response

Operating System

macOS 15.3.1

Terminal

Alacritty

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions