Omni.Providers.Alibaba (Omni v1.3.2)

Copy Markdown View Source

Provider for the Alibaba Cloud (DashScope) API, using the Omni.Dialects.OpenAICompletions dialect.

Not loaded by default — must be explicitly enabled. Either add it to your provider list in application config:

config :omni, :providers, [:anthropic, :openai, :google, :alibaba]

Or load it at runtime:

Omni.Provider.load([:alibaba])

Reads the API key from the DASHSCOPE_API_KEY environment variable — no further configuration is needed if the variable is set.

Configuration

Override the default API key or base URL via application config:

config :omni, Omni.Providers.Alibaba,
  api_key: {:system, "MY_DASHSCOPE_KEY"}

Any key from the provider's config/0 can be overridden: :api_key, :base_url. See Omni.Provider for details.

Regions

Defaults to the International (Singapore) endpoint. To use a different region, override :base_url:

config :omni, Omni.Providers.Alibaba,
  base_url: "https://dashscope-us.aliyuncs.com/compatible-mode"

Available regions:

RegionBase URL
International (Singapore)https://dashscope-intl.aliyuncs.com/compatible-mode
US (Virginia)https://dashscope-us.aliyuncs.com/compatible-mode
Germany (Frankfurt)https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/compatible-mode
China (Beijing)https://dashscope.aliyuncs.com/compatible-mode
China (Hong Kong)https://cn-hongkong.dashscope.aliyuncs.com/compatible-mode

Reasoning

The :thinking option is supported. Effort levels map to token budgets for the reasoning step — higher effort allows more reasoning tokens.

Structured output

The :output option is supported. Alibaba doesn't natively support JSON Schema constraints, so structured output is achieved via a system prompt fallback.