opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Model options are not forwarded for openai-compatible providers unless provider.name option is given

Open AurelienTollard opened this issue 1 year ago • 3 comments

Custom model options are not forwarded correctly when provider are using @ai-sdk\openai-compatible. This can be mitigated by explicitly indicating "name" value in the provider config. E.g:

    "openrouter": {
      "options": { 
        "name": "OpenRouter" // models.options is not forwarded without this
      },
      "models": {
        "qwen/qwen3-235b-a22b": {
          "name": "Qwen3",
          "tool_call": false,
          "options": {
            "OpenRouter": {
              "provider": {
                "order": [
                  "cerebras"
                ],
                "allow_fallbacks": false
              }
            }
          }
        }
      }
    }

This is due to @ai-sdk\openai-compatible searching for providerOptions based on the provideerOptionsName attribute, which is not set by opencode by default. ai-sdk code responsible for option selection.

AurelienTollard avatar Jul 14 '25 14:07 AurelienTollard

interesting - we i set them like this

          openaiCompatible: {
            cache_control: { type: "ephemeral" },
          },

thdxr avatar Jul 14 '25 14:07 thdxr

From what I see openaiCompatible field is only used from within the prompt option definition, rather than at the model/provider level

AurelienTollard avatar Jul 14 '25 15:07 AurelienTollard

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

rekram1-node avatar Dec 28 '25 01:12 rekram1-node