Skip to content

Custom OpenAI-compatible provider returns no text content #5210

@cgilly2fast

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions