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 → ✅ works
azure/gpt-5.6-luna → ❌ hangs forever
azure/gpt-5.6-sol → ❌ hangs forever
azure/gpt-5.4 → ❌ hangs forever
azure/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) with gpt-5.6-luna responds 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/azure default 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.
Bug description
When using the native Azure OpenAI provider (
azure) in OpenCode, small models likegpt-5-miniwork 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
Expected behavior
The model should respond, just like
azure/gpt-5-minidoes.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 foreverDirect API verification
I verified that the Azure OpenAI endpoints work correctly when called directly:
/openai/v1/responses?api-version=v1) withgpt-5.6-lunaresponds quickly and streams correctly./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 callingazure(deploymentName). The Responses API streaming path seems to hang for larger models when consumed by OpenCode, even though the same endpoint works fine with directcurl/PowerShell calls.A likely fix would be to either:
provider.azure.options.factory: "chat"), or@ai-sdk/azuredefault to chat completions for models/deployments where Responses API streaming is unreliable.Environment
gpt-5-mini,gpt-5.6-luna,gpt-5.6-sol,gpt-5.4,o3Additional context
I also tried creating a custom provider using
@ai-sdk/azurewithuseDeploymentBasedUrls: true, but it still calls/responsesand returns 404 forapi-version=2025-04-01-previewbecause that API version does not support the Responses API on Azure.The only working workaround right now is to use
azure/gpt-5-minifor everything, which is not ideal for complex tasks.