Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
This repository was archived by the owner on May 15, 2026. It is now read-only.

OpenRouter proxy: tool calls silently dropped after AI SDK migration (tool-call event ignored) #11419

Description

@0xMink

Description

When using OpenRouter as a proxy, tool calls are silently dropped after the OpenRouter AI SDK migration (PR #10778, Feb 9), producing false "Model Response Incomplete / failed to use any tools" errors. This affects all models routed through OpenRouter and causes retry loops with significant cost inflation.

Root cause

Two interacting issues:

  1. processAiSdkStreamPart() ignores tool-call events (ai-sdk.ts line 491). The handler was designed to rely solely on tool-input-start/delta/end lifecycle events for tool delivery.

  2. @openrouter/ai-sdk-provider v2.1.1 has incomplete lifecycle emission:

    • Incrementally streamed tool calls: emits tool-input-start + tool-input-delta but never tool-input-end
    • Flush-path tool calls: emits only tool-call with zero tool-input-* events

The combination means tool calls are silently lost. Prior to the AI SDK migration, OpenRouter used the openai npm package with NativeToolCallParser, which handled tool calls correctly via delta.tool_calls.

Timeline

Date Version Event
Jan 15 v3.41.0 OpenRouter uses openai SDK + NativeToolCallParser. Works fine.
Jan 20 — XML tool calling removed (8de9337e6, PR #10841)
Jan 23 v3.42.0 First release without XML tools. OpenRouter still uses openai SDK. Still works.
Jan 28 — src/api/transform/ai-sdk.ts first created (fe722dad2, PR #11047)
Feb 6 v3.47.3 Latest numbered release. OpenRouter still uses openai SDK.
Feb 9 unreleased OpenRouter migrated to AI SDK (PR #10778). Bug introduced.
Feb 11 unreleased PR #11420 fix lands

The true regression boundary is the OpenRouter AI SDK migration (PR #10778, Feb 9), not v3.41.0 → v3.44.0 as originally stated.

Reproduction

  1. Configure any model through OpenRouter (e.g., Sonnet 4.5, Grok)
  2. Send a task that requires tool use
  3. Observe "failed to use any tools" errors and retry loops
  4. Same model via direct provider works correctly

Environment

Expected behavior

Tool calls routed through OpenRouter should be delivered and executed identically to direct provider connections.

Activity

  1. 0xMink commented on Feb 12, 2026

    @0xMink
    ContributorAuthor

    Timeline correction

    After tracing git history, the regression boundary described in this issue is inaccurate. The AI SDK was not present in v3.41.0 or v3.44.0, so neither version could have been affected by the processAiSdkStreamPart() bug fixed in PR #11420.

    Actual timeline

    Date Version Event
    Jan 15 v3.41.0 OpenRouter uses openai SDK + NativeToolCallParser. No AI SDK. Works fine.
    Jan 20 — XML tool calling removed (8de9337e6, PR #10841)
    Jan 23 v3.42.0 First release without XML tools. OpenRouter still uses openai SDK. Still works.
    Jan 27 v3.44.0 src/api/transform/ai-sdk.ts does not exist yet (created Jan 28 in fe722dad2, PR #11047)
    Feb 6 v3.47.3 Latest numbered release. OpenRouter still uses openai SDK.
    Feb 9 unreleased OpenRouter migrated to AI SDK (5773af8dd, PR #10778). This is when processAiSdkStreamPart() became relevant to OpenRouter.
    Feb 11 unreleased PR #11420 fix lands

    Key findings

    1. src/api/transform/ai-sdk.ts was created on Jan 28 — 13 days after v3.41.0 and 1 day after v3.44.0. Neither version used this code path.

    2. OpenRouter used the plain openai npm package at v3.41.0, streaming tool calls via NativeToolCallParser with delta.tool_calls — a completely different code path.

    3. The OpenRouter AI SDK migration (PR feat: Refactor OpenRouter provider to use Vercel AI SDK #10778) landed Feb 9, after v3.47.3 (Feb 6). The bug can only manifest in unreleased builds or the next release.

    4. XML removal happened in v3.42.0 (Jan 23), not v3.44.0.

    Corrected description

    The true regression boundary is not v3.41.0 → v3.44.0. It is pre- vs post-OpenRouter AI SDK migration (PR #10778, Feb 9), which has not shipped in any numbered release. The fix in PR #11420 is correct — the issue description and title should be updated to reflect the actual regression boundary.

  2. changed the title [-]OpenRouter proxy: tool calls silently dropped after v3.41.0 (tool-call event ignored)[/-] [+]OpenRouter proxy: tool calls silently dropped after AI SDK migration (tool-call event ignored)[/+] on Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions