Class ProviderConfig

java.lang.Object
com.github.copilot.sdk.json.ProviderConfig

public class ProviderConfig extends Object
Configuration for a custom API provider (BYOK - Bring Your Own Key).

This allows using your own OpenAI, Azure OpenAI, or other compatible API endpoints instead of the default Copilot backend. All setter methods return this for method chaining.

Example Usage - OpenAI


 var provider = new ProviderConfig().setType("openai").setBaseUrl("https://api.openai.com/v1").setApiKey("sk-...");
 

Example Usage - Azure OpenAI


 var provider = new ProviderConfig().setType("azure")
 		.setAzure(new AzureOptions().setEndpoint("https://my-resource.openai.azure.com").setDeployment("gpt-4"));
 
See Also:
  • Constructor Details

    • ProviderConfig

      public ProviderConfig()
  • Method Details

    • getType

      public String getType()
      Gets the provider type.
      Returns:
      the provider type (e.g., "openai", "azure")
    • setType

      public ProviderConfig setType(String type)
      Sets the provider type.

      Supported types include:

      • "openai" - OpenAI API
      • "azure" - Azure OpenAI Service
      Parameters:
      type - the provider type
      Returns:
      this config for method chaining
    • getWireApi

      public String getWireApi()
      Gets the wire API format.
      Returns:
      the wire API format
    • setWireApi

      public ProviderConfig setWireApi(String wireApi)
      Sets the wire API format for custom providers.

      This specifies the API format when using a custom provider that has a different wire protocol.

      Parameters:
      wireApi - the wire API format
      Returns:
      this config for method chaining
    • getBaseUrl

      public String getBaseUrl()
      Gets the base URL for the API.
      Returns:
      the API base URL
    • setBaseUrl

      public ProviderConfig setBaseUrl(String baseUrl)
      Sets the base URL for the API.

      For OpenAI, this is typically "https://api.openai.com/v1".

      Parameters:
      baseUrl - the API base URL
      Returns:
      this config for method chaining
    • getApiKey

      public String getApiKey()
      Gets the API key.
      Returns:
      the API key
    • setApiKey

      public ProviderConfig setApiKey(String apiKey)
      Sets the API key for authentication.
      Parameters:
      apiKey - the API key
      Returns:
      this config for method chaining
    • getBearerToken

      public String getBearerToken()
      Gets the bearer token.
      Returns:
      the bearer token
    • setBearerToken

      public ProviderConfig setBearerToken(String bearerToken)
      Sets a bearer token for authentication.

      This is an alternative to API key authentication.

      Parameters:
      bearerToken - the bearer token
      Returns:
      this config for method chaining
    • getAzure

      public AzureOptions getAzure()
      Gets the Azure-specific options.
      Returns:
      the Azure options
    • setAzure

      public ProviderConfig setAzure(AzureOptions azure)
      Sets Azure-specific options for Azure OpenAI Service.
      Parameters:
      azure - the Azure options
      Returns:
      this config for method chaining
      See Also: