Class QwenCloudClient

All Implemented Interfaces:
com.tnsai.llm.LLMClient

public class QwenCloudClient extends AbstractOpenAICompatibleClient
Alibaba Qwen Cloud (DashScope) LLM client.

Alibaba's DashScope is the hosted API for the Qwen family (Qwen2.5, Qwen3, Qwen-Coder, Qwen-VL). It exposes an OpenAI-compatible endpoint under the /compatible-mode path — same chat-completions wire format as GroqClient / XAIGrokClient / YiClient.

Two regional endpoints:

  • https://dashscope-intl.aliyuncs.com/compatible-mode/v1 — international (default for this client)
  • https://dashscope.aliyuncs.com/compatible-mode/v1 — China region; select via DASHSCOPE_BASE_URL env or constructor baseUrl argument

Supported models (at time of writing):

  • qwen-max — frontier-tier flagship
  • qwen-plus — cost-balanced general-purpose
  • qwen-turbo — low-latency small model
  • qwen2.5-coder-32b-instruct — coding-specialised
  • qwen-vl-max — multimodal (image input)

The catalog evolves quickly; check the live list at help.aliyun.com/zh/model-studio/use-qwen-by-calling-api.

Configuration via environment variables:

  • DASHSCOPE_API_KEY — Required.
  • DASHSCOPE_BASE_URL — Optional override; defaults to the international endpoint. Set to the China endpoint when routing through mainland-region DashScope.
See Also:
  • Constructor Details

    • QwenCloudClient

      public QwenCloudClient(String model)
    • QwenCloudClient

      public QwenCloudClient(String model, float temperature)
    • QwenCloudClient

      public QwenCloudClient(String model, float temperature, Integer maxTokens)
    • QwenCloudClient

      public QwenCloudClient(String model, float temperature, Float topP, Integer maxTokens)
    • QwenCloudClient

      public QwenCloudClient(String baseUrl, String model, float temperature, Integer maxTokens, String apiKey)
    • QwenCloudClient

      public QwenCloudClient(String baseUrl, String model, float temperature, Float topP, Integer maxTokens, String apiKey)