Module for interacting with Alibaba Cloud Model Studio (DashScope) Qwen models.
DashScope exposes an OpenAI-compatible API. Two billing endpoints are supported:
- On-demand (default):
https://dashscope-intl.aliyuncs.com/compatible-mode/v1withconfig :genai, :qwen, api_key:(QWEN_API_KEY,DASHSCOPE_API_KEYfallback). - Token plan:
https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1withtoken_api_key:(QWEN_TOKEN_KEY). Enable viatoken_plan: trueormode: :token_planin config,models/1options, or provider settings.
Regional on-demand overrides go on config :genai, :qwen, base_url:. Token-plan host
overrides go on token_plan_base_url:.
Summary
Functions
Bearer token for the active plan (api_key on-demand, token_api_key on token plan).
Compatible-mode root URL. Token-plan mode selects the token-plan host; an explicit
per-request :base_url still wins.
Full Model Studio catalog via native GET /api/v1/models (paginated).
Callback implementation for GenAI.InferenceProviderBehaviour.chat/7.
Return config_key inference provide application config stored under :genai entry
Obtain map of effective settings: settings, model_settings, provider_settings, config_settings, etc.
Prepare endpoint and method to make inference call to
Callback implementation for GenAI.InferenceProviderBehaviour.generate_media/2.
Prepare request headers
Retrieves a list of models supported by the DashScope compatible-mode API.
Native Model Studio API root (/api/v1) derived from the active compatible-mode URL.
Prepare request body to be passed to inference call.
Build and run inference thread
Callback implementation for GenAI.InferenceProviderBehaviour.standardize_model/1.
Build and run inference thread in streaming mode
Callback implementation for GenAI.InferenceProviderBehaviour.supported_modalities/0.
True when token-plan mode is set (token_plan: true or mode: :token_plan).
Functions
Bearer token for the active plan (api_key on-demand, token_api_key on token plan).
Compatible-mode root URL. Token-plan mode selects the token-plan host; an explicit
per-request :base_url still wins.
Full Model Studio catalog via native GET /api/v1/models (paginated).
Unlike models/0 (OpenAI-compatible, ~160 chat/image/embed ids), this includes
video, extra audio, and capability metadata. Options (keyword):
:page_size— default 100:language— default"en-US":capabilities— string or list, e.g."TR"or["TG", "Reasoning"]:providers— string or list, e.g."qwen"
Callback implementation for GenAI.InferenceProviderBehaviour.chat/7.
Return config_key inference provide application config stored under :genai entry
Obtain map of effective settings: settings, model_settings, provider_settings, config_settings, etc.
Prepare endpoint and method to make inference call to
Callback implementation for GenAI.InferenceProviderBehaviour.generate_media/2.
Prepare request headers
Retrieves a list of models supported by the DashScope compatible-mode API.
Native Model Studio API root (/api/v1) derived from the active compatible-mode URL.
Used by catalog/1 — the OpenAI-compatible /models list omits video and some audio ids.
Prepare request body to be passed to inference call.
Build and run inference thread
Callback implementation for GenAI.InferenceProviderBehaviour.standardize_model/1.
Build and run inference thread in streaming mode
Callback implementation for GenAI.InferenceProviderBehaviour.supported_modalities/0.
True when token-plan mode is set (token_plan: true or mode: :token_plan).