feat: add streaming option to provider config to support non-streaming backends#15931
feat: add streaming option to provider config to support non-streaming backends#1593175ACOL wants to merge 2 commits into
Conversation
…g backends
Add a 'streaming' boolean option to the provider configuration schema.
When set to false, the AI SDK's simulateStreamingMiddleware is used to
make non-streaming (doGenerate) requests and convert the response into
a simulated stream, allowing the rest of the processing pipeline to
work unchanged.
This is useful for custom OpenAI-compatible backends that do not
support server-sent events / streaming responses.
Usage in opencode.json:
{
"provider": {
"myprovider": {
"options": {
"streaming": false
}
}
}
}
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #14786 - "feat: add streaming option to provider config to support non-streaming backends" Why it's related: This appears to be a previous attempt at the exact same feature. According to the current PR description, PR #15931 is "a clean re-submission of the Recommendation: Verify that PR #14786 is closed/superseded and that PR #15931 is the current/correct implementation to proceed with. |
…nds (anomalyco#15931) Cherry-picked from upstream PR anomalyco#15931. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Friendly bump for review 🙏
|
|
When can this PR be merged? |
|
One line with usage of an upstream middleware. How long can this take ? |
|
Shouldn't docs be updated in order for this to be merged or are they not in this repo? |
|
I applied this PR, and it can indeed send requests in non-streaming mode, but after receiving several messages, the following error occurs and terminates the conversation |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #785
Supersedes #14786
Type of change
What does this PR do?
streamingboolean option to provider configuration (provider.<id>.options.streaming)streaming: false, uses AI SDKsimulateStreamingMiddleware()so non-streaming backends can still work with OpenCode's streaming pipelinestreamingdefaults to enabled)How did you verify your code works?
packages/opencodeChecklist
Usage
{ "provider": { "my-backend": { "options": { "streaming": false } } } }Notes
disable streamingfeature on top of latestdev.