You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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)
Activity
[-][Feature] Support interceptors in the OkHttp client[/-][+]Support interceptors[/+]TomerAberbach commentedon Mar 25, 2025
We will eventually support interceptors, but for now you can "bring your own client" by copy/pasting this implementation of our
HttpClientinterface, making whatever changes you want (e.g. adding interceptors), and constructor an instance of theOpenAIClient(like here)TomerAberbach commentedon Apr 17, 2025
We now have documentation for this workaround btw: https://github.com/openai/openai-java#custom-http-client