Skip to content

[ENHANCEMENT] Align openai, requesty, unbound, and opencode-go providers to use shared extractReasoningFromDelta helper #570

Description

@edelauna

Problem (one or two sentences)

Providers openai.ts, requesty.ts, unbound.ts, and opencode-go.ts each have their own inline reasoning_content check with no fallback to reasoning, and none use the shared extractReasoningFromDelta helper introduced in PR #449. If the fallback logic or whitespace-preservation behavior ever changes, these providers will silently drift out of sync.

Context (who is affected and when)

Affects users of OpenAI, Requesty, Unbound, and OpenCode-Go providers when a model streams reasoning via the reasoning field (rather than reasoning_content). The inconsistency was identified during review of #449 and intentionally deferred to keep that PR focused.

Desired behavior (conceptual, not technical)

All providers that handle streaming reasoning deltas should use extractReasoningFromDelta from src/api/providers/utils/extract-reasoning.ts, so fallback behavior (reasoning_contentreasoning) and whitespace preservation are consistent everywhere.

Constraints / preferences (optional)

Changes should be limited to swapping the inline checks for the shared helper — no behavioral changes beyond gaining the reasoning fallback and whitespace preservation that extractReasoningFromDelta already provides.

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Acceptance criteria (optional)

Given any provider that streams reasoning deltas,
When a model sends reasoning_content: null and a populated reasoning field,
Then a { type: "reasoning", text: ... } chunk is yielded (same as LiteLLM and BaseOpenAiCompatibleProvider).
And whitespace-only chunks like " " and "\n\n" are preserved.

Proposed approach (optional)

For each of openai.ts, requesty.ts, unbound.ts, opencode-go.ts: import extractReasoningFromDelta and replace the existing inline reasoning_content check with a call to the helper, matching the pattern in lite-llm.ts:239-241.

Trade-offs / risks (optional)

Low risk — the helper is already tested and in use. The only behavioral delta is that these providers gain the reasoning fallback they were previously missing; existing reasoning_content handling is unchanged.

Tracked from PR #449 review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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