Package com.openai.credential
Class BearerTokenCredential
-
- All Implemented Interfaces:
-
com.openai.credential.Credential
public final class BearerTokenCredential implements Credential
<p> A credential that provides a bearer token. </p><p> If you are using the OpenAI API, you need to provide a bearer token for authentication. All API requests should include your API key in an Authorization HTTP header as follows: "Authorization: Bearer OPENAI_API_KEY" </p><p> Two ways to provide the token: </p> <ol> <l1> 1. Provide the token directly, 'BearerTokenCredential.create(String)'. The method 'ClientOptions.apiKey(String)' is a wrapper for this.</li> <l1> 2. Provide a supplier that provides the token, 'BearerTokenCredential.create(Supplier<String>)'.</li> </ol>
-
-
Method Summary
Modifier and Type Method Description final String
token()
final static Credential
create(String token)
final static Credential
create(Supplier<String> tokenSupplier)
-
-
Method Detail
-
create
final static Credential create(String token)
-
create
final static Credential create(Supplier<String> tokenSupplier)
-
-
-
-