Skip to content

ai-openrouter: referer is not passed because of typo in http headers #6143

@hlegendre

Description

@hlegendre

What version of Effect is running?

No response

What steps can reproduce the bug?

Configuring the OpenRouterClient with title and referrer options to pass observability information to OpenRouter does not work properly. Nothing gets logged

const clientLayer = OpenRouterClient.layerConfig({
    apiKey: Config.succeed(apiKey),
    title: Config.succeed(title),
    referrer: Config.succeed(referer),
  });

What is the expected behavior?

In the OpenRouter dashboard, the log of the invocation should be attributed to the app according to the given title.

What do you see instead?

No attribution.

Additional information

The error is here :

options.referrer ? HttpClientRequest.setHeader("HTTP-Referrer", options.referrer) : identity,

There is a typo "HTTP-Referrer" instead of "HTTP-Referer". The problem is that the option name has a typo also, so it will be a breaking change to fix it properly...

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