Skip to main content

Setup

Basic Usage

Parameters

str
default:"kimi-k2-turbo-preview"
Model identifier.
str
Moonshot API key. Defaults to the MOONSHOT_API_KEY environment variable.
str
default:"https://api.moonshot.ai/v1"
Moonshot API base URL.
float
Sampling temperature.
int
Maximum output tokens.

Streaming

Async Usage

Moonshot uses an OpenAI-compatible API. All standard parameters like temperature, max_tokens, top_p, and stop are supported.