anomalyco / anomalyco/opencode
Azure OpenAI large models (gpt-5.6-luna/sol, gpt-5.4, o3) hang in OpenCode due to Responses API streaming
@rekram1-node is already working on this.
Since Aug 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Bug description
When using the native Azure OpenAI provider (azure) in OpenCode, small models like gpt-5-mini work correctly, but larger models (gpt-5.6-luna, gpt-5.6-sol, gpt-5.4, o3) hang indefinitely instead of returning a response.
Steps to reproduce
- Configure Azure OpenAI provider with a valid resource and API key:
$env:AZURE_RESOURCE_NAME = "<your-resource-name>" - Run OpenCode with a large Azure model:
opencode run --model azure/gpt-5.6-luna "hola, responde solo OK" - The command hangs and never returns (tested up to 5 minutes).
Expected behavior
The model should respond, just like azure/gpt-5-mini does.
Actual behavior
azure/gpt-5-mini→ ✅ worksazure/gpt-5.6-luna→ ❌ hangs foreverazure/gpt-5.6-sol→ ❌ hangs foreverazure/gpt-5.4→ ❌ hangs foreverazure/o3→ ❌ hangs forever
Direct API verification
I verified that the Azure OpenAI endpoints work correctly when called directly:
- Responses API (
/openai/v1/responses?api-version=v1) withgpt-5.6-lunaresponds quickly and streams correctly. - Chat Completions API (
/openai/deployments/gpt-5.6-luna/chat/completions?api-version=2025-04-01-preview) also responds correctly.
So the Azure deployment and credentials are fine. The hang only happens through OpenCode.
Root cause hypothesis
OpenCode uses @ai-sdk/azure, which defaults to the Responses API when calling azure(deploymentName). The Responses API streaming path seems to hang for larger models when consumed by OpenCode, even though the same endpoint works fine with direct curl/PowerShell calls.
A likely fix would be to either:
- Allow users to force Chat Completions API for Azure models (e.g., via
provider.azure.options.factory: "chat"), or - Make
@ai-sdk/azuredefault to chat completions for models/deployments where Responses API streaming is unreliable.
Environment
- OS: Windows 11
- OpenCode version: 1.17.11 (also tested on earlier versions)
- Azure region: East US 2
- Models deployed:
gpt-5-mini,gpt-5.6-luna,gpt-5.6-sol,gpt-5.4,o3
Additional context
I also tried creating a custom provider using @ai-sdk/azure with useDeploymentBasedUrls: true, but it still calls /responses and returns 404 for api-version=2025-04-01-preview because that API version does not support the Responses API on Azure.
The only working workaround right now is to use azure/gpt-5-mini for everything, which is not ideal for complex tasks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.