# ai/ask Single-turn LLM query through the dynamic provider registry. The provider is chosen by the cfg's `:provider` keyword; provider packages tagged `"ai-provider"` (deft/ai-deepseek, deft/ai-anthropic, ...) are discovered and loaded on first use. ## Syntax
import "deft/stdext/ai/registry" as ai

set cfg [ai/default-cfg]                  # first installed provider
set reply [ai/ask $cfg "prompt"]          # → "reply string"
## Parameters - `$cfg` — config map; `:provider` selects the plugin, `:model` the model, `:api-key` the credential (built automatically from the provider's env var by `ai/default-cfg` / `ai/build-cfg`) - `"prompt"` — the user message ## Returns The assistant reply string, or `%Err{:message}` on a missing provider or HTTP error. The low-level form `[ai/ask $provider $cfg "prompt"]` takes an explicit provider singleton (e.g. `import "deft/ai-deepseek" as ds` → `ds/Provider`). ## See Also `ai/chat`, `ai/models`, `ai/build-cfg` (manual → AI → Provider Plugins)