This guide provides a quick overview for getting started with Moonshot AI chat models. For the latest package details, examples, and source, see theDocumentation Index
Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
Use this file to discover all available pages before exploring further.
langchain-moonshot repository.
Overview
Integration details
| Class | Package | Serializable | JS support | Downloads | Version |
|---|---|---|---|---|---|
ChatMoonshot | langchain-moonshot | beta | ❌ |
Model features
| Tool calling | Structured output | Image input | Audio input | Video input (kimi-k2.5 only) | Token-level streaming | Native async | Token usage | Logprobs |
|---|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ |
Setup
To access Moonshot models, you’ll need a Moonshot account, an API key, and thelangchain-moonshot integration package.
Credentials
Head to the Moonshot console to create an API key. Once you’ve done this, set theMOONSHOT_API_KEY environment variable.
https://api.moonshot.ai/v1). To use the China endpoint instead, set:
Installation
The LangChain Moonshot integration lives in thelangchain-moonshot package:
Instantiation
Now we can instantiate our model object and generate responses:For
kimi-k2.5, if temperature is set, it must be 1.0 when thinking=True and 0.6 when thinking=False. Omitting thinking (or setting it to None) is treated as thinking-enabled for validation purposes. To use temperature=0.6, explicitly set thinking=False.Invocation
Reasoning output
ChatMoonshot preserves Moonshot’s reasoning_content field on both non-streaming and streaming responses.
Streaming
To recover usage metadata while streaming, setstream_usage=True:
Tool calling
Moonshot supports LangChain tool calling viabind_tools:
For
kimi-k2.5 with thinking=True, tool_choice must be "auto" or "none". Forced tool choice (specifying a function name) is not supported.Structured output
Moonshot supports structured output through LangChain’swith_structured_output(...). Moonshot does not expose a distinct json_schema steering path in this package, so method="json_schema" is intentionally downgraded to function_calling.
Multimodal input
Vision-capable Moonshot models accept OpenAI-styleimage_url content blocks:
Moonshot-specific notes
ChatMoonshotis a standalone LangChain integration package for Moonshot AI chat models built on top oflangchain-openai.- Moonshot-specific request controls exposed by the package include
thinking,prompt_cache_key,safety_identifier, andmax_completion_tokens. kimi-k2.5is validated more strictly than generic OpenAI-compatible chat models.- For
kimi-k2.5,top_pmust remain0.95,nmust remain1, and bothpresence_penaltyandfrequency_penaltymust remain0.0. - When
thinking=True, Moonshot builtin$web_searchis rejected forkimi-k2.5.
Repository
For the latest package code, README examples, release notes, and installation metadata, see:Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

