Skip to content

Custom OpenAI-compatible provider returns no text content #5210

Closed as not planned

Description

@cgilly2fast

Description

Summary

When using a custom provider with @ai-sdk/openai-compatible, API calls complete successfully but no text content is displayed. The API returns valid responses (verified via curl), but opencode shows empty responses with 0 tokens.

Dedalus API: https://docs.dedaluslabs.ai/api

Environment

  • opencode version: 1.0.134
  • OS: macOS (darwin arm64)

Config

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "dedalus-labs": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Dedalus Labs",
      "options": {
        "baseURL": "https://api.dedaluslabs.ai/v1"
      },
      "models": {
        "openai/gpt-5-mini": {
          "name": "GPT-5 Mini"
        },
        "google/gemini-2.5-flash": {
          "name": "Gemini 2.5 Flash"
        }
      }
    }
  }
}

Symptoms

  1. API calls complete (shows ~2s completion time in UI)
  2. No text content is displayed
  3. Session data shows finish: "stop" but no text parts
  4. Token counts show input: 0, output: 0
  5. No error is displayed

API Works Correctly

Direct curl test confirms the API returns valid streaming responses:

curl -s "https://api.dedaluslabs.ai/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-5-mini", "messages": [{"role": "user", "content": "Say hi"}], "stream": true}'

Returns valid SSE stream:

data: {"choices":[{"delta":{"content":"Hi"}}]}
data: {"choices":[{"delta":{},"finish_reason":"stop"}],"usage":{...}}
data: [DONE]

Likely Cause

The @ai-sdk/openai-compatible package may not be emitting text-start events before text-delta events. In processor.ts, text-delta handling requires currentText to be set (which happens in text-start):

case "text-delta":
  if (currentText) {  // <-- undefined without text-start
    currentText.text += value.text
    ...
  }
  break

Without a text-start event, all text-delta events are silently ignored.

Session Data

Stored message shows completion but no content:

{
  "finish": "stop",
  "tokens": {
    "input": 0,
    "output": 0,
    "reasoning": 0,
    "cache": { "read": 0, "write": 0 }
  }
}

No text parts are created - only step-start and step-finish parts exist.

OpenCode version

1.0.134

Steps to reproduce

  1. Add opencode.json
  2. add Dedalus api key ( "dedalus-labs", using opencode auth login > Other ) (if you dm me on x I will provide you one https://x.com/cgilly2fast)
  3. Pick a dedalus model
  4. Send "Hello"

Screenshot and/or share link

Image

Operating System

macOS 15.5 (24F74) (darwin arm64) M1 mac

Terminal

VSCode terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 7, 2025
  2. github-actions commented on Dec 7, 2025

    @github-actions
    Contributor

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

    Both issues use the @ai-sdk/openai-compatible provider and report content not being displayed despite successful API calls. The symptoms and likely root cause (missing text-start events before text-delta events) suggest these could be related issues.

    Feel free to ignore if your case is specific to the Dedalus Labs provider.

  3. rekram1-node commented on Dec 8, 2025

    @rekram1-node
    Collaborator

    Hm every other provider i've seen emits them correctly, it seems like it'd be a bug on the provider side rather than the sdk no?

  4. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 8, 2025
  5. cgilly2fast commented on Dec 8, 2025

    @cgilly2fast
    ContributorAuthor

    I am not 100% sure thats the issue, I was trying help with beginning deductions

  6. self-assigned this
    on Dec 8, 2025
  7. added a commit that references this issue on Mar 3, 2026
    6165d39
  8. Delqhi commented on Mar 7, 2026

    @Delqhi

    This looks very close to the same custom-provider compatibility gap we hit.

    We got a working fix in a fork by adding an opt-in compatibility layer for OpenAI-compatible providers:

    • legacy function_call normalization
    • parser middleware for text-only tool intents / JSON tool blocks / wrapped <tool_call> payloads
    • request adapter for tools / tool_choice -> functions / function_call on endpoints that only partially implement the OpenAI schema
    • optional session repair when a tool-capable turn ends with finish_reason=stop

    That turned a previously blank / one-shot custom-provider session into a usable multi-turn tool flow on our side.

    Related issues: #234, #15756, #10573.

    If useful, I can package the compatibility layer as an explicit custom-provider config path instead of changing default native-provider behavior.

  9. jogoossens commented on Mar 8, 2026

    @jogoossens

    have it too on our side

  10. removed
    bugSomething isn't working
    on May 3, 2026
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