Repository navigation
v3.0.0
The first 3.0 release rebuilds the DashScope Java SDK around a typed, resource-style client. One DashScopeClient (or DashScopeAsyncClient) replaces the per-capability entry classes of the 2.x line, with typed request/response models, an unchecked exception family, a layered configuration chain, automatic retries, and text-like streaming. Legacy 2.x APIs remain available as frozen facades under com.alibaba.dashscope.legacy_2x so existing code can keep compiling with an import update.
This release also significantly expands AgentStudio: dynamic workflow management, typed agent permissions and fixed-version bindings, plus a new Sandbox API for managed agents (DeepSeek Harness / OpenClaw) with native Web UI preview.
Scope: 1,255 files changed (+72,758 / −9,295) since v2.23.8; 796 SDK tests pass on JDK 8.
⚠️ Breaking Changes
3.0 is an intentional FQCN, source, and binary compatibility break. See the Migration Guide for the full entry-point mapping table and before/after examples.
- Legacy packages moved — 2.x APIs (other than AgentStudio and
shared) now live undercom.alibaba.dashscope.legacy_2x.*, carry type-level@Deprecated, and will be removed in 4.0. To keep existing code compiling, prefix your 2.x imports withlegacy_2x; new code should use the 3.0 client. - Exceptions — checked
ApiException/NoApiKeyException/InputRequiredExceptionare replaced by the uncheckedDashScopeExceptionfamily (AuthenticationException,RateLimitException,ContentFilterException,ApiTimeoutException, …) carryingcode, HTTP status andrequest_id. Build the client withraiseOnError(false)to restore 2.x-style result inspection (result.isError()). - Streaming — sync
streamCallreturningFlowablebecomescreateStreamingreturning a typedResponseStream<T>(Iterable+AutoCloseable, incremental deltas by default). The async client still exposes RxJavaFlowable. - Client lifecycle — per-capability
new Generation()objects become oneDashScopeClientin try-with-resources, sharing a connection pool and configuration. - Configuration — per-param
apiKey(...)and global constants become the config chain: builder > system property > environment variable >~/.dashscope/config.toml> defaults, with per-requestRequestOptionsoverrides.DashScopeClient.builder().build()works with justDASHSCOPE_API_KEYexported. - AgentStudio — same business package, new FQCN
com.alibaba.dashscope.applications.agentstudio.*, also reachable viaclient.agentStudio(). The 3.0baseUrldoes not apply to AgentStudio; useDASHSCOPE_AGENTSTUDIO_URLto override its endpoint. assistants.*/threads.*have no 3.0 equivalent yet — keep thelegacy_2ximports.
Features
New 3.0 client / resource API (#300)
- One
DashScopeCliententry point with 16 typed resources (chat(),multimodal(),embeddings(),rerank(),images(),videos(),apps(),audio(),tingwu(),tokenization(),agentStudio(), …), Lombok-builder request params and typed responses. - Async client — supported unary calls return
CompletableFuture<T>; streams use RxJavaFlowable<T>. - Automatic retries for non-streaming HTTP based on request settings and failure type, with backoff and
Retry-After/Retry-After-ms/X-Should-Retrysupport, overridable per request viaRequestOptions. - Encrypted channel — opt-in RSA envelope encryption (
RequestOptions.enableEncryption(true)) with automatic gateway public-key fetch and caching. - HTTP/SSE/WebSocket transport improvements and expanded model/audio/platform resources.
- Local tokenizer —
TokenizerFactory.qwen()counts offline when the vocabulary is available (downloading it if missing); remote counting viatokenization().count. - Frozen 2.x APIs migrated to
legacy_2x, AgentStudio regrouped, and runnable examples/tests updated. Validation: 735 tests, 0 failures on JDK 8 at merge time.
AgentStudio: dynamic workflows and agent configuration (#304)
AgentStudioClient.dynamicWorkflows()adds seven resource operations, available synchronously and throughCompletableFuture: create, retrieve, partial update, list, archive, list versions, and retrieve a fixed version.- Cursor pagination preserves filters; update parameters distinguish omitted fields from explicit nulls when clearing descriptions or input schemas.
- Typed Workflow permissions and fixed-version bindings in Agent configuration.
- Ships with the runnable
AgentStudioDynamicWorkflowsrecipe (EN/ZH guides) and nine new MockWebServer tests; validated against production with 40 checks covering sync/async operations, version immutability, null handling, pagination and archive behavior.
AgentStudio: Sandbox and managed Agent APIs (#306)
- New
com.alibaba.dashscope.agentstudio.sandboxpackage: a unified client for official-image templates, template files, Sandbox lifecycle operations and typed resource handles. - Managed Agent support: launch, lookup, sessions, turns, SSE subscriptions, cancellation, attachments and release — enabling DeepSeek Harness / OpenClaw through the Java SDK.
- Native Web UI preview — open DSH/OpenClaw Web UIs through a local preview, with template/Sandbox reuse, automatic OpenClaw device pairing by default (
autoPairOpenClaw=falseretains manual pairing) and cleanup of newly created resources. Requires Node.js when used. - Model credentials are configured independently of the platform API key; reused templates/Sandboxes must correspond to the requested Harness image.
Sandbox test coverage and examples (#307)
- 11 offline tests covering image resolution, template/instance payloads, independent model credentials, turns/SSE, files, error metadata and release.
- Three runnable examples: ordinary Sandbox lifecycle, managed Harness chat, and native Web UI preview — each releases owned resources and preserves reusable templates or borrowed resources.
- Example dry-run harness extended (46 checks passed); production SDK code, dependencies and CI configuration unchanged.
Bug Fixes
- WebSocket post-close send race (#301) — after a duplex stream was cancelled/disposed, an orphaned RxJava thread could still run the
streamingDataonCompletefinish-task send and reconnect, throwingNoApiKeyExceptionas an RxJavaUndeliverableExceptionwhen no global API key was set.OkHttpWebSocketClientnow guards theonCompletesend withisClosed+ try/catch, returns quietly from the reconnect catch when closed, and downgrades theonNextcatch log to debug when closed. Live-flow failures still surface viaemitResponseError. Includes a deterministic regression test (TestOkHttpWebSocketClientCloseRace).
Documentation
- Bilingual docs aligned with the Python SDK (#305) — shared documentation structure with capability recipes, an examples hub, a developer guide, and reference pages linked to generated Javadoc. Clarifies async audio, stream errors and retries, image task IDs, legacy imports, offline tokenization and dry-run coverage; fixes the native HTTP endpoint example, documents wire-log redaction limits, and makes the streaming/async Quickstart examples independently compilable (
javac --release 8). Both locales build withmkdocs build --strict.
CI & Chore
- GitHub Actions bumped to v5 (Node 24) (#301) —
actions/checkoutandactions/setup-javav4 → v5 acrossrelease.yml,build-and-test.ymlandlinter.yml, clearing the Node.js 20 / setup-java v4 deprecation annotations.linter.ymlcheckout stays SHA-pinned. - Reverted the web preview cleanup change from #306 (3ed47c1).
- Version bumped to 3.0.0 (
pom.xml,Version.java).
Installation
Maven:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dashscope-sdk-java</artifactId>
<version>3.0.0</version>
</dependency>Gradle:
implementation 'com.alibaba:dashscope-sdk-java:3.0.0'Requires JDK 8+. If 3.0.0 is not yet resolvable, the Maven Central deployment is still being published/synced — please check back shortly.
Contributors
Thanks to everyone who contributed to this release:
New Contributors
Full Changelog: v2.23.8...v3.0.0