Skip to content

Allow disabling Bearer auth for OpenAi modelsΒ #2218

@paulbakker

Description

@paulbakker

At Netflix we have a model abstraction that uses the OpenAi REST API.
Because this is an internal service, we use a different auth mechanism, and adding an Authorization header to the request is not allowed.

I'm integrating Spring AI with this internal model abstraction and need a way to disable adding the Authorization header.
I created a simple PR with a possible fix based on the ApiKey interface, but alternatively, a property would work as well. The PR assumes that a user brings their own beans for the models, overriding the beans from OpenAiAutoConfiguration.

As a side note, I noticed that while OpenAiApi uses the ApiKey interface, both OpenAiAudioApi and OpenAiImageApi still use a String instead of the ApiKey interface. I didn't want to touch this in the PR because it's an API change, but that's probably worth aligning.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions