Skip to content

[Bug]: opencode customized model api calling router failure #2099

@Ken-Leo

Description

@Ken-Leo

Summary

I used CC-Switch to have added a custom model api for OpenCode. I can interact in opencode cli with the model correctly. However, it does not work in OpenWork when using the model api. It just shows as below:

System message must be at the beginning.
Status: 400
Response: {"error":{"message":"System message must be at the beginning.","type":"BadRequestError","param":null,"code":400}}

To Reproduce

envs:

  • MacOS
  • OpenCode: 1.16.2
  • OpenWork: v0.15.2
  • CC-Switch: 3.16.1
    • API Format: OpenAI Compatible
    • Base URL: http://[my model IP]:[PORT]/v1

steps:

  1. cd to/your_project_dir
  2. use opencode to activate opencode and change the model to the one I just added, and start conversation. Everything goes right. /exit it.
  3. start OpenWork and make sure the customized provider and model are connected. Enter anything in TUI, and you will be responsed with the error.

Expected behavior

OpenWork did recognize the config of OpenCode and the customized model api.
OpenCode CLI works normally as well as OpenWork desktop app.

Actual behavior

OpenCode CLI works normally while OpenWork throws an exception.

Screenshots (optional)

Image

OW version & Desktop info (optional)

No response

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions