Skip to content

Allow passing custom provider options to opencode run#3497

Closed
AurelienRibon wants to merge 2 commits into
anomalyco:devfrom
sutoiku:custom-provider-options
Closed

Allow passing custom provider options to opencode run#3497
AurelienRibon wants to merge 2 commits into
anomalyco:devfrom
sutoiku:custom-provider-options

Conversation

@AurelienRibon

@AurelienRibon AurelienRibon commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

The goal of this PR is to provide users of opencode run the flexibility to set and use every possible provider option proposed by the AI SDK.

This is a compromise with #3475, in which I proposed a dedicated argument for an openai-specific property.

This new approach is more technical (users need to check with Vercel docs for what is available), but has the large advantage to deport the maintenance from opencode devs to vercel devs:

  • new models will be customizable without having to their properties to the code
  • no headache to find how to generalize a property (like reasoning effort) to all models
  • no arbitrary choice to make (mapping of reasoning effort from gemini's numbers to openai's enum)

Of course, dedicated arguments for important parameters will always be welcome, but at least now there will always be a workaround for missing arguments.

Does it work?

The best way to check that is to pass an invalid value and see if Vercel's AI SDK shows the correct error.
Here I tested it with reasoningEffort for openai models.

image image

Note

Aiden, of course this is a proposal, feel free to discard it if that's not the way Opencode wants to go.

@rekram1-node

rekram1-node commented Oct 28, 2025

Copy link
Copy Markdown
Collaborator

I feel like this is a bit messy, you can also solve this currently using OPENCODE_CONFIG_CONTENT

OPENCODE_CONFIG_CONTENT="{"$schema":"https://opencode.ai/config.json","provider":{"openai":{"models":{"gpt-5":{"options":{"reasoningEffort":"high","textVerbosity":"low","reasoningSummary":"auto","include":["reasoning.encrypted_content"]}}}}}}" opencode run 'hello how are you'

Neither of these are great tbh but passing json through args feels messy and if peeople want to do that advanced behavior they could use the existing flag

@AurelienRibon

Copy link
Copy Markdown
Contributor Author

Thanks, I was not aware of this flag. And I see it's doing a mergeDeep, so no need for this PR indeed, closing.

@rekram1-node

Copy link
Copy Markdown
Collaborator

I think the same thing applies for the timeout one too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants