Skip to content
Effect Days 2026 Get your ticket

@effect/ai-openrouter

0.12.0

Patch Changes

  • Updated dependencies [fffdee0]:
    • effect@3.22.0
    • @effect/ai@0.37.0
    • @effect/experimental@0.61.0
    • @effect/platform@0.97.0

0.11.0

Patch Changes

0.10.1

Patch Changes

  • #6145 6c39a34 Thanks @LikiosSedo! - Fix typo in HTTP header name: HTTP-ReferrerHTTP-Referer. The HTTP spec spells it “Referer” (single r), and OpenRouter expects this exact header name for app attribution.

  • Updated dependencies [f99048e]:

    • effect@3.21.1

0.10.0

Patch Changes

0.9.1

Patch Changes

  • #6131 5c80e57 Thanks @fabstorres! - Allow partial tool_call deltas in OpenRouter streaming

  • Updated dependencies [add06f4, a03b6a2]:

    • effect@3.20.1

0.9.0

Patch Changes

  • #6117 7103e24 Thanks @nickbreaton! - Fix OpenRouter streaming finalization for usage-only terminal chunks.

  • Updated dependencies [fc82e81, 82996bc, 4d97a61, f6b0960, 8798a84]:

    • effect@3.20.0
    • @effect/ai@0.34.0
    • @effect/experimental@0.59.0
    • @effect/platform@0.95.0

0.8.4

Patch Changes

  • #6071 a91364d Thanks @marbemac! - Fix ChatStreamingMessageToolCall schema rejecting valid streaming tool call chunks.

    The OpenAI streaming spec splits tool calls across multiple SSE chunks — function.name is only present on the first chunk, but the schema required it on every chunk, causing a MalformedOutput error whenever the model returned a tool call.

    Made function.name optional to match id which was already optional.

0.8.3

Patch Changes

  • #6060 c3e706f Thanks @nvonbulow! - fix(ai-openrouter): deduplicate reasoning parts when both reasoning and reasoning_details are present in a stream delta

  • Updated dependencies [d67c708, a8c436f]:

    • @effect/platform@0.94.5
    • effect@3.19.17

0.8.2

Patch Changes

0.8.1

Patch Changes

  • #5928 34fbbb1 Thanks @harrysolovay! - Regenerate OpenRouter schemas to fix schema validation.

  • Updated dependencies [65e9e35, ee69cd7, 488d6e8, ba9e790]:

    • @effect/platform@0.94.1
    • effect@3.19.14
    • @effect/ai@0.33.1

0.8.0

Patch Changes

  • Updated dependencies [77eeb86, ff7053f, 287c32c]:
    • effect@3.19.13
    • @effect/platform@0.94.0
    • @effect/ai@0.33.0
    • @effect/experimental@0.58.0

0.7.1

Patch Changes

  • #5799 5d7c9d8 Thanks @subtleGradient! - Add support for google-gemini-v1 reasoning format

  • Updated dependencies [65bff45]:

    • @effect/platform@0.93.7

0.7.0

Minor Changes

  • #5849 2dcbf98 Thanks @IMax153! - Update generated schema definitions and apply patch fixes

Patch Changes

  • Updated dependencies [96c9537]:
    • @effect/experimental@0.57.10

0.6.0

Patch Changes

  • Updated dependencies [3c15d5f, 3863fa8, 2a03c76, 24a1685]:
    • effect@3.19.0
    • @effect/platform@0.93.0
    • @effect/ai@0.32.0
    • @effect/experimental@0.57.0

0.5.0

Minor Changes

  • #5621 4c3bdfb Thanks @IMax153! - Remove Either / EitherEncoded from tool call results.

    Specifically, the encoding of tool call results as an Either / EitherEncoded has been removed and is replaced by encoding the tool call success / failure directly into the result property.

    To allow type-safe discrimination between a tool call result which was a success vs. one that was a failure, an isFailure property has also been added to the "tool-result" part. If isFailure is true, then the tool call handler result was an error.

    import * as AnthropicClient from "@effect/ai-anthropic/AnthropicClient"
    import * as AnthropicLanguageModel from "@effect/ai-anthropic/AnthropicLanguageModel"
    import * as LanguageModel from "@effect/ai/LanguageModel"
    import * as Tool from "@effect/ai/Tool"
    import * as Toolkit from "@effect/ai/Toolkit"
    import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient"
    import { Config, Effect, Layer, Schema, Stream } from "effect"
    const Claude = AnthropicLanguageModel.model("claude-4-sonnet-20250514")
    const MyTool = Tool.make("MyTool", {
    description: "An example of a tool with success and failure types",
    failureMode: "return", // Return errors in the response
    parameters: { bar: Schema.Number },
    success: Schema.Number,
    failure: Schema.Struct({ reason: Schema.Literal("reason-1", "reason-2") })
    })
    const MyToolkit = Toolkit.make(MyTool)
    const MyToolkitLayer = MyToolkit.toLayer({
    MyTool: () => Effect.succeed(42)
    })
    const program = LanguageModel.streamText({
    prompt: "Tell me about the meaning of life",
    toolkit: MyToolkit
    }).pipe(
    Stream.runForEach((part) => {
    if (part.type === "tool-result" && part.name === "MyTool") {
    // The `isFailure` property can be used to discriminate whether the result
    // of a tool call is a success or a failure
    if (part.isFailure) {
    part.result
    // ^? { readonly reason: "reason-1" | "reason-2"; }
    } else {
    part.result
    // ^? number
    }
    }
    return Effect.void
    }),
    Effect.provide(Claude)
    )
    const Anthropic = AnthropicClient.layerConfig({
    apiKey: Config.redacted("ANTHROPIC_API_KEY")
    }).pipe(Layer.provide(NodeHttpClient.layerUndici))
    program.pipe(Effect.provide([Anthropic, MyToolkitLayer]), Effect.runPromise)

Patch Changes

  • Updated dependencies [4c3bdfb]:
    • @effect/ai@0.31.0

0.4.0

Minor Changes

  • #5614 c63e658 Thanks @IMax153! - Previously, tool call handler errors were always raised as an expected error in the Effect E channel at the point of execution of the tool call handler (i.e. when a generate* method is invoked on a LanguageModel).

    With this PR, the end user now has control over whether tool call handler errors should be raised as an Effect error, or returned by the SDK to allow, for example, sending that error information to another application.

    Tool Call Specification

    The Tool.make and Tool.providerDefined constructors now take an extra optional parameter called failureMode, which can be set to either "error" or "return".

    import { Tool } from "@effect/ai"
    import { Schema } from "effect"
    const MyTool = Tool.make("MyTool", {
    description: "My special tool",
    failureMode: "return" // "error" (default) or "return"
    parameters: {
    myParam: Schema.String
    },
    success: Schema.Struct({
    mySuccess: Schema.String
    }),
    failure: Schema.Struct({
    myFailure: Schema.String
    })
    })

    The semantics of failureMode are as follows:

    • If set to "error" (the default), errors that occur during tool call handler execution will be returned in the error channel of the calling effect
    • If set to "return", errors that occur during tool call handler execution will be captured and returned as part of the tool call result

    Response - Tool Result Parts

    The result field of a "tool-result" part of a large language model provider response is now represented as an Either.

    • If the result is a Left, the result will be the failure specified in the tool call specification
    • If the result is a Right, the result will be the success specified in the tool call specification

    This is only relevant if the end user sets failureMode to "return". If set to "error" (the default), then the result property will always be a Right with the successful result of the tool call handler.

    Similarly the encodedResult field of a "tool-result" part will be represented as an EitherEncoded, where:

    • { _tag: "Left", left: <failure> } represents a tool call handler failure
    • { _tag: "Right", right: <success> } represents a tool call handler success

    Prompt - Tool Result Parts

    The result field of a "tool-result" part of a prompt will now only accept an EitherEncoded as specified above.

Patch Changes

  • Updated dependencies [6ae2f5d, c63e658]:
    • effect@3.18.4
    • @effect/ai@0.30.0

0.3.0

Patch Changes

0.2.1

Patch Changes

  • #5571 122aa53 Thanks @IMax153! - Ensure that AI provider clients filter response status for stream requests

0.2.0

Patch Changes

  • Updated dependencies [d4d86a8]:
    • @effect/platform@0.91.0
    • @effect/ai@0.28.0
    • @effect/experimental@0.55.0

0.1.0

Minor Changes

  • #5521 fa49bc8 Thanks @IMax153! - Add Effect AI SDK provider integration package for OpenRouter

Patch Changes

  • #5521 fa49bc8 Thanks @IMax153! - Fix provider metadata and parse tool call parameters safely

  • Updated dependencies [fa49bc8]:

    • @effect/ai@0.27.1