glean/models/moonshot

Moonshot Kimi models.

The kimi-k2 series was retired on May 25, 2026 and kimi-k2.5 and moonshot-v1 on Aug 31, 2026. Reasoning is returned as reasoning events and sent back on later turns.

Types

A Kimi model builder. Pick a model with one of the constructors (or custom), chain setters, then call build().

pub opaque type Moonshot

Values

pub fn build(m: Moonshot) -> model.Model

Build a Model to use with agent.new.

pub fn configure(
  m: Moonshot,
  f: fn(config.ProviderConfig) -> config.ProviderConfig,
) -> Moonshot

Change the provider configuration: base URL, timeout, headers, retries.

|> configure(config.timeout(_, 120_000))
pub fn custom(
  api_key key: String,
  model model_id: String,
) -> Moonshot

Any other model ID served by this API, such as one released after this version of glean. Only this module’s setters are available, so check the model accepts them.

pub fn kimi_k2_6(api_key key: String) -> Moonshot

Kimi K2.6. Model ID: kimi-k2.6.

pub fn kimi_k2_7_code(api_key key: String) -> Moonshot

Kimi K2.7 Code. Model ID: kimi-k2.7-code.

pub fn kimi_k2_7_code_highspeed(api_key key: String) -> Moonshot

Kimi K2.7 Code, high-speed. Model ID: kimi-k2.7-code-highspeed.

pub fn kimi_k3(api_key key: String) -> Moonshot

Kimi K3. Model ID: kimi-k3.

pub fn max_output_tokens(m: Moonshot, n: Int) -> Moonshot

Set the maximum number of output tokens.

pub fn stop_sequences(
  m: Moonshot,
  stops: List(String),
) -> Moonshot

Stop generating when the model writes any of these strings.

pub fn temperature(m: Moonshot, t: Float) -> Moonshot

Set the sampling temperature.

pub fn top_p(m: Moonshot, p: Float) -> Moonshot

Set the top-p (nucleus sampling) value.

✨ Search Document