anomalyco / anomalyco/opencode

Azure OpenAI large models (gpt-5.6-luna/sol, gpt-5.4, o3) hang in OpenCode due to Responses API streaming

Open
#42,147 4 comments 0 reactions 1 assignee View on GitHub

@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

  1. Configure Azure OpenAI provider with a valid resource and API key:
    $env:AZURE_RESOURCE_NAME = "<your-resource-name>"
    
  2. Run OpenCode with a large Azure model:
    opencode run --model azure/gpt-5.6-luna "hola, responde solo OK"
    
  3. 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:

  1. Allow users to force Chat Completions API for Azure models (e.g., via provider.azure.options.factory: "chat"), or
  2. 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.