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>
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String token()
      final static Credential create(String token)
      final static Credential create(Supplier<String> tokenSupplier)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait