Repository navigation
Commit 6165d39
fix: use custom OpenAI-compatible provider to resolve empty responses
Fixes anomalyco#5210, anomalyco#5674, anomalyco#10573, anomalyco#15756
## Problem
Custom OpenAI-compatible providers configured via @ai-sdk/openai-compatible
return empty responses ({ data: {}, request: {}, response: {} }) despite
the provider API working correctly when called directly.
## Root Cause
The official @ai-sdk/openai-compatible package does not properly emit
text-start and text-delta events during streaming, causing the SDK's
session.prompt() to receive no content even though the API returns valid
responses.
## Solution
Replace the official createOpenAICompatible with the custom
createGitHubCopilotOpenAICompatible implementation which properly handles:
- text-start event emission before streaming begins
- text-delta events with actual content
- reasoning-delta events for o1 models
- Proper state management for isActiveText/isActiveReasoning
## Technical Details
The custom implementation in openai-compatible-chat-language-model.ts
(lines 477-503) correctly handles delta.content by:
1. Emitting text-start event when streaming begins
2. Emitting text-delta events with delta content
3. Managing state transitions between reasoning and text
This fix applies the same working implementation used for
@ai-sdk/github-copilot to all @ai-sdk/openai-compatible providers.
## Testing
Tested with custom OpenAI-compatible endpoint (llmlite-dev) running gpt-4o:
- Before: Empty responses
- After: Full responses with proper streaming
Co-authored-by: OpenCode AI <[email protected]>1 parent 6deb27e commit 6165d39
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
0 commit comments