Package com.alibaba.dashscope
Class DashScopeClient
java.lang.Object
com.alibaba.dashscope.DashScopeClient
- All Implemented Interfaces:
AutoCloseable
DashScope 3.0 synchronous client (design §2). Entry point:
try (DashScopeClient client = DashScopeClient.builder().apiKey("...").build()) {
ChatCompletion r = client.chat().completions().create(params);
}
withOptions(ClientOptions) derives a client that shares the underlying connection
pool; a derived client must not outlive its parent.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionAgentStudio management plane (design §7): one implementation underapplications.agentstudio, shared by both generations and excluded from the 4.0 legacy cleanup.apps()Bailian applications:apps().completions().create(...).audio()static DashScopeClient.Builderbuilder()chat()voidclose()config()The resolved configuration (config chain applied).decision()System One decision model: typed questions over a business state, one round trip.Model deployments: create/get/list/scale/delete/streamEvents.files()File management: upload/list/get/delete.Fine-tuning jobs: create/get/list/cancel/delete/logs/streamEvents/wait.images()Text-to-image:generateblocking sugar +jobs()task handle.models()Model catalog: list/get.rerank()tingwu()TingWu: offline summarization jobs + realtime understanding.Server-side token counting.videos()Video generation:generateblocking sugar +jobs()task handle.withOptions(ClientOptions overrides) Derive a client with extra overrides, sharing this client's connection pool.Open a shared WebSocket connection multiplexing many task-protocol tasks (audio design §7).wsConnection(RequestOptions options)
-
Method Details
-
builder
-
chat
-
embeddings
-
rerank
-
multimodal
-
audio
-
apps
Bailian applications:apps().completions().create(...). -
decision
System One decision model: typed questions over a business state, one round trip. -
images
Text-to-image:generateblocking sugar +jobs()task handle. -
videos
Video generation:generateblocking sugar +jobs()task handle. -
files
File management: upload/list/get/delete. -
models
Model catalog: list/get. -
fineTunes
Fine-tuning jobs: create/get/list/cancel/delete/logs/streamEvents/wait. -
deployments
Model deployments: create/get/list/scale/delete/streamEvents. -
tingwu
TingWu: offline summarization jobs + realtime understanding. -
tokenization
Server-side token counting. For the local BPE tokenizer seeTokenizerFactory. -
agentStudio
AgentStudio management plane (design §7): one implementation underapplications.agentstudio, shared by both generations and excluded from the 4.0 legacy cleanup. Created lazily because endpoint resolution requires a workspace orDASHSCOPE_AGENTSTUDIO_URL, and the subarea allocates its own HTTP clients. Errors use the 3.0 unchecked exception family; the 3.0baseUrldoes not apply here. -
config
The resolved configuration (config chain applied). -
wsConnection
Open a shared WebSocket connection multiplexing many task-protocol tasks (audio design §7). The caller owns it and must close it; pass it toasr().recognize(params, connection)/tts().connect(params, connection)to reuse the handshake. -
wsConnection
-
withOptions
Derive a client with extra overrides, sharing this client's connection pool. An override that injects a differenthttpClientis honored: the transport derives from it, sharing its pool and ensuring the auth/UA/retry interceptors apply. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-