hot-ai integration for Qwen. provider() returns an
::ai::chat/ProviderRegistration that runs ::ai::chat/run-loop and
run-loop-stream through OpenAI's chat-tools adapter against the
configured Model Studio region, with Qwen-specific request fields
(thinking, web search, ...) taken from QwenOptions.
It claims models whose id starts with qwen (e.g. qwen3.8-max),
plus any id written as qwen/<model> (the qwen/ part is stripped),
which is how to route non-Qwen models Model Studio hosts
(qwen/deepseek-v4.1-flash, qwen/kimi-k3).
A registration's variant is Provider.Qwen, enrolled in hot-ai's open
Provider enum by arrow, so Qwen keeps its identity.
ChatOptions.provider-opts reaches Qwen through chat-opts-fn and
chat-stream-opts-fn, with the keys of ::qwen::api/resolve: api-key,
base-url, region, workspace-id, endpoint.
Example
opts ::ai::chat/ChatOptions({
model: "qwen3.8-flash",
providers: ::ai::chat/with-providers([::qwen::ai/provider()])
})
answer ::ai::chat/run-loop(opts, "What is 17 + 25?")
Values
DEFAULT_MAX_TOKENS
DEFAULT_MAX_TOKENS: Int 4096
KEY_NAME
KEY_NAME: Str "qwen.api.key"
MODEL_PREFIX
MODEL_PREFIX: Str "qwen/"
Functions
chat-fn
fn (opts: QwenOptions?): Fn
A ::ai::chat/run-loop chat function for the ctx-configured endpoint,
for ChatOptions.chat-fn.
Example
opts ::ai::chat/ChatOptions({chat-fn: ::qwen::ai/chat-fn(null), model: "qwen3.8-flash"})
chat-opts-fn
fn (opts: QwenOptions?): Fn
A ::ai::chat/run-loop chat function for the ctx-configured endpoint that
also takes ChatOptions.provider-opts, for ChatOptions.chat-opts-fn.
Example
opts ::ai::chat/ChatOptions({
chat-opts-fn: ::qwen::ai/chat-opts-fn(null),
model: "qwen3.8-flash",
provider-opts: {api-key: tenant-key, region: "us"}
})
chat-stream-fn
fn (opts: QwenOptions?): Fn
A ::ai::chat/run-loop-stream chat function for the ctx-configured endpoint.
chat-stream-opts-fn
fn (opts: QwenOptions?): Fn
A ::ai::chat/run-loop-stream chat function for the ctx-configured endpoint that also takes ChatOptions.provider-opts, for ChatOptions.chat-stream-opts-fn.
compatible
fn (ep: ::openai::api/Endpoint, opts: QwenOptions?): ::openai::compatible/CompatibleProvider
fn (ep: ::openai::api/Endpoint, opts: QwenOptions?, key-name: Str?): ::openai::compatible/CompatibleProvider
Qwen as an ::openai::compatible/CompatibleProvider for an explicit
endpoint (see ::qwen::api/endpoint and endpoint-for). Use it with
::openai::compatible/chat-fn or list-models. Pass key-name when
calls without a key should be an Err naming it.
extra-body
fn (opts: QwenOptions?): Map
The Qwen-specific body fields for QwenOptions, with unset fields
omitted. Pure; exposed for testing.
Example
::qwen::ai/extra-body(::qwen::ai/QwenOptions({enable-thinking: false, top-k: 20}))
// => {enable_thinking: false, top_k: 20}
is-qwen-model
fn (model: Str): Bool
True for model ids this provider claims: ids starting with qwen
(case-insensitive), which includes the qwen/ routing form.
Example
::qwen::ai/is-qwen-model("qwen3.8-max") // => true
::qwen::ai/is-qwen-model("qwen/deepseek-v4.1-flash") // => true
::qwen::ai/is-qwen-model("gpt-4o") // => false
opts-fn-for
fn (p: ::openai::compatible/CompatibleProvider): Fn
Internal: a chat-opts-fn for p that also understands region and workspace-id in provider-opts.
provider
fn (): ::ai::chat/ProviderRegistration
fn (opts: QwenOptions?): ::ai::chat/ProviderRegistration
Qwen ProviderRegistration for the ctx-configured region and key
(qwen.api.key, qwen.region, qwen.workspace.id, qwen.base.url).
With no qwen.api.key it still builds, and a call is an Err unless
ChatOptions.provider-opts carries an api-key.
Example
registry ::ai::chat/with-providers([
::qwen::ai/provider(::qwen::ai/QwenOptions({enable-search: true}))
])
opts ::ai::chat/ChatOptions({model: "qwen3.7-plus", providers: registry})
provider-for
fn (ep: ::openai::api/Endpoint, opts: QwenOptions?): ::ai::chat/ProviderRegistration
Qwen ProviderRegistration for an explicit endpoint and options.
Reads no ctx.
Example
reg ::qwen::ai/provider-for(
::qwen::api/endpoint-for("us", null, "sk-..."),
::qwen::ai/QwenOptions({enable-thinking: false})
)
registration
fn (p: ::openai::compatible/CompatibleProvider): ::ai::chat/ProviderRegistration
Internal: the ProviderRegistration for p.
request-options
fn (opts: QwenOptions?): ::openai::chat-tools/ChatRequestOptions
The ::openai::chat-tools/ChatRequestOptions used for Qwen: max_tokens, stream usage on, and extra-body(opts).
stream-opts-fn-for
fn (p: ::openai::compatible/CompatibleProvider): Fn
Internal: a chat-stream-opts-fn for p that also understands region and workspace-id in provider-opts.
Types
Qwen
Qwen type {
name: Str
}
Qwen's identity in ::ai::chat/Provider.
QwenOptions
QwenOptions type {
max-tokens: Int?,
enable-thinking: Bool?,
thinking-budget: Int?,
preserve-thinking: Bool?,
enable-search: Bool?,
search-options: Map?,
enable-code-interpreter: Bool?,
top-k: Int?,
repetition-penalty: Dec?,
reasoning-effort: Str?,
extra: Map?
}
Qwen-specific request controls for the hot-ai adapter. Unset fields are not sent, so the model's own defaults apply.
max-tokens: output ceiling, sent asmax_tokens(default 4096).enable-thinking: turn thinking on or off on hybrid models (several current models think by default). Some open-weight models only allow thinking when streaming; setfalsefor non-streamingrun-loopwith those, or userun-loop-stream.thinking-budget: cap on thinking tokens.preserve-thinking: feed prior-turn reasoning back in.enable-search/search-options: Model Studio web search, e.g.{forced_search: true, search_strategy: "max"}(turbo,max,agent;enable_search_extensionfor vertical search).enable-code-interpreter: built-in code interpreter.top-k,repetition-penalty: sampling controls.reasoning-effort: sent asreasoning_effort(model-specific values).extra: any other body fields, merged last.