Omni.Providers.Moonshot (Omni v1.3.0)

Copy Markdown View Source

Provider for the Moonshot AI (Kimi) 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, :moonshot]

Or load it at runtime:

Omni.Provider.load([:moonshot])

Reads the API key from the MOONSHOT_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.Moonshot,
  api_key: {:system, "MY_MOONSHOT_KEY"}

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

Reasoning

Moonshot's Kimi models don't accept the standard reasoning_effort parameter. Instead, reasoning is toggled via a thinking object: %{"type" => "enabled"} or %{"type" => "disabled"}. This provider translates the standard :thinking option:

  • thinking: falsethinking: %{"type" => "disabled"}
  • Any other level (:low, :medium, :high, :xhigh, :max) → thinking: %{"type" => "enabled"}

Effort levels are flattened to on/off because Moonshot exposes no granularity. Reasoning content streams back as reasoning_content, which the Completions dialect already parses into thinking blocks.