Skip to content

Support interceptors #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GuyStone opened this issue Mar 20, 2025 · 2 comments
Open

Support interceptors #339

GuyStone opened this issue Mar 20, 2025 · 2 comments

Comments

@GuyStone
Copy link

GuyStone commented Mar 20, 2025

Feature Request

Description

  • Support adding interceptors into OkHttp client, allowing users to customize and extend its behavior.
  • Reference: OkHttp Interceptors

Use case

  • The interceptor mechanism provides a flexible way to modify requests and responses, enabling various enhancements such as logging, authentication, and request modification.
  • For organizations and teams using this library, interceptors offer a standardised approach to extending functionality while maintaining consistency across implementations.
@TomerAberbach TomerAberbach changed the title [Feature] Support interceptors in the OkHttp client Support interceptors Mar 25, 2025
@TomerAberbach
Copy link
Collaborator

We will eventually support interceptors, but for now you can "bring your own client" by copy/pasting this implementation of our HttpClient interface, making whatever changes you want (e.g. adding interceptors), and constructor an instance of the OpenAIClient (like here)

@TomerAberbach
Copy link
Collaborator

We now have documentation for this workaround btw: https://github.com/openai/openai-java#custom-http-client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants