Skip to content

v3.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 04 Dec 07:00
d67b9b1

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 under com.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 with legacy_2x; new code should use the 3.0 client.
  • Exceptions — checked ApiException / NoApiKeyException / InputRequiredException are replaced by the unchecked DashScopeException family (AuthenticationException, RateLimitException, ContentFilterException, ApiTimeoutException, …) carrying code, HTTP status and request_id. Build the client with raiseOnError(false) to restore 2.x-style result inspection (result.isError()).
  • Streaming — sync streamCall returning Flowable becomes createStreaming returning a typed ResponseStream<T> (Iterable + AutoCloseable, incremental deltas by default). The async client still exposes RxJava Flowable.
  • Client lifecycle — per-capability new Generation() objects become one DashScopeClient in 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-request RequestOptions overrides. DashScopeClient.builder().build() works with just DASHSCOPE_API_KEY exported.
  • AgentStudio — same business package, new FQCN com.alibaba.dashscope.applications.agentstudio.*, also reachable via client.agentStudio(). The 3.0 baseUrl does not apply to AgentStudio; use DASHSCOPE_AGENTSTUDIO_URL to override its endpoint.
  • assistants.* / threads.* have no 3.0 equivalent yet — keep the legacy_2x imports.

Features

New 3.0 client / resource API (#300)

  • One DashScopeClient entry 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 RxJava Flowable<T>.
  • Automatic retries for non-streaming HTTP based on request settings and failure type, with backoff and Retry-After / Retry-After-ms / X-Should-Retry support, overridable per request via RequestOptions.
  • 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 via tokenization().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 through CompletableFuture: 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 AgentStudioDynamicWorkflows recipe (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.sandbox package: 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=false retains 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 streamingData onComplete finish-task send and reconnect, throwing NoApiKeyException as an RxJava UndeliverableException when no global API key was set. OkHttpWebSocketClient now guards the onComplete send with isClosed + try/catch, returns quietly from the reconnect catch when closed, and downgrades the onNext catch log to debug when closed. Live-flow failures still surface via emitResponseError. 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 with mkdocs build --strict.

CI & Chore

  • GitHub Actions bumped to v5 (Node 24) (#301) — actions/checkout and actions/setup-java v4 → v5 across release.yml, build-and-test.yml and linter.yml, clearing the Node.js 20 / setup-java v4 deprecation annotations. linter.yml checkout 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