Skip to content

401 error returned when using OpenRouter API and Key unless personal API Key is provided. #401

Description

@S0ulf3re

Which version of integration_openai are you using?

4.5.1

Which version of Nextcloud are you using?

v34.0.1

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Safari 26.5.2

Describe the Bug

Using OpenRouter endpoints with an API key results in a 401 unauthorized error, specifying a missing authentication header, unless a valid API key is also provided by the user rather than the admin. This results in the integration using the selected OpenRouter model by the admin, while utilizing the users specified key. However, requests to OpenRouter fail unless the user provides one.

Specifically, in the logs:

Warning
integration_openai
ClientException
Client error: `POST https://openrouter.ai/api/v1/chat/completions` resulted in a `401 Unauthorized` response: {"error":{"message":"Missing Authentication header","code":401}}
API request error : Client error: `POST https://openrouter.ai/api/v1/chat/completions` resulted in a `401 Unauthorized` response: {"error":{"message":"Missing Authentication header","code":401}}

Expected Behavior

A response should be returned, properly authenticated by the admin provided API key. Without returning an authentication error.

To Reproduce

Activity

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