Skip to content

Support interceptors #339

Open
Open

Description

@GuyStone

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.

Activity

  1. changed the title [-][Feature] Support interceptors in the OkHttp client[/-] [+]Support interceptors[/+] on Mar 25, 2025
  2. TomerAberbach commented on Mar 25, 2025

    @TomerAberbach
    Contributor

    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)

  3. TomerAberbach commented on Apr 17, 2025

    @TomerAberbach
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions