public static final class ZhipuAiClient.Builder extends AbstractAiClient.AbstractBuilder<ZhipuAiClient,ZhipuAiClient.Builder>
Example usage:
ZhipuAiClient client = new ZhipuAiClient.Builder("your-api-key")
.networkConfig(0, 10, 30, 30, TimeUnit.SECONDS)
.connectionPool(10, 5, TimeUnit.MINUTES)
.enableTokenCache()
.build();
config| Constructor and Description |
|---|
Builder() |
Builder(String apiKey)
Creates a new builder with the specified API key.
|
Builder(String baseUrl,
String apiKey)
Creates a new builder with a custom base URL and API secret key.
|
| Modifier and Type | Method and Description |
|---|---|
ZhipuAiClient |
build()
Builds and returns a new AI client instance with the configured settings.
|
ZhipuAiClient.Builder |
ofZAI()
Use the Z AI base url
|
ZhipuAiClient.Builder |
ofZHIPU()
Use the ZHIPU AI base url
|
apiKey, baseUrl, connectionPool, customHeaders, disableTokenCache, enableTokenCache, networkConfig, self, tokenExpirepublic Builder()
public Builder(String apiKey)
apiKey - the API key for authenticationIllegalArgumentException - if apiKey is null or emptypublic Builder(String baseUrl, String apiKey)
baseUrl - the custom base URL for the API endpointapiKey - the API secret key for authenticationIllegalArgumentException - if any parameter is null or emptypublic ZhipuAiClient.Builder ofZHIPU()
public ZhipuAiClient.Builder ofZAI()
public ZhipuAiClient build()
AbstractAiClient.AbstractBuilderbuild in class AbstractAiClient.AbstractBuilder<ZhipuAiClient,ZhipuAiClient.Builder>Copyright © 2025. All rights reserved.