Alibaba

Qwen chat and embeddings through Alibaba's OpenAI-compatible mode.

AlibabaModel reads ALIBABA_API_KEY and targets https://dashscope-intl.aliyuncs.com/compatible-mode/v1.

let model = AlibabaModel("qwen3-max")
let result = try await generateText(model: model, prompt: "Say hello.")
print(result.text)

Tools, structured output, vision, and reasoning ride the shared chat-completions wire; qwen3-*-thinking and qwq-* models stream reasoning as .reasoningDelta. The unified reasoning parameter maps to Qwen's enable_thinking + thinking_budget (.none disables thinking; an effort level enables it with a budget from 1,024 up to 38,912 tokens).

Embeddings

AlibabaEmbeddingModel works with embed and embedMany:

let vectors = try await embedMany(
  model: AlibabaEmbeddingModel("text-embedding-v4"),
  values: documents
)

Video

AlibabaVideoModel conforms to VideoModel and works with generateVideos. It submits an async DashScope task and polls until it's SUCCEEDED. Pass an image for image-to-video (or use an -i2v model id); extra Wan parameters go under the alibaba provider key:

let video = try await generateVideos(
  model: AlibabaVideoModel("wan2.6-t2v"),
  prompt: "A paper boat sailing down a rain gutter"
)

Models

As of July 2026:

Model IDNotes
qwen3-max / qwen3.7-maxFlagship
qwen-plus / qwen-flash / qwen-turboBalanced, fast, cheap tiers
qwen3-coder-plus / qwen3-coder-flashCode
qwen3-235b-a22b-thinking-2507Reasoning MoE
qwq-32b / qwq-plusReasoning
text-embedding-v4Embeddings (AlibabaEmbeddingModel)
wan2.7-t2v / wan2.6-t2v / -i2vVideo (AlibabaVideoModel)

See DashScope's model list for availability. Any id the API serves works.