opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Can users customize the relay API server and model?

Open gearlam opened this issue 3 weeks ago • 5 comments

Question

Why hasn't this important feature been developed yet? There are many casual users who need custom API interface services!

gearlam avatar Dec 24 '25 23:12 gearlam

This issue might be a duplicate of existing issues. Please check:

  • #5674: Custom OpenAI-compatible provider options not being passed to API calls
  • #5564: Does it support compatibility with OpenAI
  • #5210: Custom OpenAI-compatible provider returns no text content
  • #5812: [BUG] Bedrock provider: config options.region ignored for model ID prefixing
  • #971: Model options are not forwarded for openai-compatible providers unless provider.name option is given

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 24 '25 23:12 github-actions[bot]

This issue might be a duplicate of existing issues. Please check:这个问题可能是现有问题的重复。请查看:

Feel free to ignore if none of these address your specific case.如果以上都不适用于您的具体情况,请忽略。

I've checked, and the problem remains unresolved! I especially want to mention that I suggest adding this feature to the desktop version; I know many people are using the API relay service! Please add a provider compatible with OpenAI!!! The user script configuration is too cumbersome!

gearlam avatar Dec 24 '25 23:12 gearlam

What r u referring to?

rekram1-node avatar Dec 25 '25 02:12 rekram1-node

The key is to specify baseURL in options and models. You can always follow instruction on https://opencode.ai/docs/providers/#custom-provider and do this

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "myprovider": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "My AI ProviderDisplay Name",
      "options": {
        "baseURL": "https://api.myprovider.com/v1"
      },
      "models": {
        "my-model-name": {
          "name": "My Model Display Name"
        }
      }
    }
  }
}

exAClior avatar Dec 25 '25 02:12 exAClior

The key is to specify baseURL in options and models. You can always follow instruction on https://opencode.ai/docs/providers/#custom-provider and do this

Completely agree. You only need to change the baseURL for the appropriate provider - I am using this for Anthropic over Azure on daily basis. Works like a charm.

tisDDM avatar Dec 25 '25 08:12 tisDDM