github langchain-ai/langchainjs @langchain/openrouter@0.3.0

latest releases: @langchain/fireworks@0.1.5, @langchain/mistralai@1.1.0, @langchain/classic@1.0.34...
7 hours ago

Minor Changes

  • #10666 2bb55b0 Thanks @hnustwjj! - feat(openrouter): surface reasoning content as v1 standard content blocks

    convertOpenRouterResponseToBaseMessage and
    convertOpenRouterDeltaToBaseMessageChunk now copy OpenRouter's
    reasoning (flat string) and reasoning_details (structured array) fields
    onto additional_kwargs.reasoning_content / additional_kwargs.reasoning_details.
    A new ChatOpenRouterTranslator is registered in @langchain/core under
    the "openrouter" provider key so AIMessage.contentBlocks emits standard
    {type: "reasoning"} blocks alongside text and tool calls.

    Previously, reasoning text returned by reasoning-capable models routed
    through OpenRouter (DeepSeek R1, Minimax M2, Claude extended thinking,
    o-series, etc.) was silently dropped: only the reasoning_tokens count
    was preserved via usage_metadata. Consumers using standard content blocks
    (including the frontend agent UI patterns shown in the docs) could not
    display the model's chain of thought.

Patch Changes

Don't miss a new langchainjs release

NewReleases is sending notifications on new releases.