Package bg.codexio.ai.openai.api.http
Class AuthenticationInterceptor
java.lang.Object
bg.codexio.ai.openai.api.http.AuthenticationInterceptor
- All Implemented Interfaces:
okhttp3.Interceptor
OkHttp interceptor type for OpenAI authentication-
Nested Class Summary
Nested classes/interfaces inherited from interface okhttp3.Interceptor
okhttp3.Interceptor.Chain, okhttp3.Interceptor.Companion -
Field Summary
Fields inherited from interface okhttp3.Interceptor
Companion -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionokhttp3.Responseintercept(okhttp3.Interceptor.Chain chain) Sends theApiCredentials.apiKey()as a Bearer token.
-
Constructor Details
-
AuthenticationInterceptor
- Parameters:
context- passed along the HTTP configuration, mainly the credentials
-
-
Method Details
-
intercept
@NotNull public okhttp3.Response intercept(@NotNull okhttp3.Interceptor.Chain chain) throws IOException Sends theApiCredentials.apiKey()as a Bearer token. In addition, sets OpenAI-Organization ifApiCredentials.organization()is present.- Specified by:
interceptin interfaceokhttp3.Interceptor- Throws:
IOException
-