Skip to content

Custom Provider Hangs After "build · model" in custom RuAPI provider #23094

Closed as not planned

Description

@fadingawayzy

Description

Description

Opencode hangs indefinitely after displaying "build · [model]" when using a custom provider with @ai-sdk/openai-compatible SDK. The API works correctly via curl but opencode never receives a response.

Environment

  • Opencode version: 1.4.7
  • OS: Linux (Arch-based)
  • Node/Bun version: (bun)

Steps to Reproduce

  1. Add custom provider to ~/.config/opencode/opencode.jsonc:
{
  "model": "RuAPI/claude-opus-4.6",
  "provider": {
    "RuAPI": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "RuAPI",
      "options": {
        "baseURL": "https://api.stepanovikov.uno"
      }
    }
  }
}
  1. Add API key: opencode providers login (or auth.json)
  2. Run: opencode run "hi"
  3. Result: Hangs at "build · claude-opus-4.6" forever

Expected Behavior

Should receive response from API within seconds.

Actual Behavior

  • Logs show provider loaded, SDK initialized
  • Logs show "small=false agent=build mode=primary stream"
  • Then hangs indefinitely - no timeout, no error

Additional Tests

  • curl to API endpoint works fine (both sync & streaming)
  • Built-in opencode/minimax-m2.5-free works correctly
  • Other models on same provider (gpt-5.4, claude-sonnet-4.6) also hang
  • Tried adding apiKey directly in config - same result

Logs

INFO  provider providerID=RuAPI found
INFO  provider providerID=RuAPI pkg=@ai-sdk/openai-compatible using bundled provider
INFO  provider status=completed duration=4 providerID=RuAPI getSDK
INFO  llm providerID=RuAPI modelID=claude-opus-4.6 ... small=false agent=build mode=primary stream
INFO  bus type=session.status publishing
INFO  session.updated publishing
[then hangs forever]

Workaround

Have to use built-in free model: `opencode run "hi" -m opencode/minimax-m2.5-free" for my tasks

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 17, 2026
  2. github-actions commented on Apr 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please check if either of those resolves your issue, and consider adding a comment there instead.

  3. fadingawayzy commented on Apr 17, 2026

    @fadingawayzy
    Author

    Also asked AI to figure something out and got this:

    The Problem

    Opencode hangs at "build · [model]" when using @ai-sdk/openai-compatible custom providers.
    The API works via curl, but opencode never receives/processes the response.

    Confirmed Working

    • ✅ curl to API endpoint
    • ✅ SDK standalone test (non-streaming)
    • ✅ opencode built-in models (opencode/minimax-m2.5-free)

    Not Working

    Root Cause Hypothesis

    The issue is NOT in:

    • Network connectivity (curl works)
    • API authentication (standalone SDK works)
    • Model configuration (works with built-in models)
      The issue IS in:
    • How opencode processes the streaming response from @ai-sdk/openai-compatible
    • OR how the SDK handles the response in the opencode context

    Evidence

    1. Logs show: llm providerID=RuAPI ... stream
    2. Then: session.updated publishing
    3. Then: HANGS - no error, no timeout, no response

    Things That Didn't Fix It

    • Adding apiKey to config
    • Adding timeout to config
    • Adding bunfig.toml (workaround for different issue)
    • Different SDK versions (1.0.0, 2.0.41)
    • Different models (claude-opus, gpt-5.4, claude-sonnet)
    • Different provider options

    What Would Help Debug

    1. Network trace showing if request is made and if response is received
    2. Comparing working builtin model vs broken custom provider at code level
    3. SDK version compatibility with opencode version

    Related Issues (all same root cause - likely)

    For Developers

    The fix needs to be in opencode's LLM response handling for
    @ai-sdk/openai-compatible providers. The SDK itself works fine.

  4. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions