Package com.github.copilot.sdk.json
Class ProviderConfig
java.lang.Object
com.github.copilot.sdk.json.ProviderConfig
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"));
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the API key.getAzure()Gets the Azure-specific options.Gets the base URL for the API.Gets the bearer token.getType()Gets the provider type.Gets the wire API format.Sets the API key for authentication.setAzure(AzureOptions azure) Sets Azure-specific options for Azure OpenAI Service.setBaseUrl(String baseUrl) Sets the base URL for the API.setBearerToken(String bearerToken) Sets a bearer token for authentication.Sets the provider type.setWireApi(String wireApi) Sets the wire API format for custom providers.
-
Constructor Details
-
ProviderConfig
public ProviderConfig()
-
-
Method Details
-
getType
Gets the provider type.- Returns:
- the provider type (e.g., "openai", "azure")
-
setType
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
Gets the wire API format.- Returns:
- the wire API format
-
setWireApi
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
Gets the base URL for the API.- Returns:
- the API base URL
-
setBaseUrl
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
Gets the API key.- Returns:
- the API key
-
setApiKey
Sets the API key for authentication.- Parameters:
apiKey- the API key- Returns:
- this config for method chaining
-
getBearerToken
Gets the bearer token.- Returns:
- the bearer token
-
setBearerToken
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
Gets the Azure-specific options.- Returns:
- the Azure options
-
setAzure
Sets Azure-specific options for Azure OpenAI Service.- Parameters:
azure- the Azure options- Returns:
- this config for method chaining
- See Also:
-