Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
refactor(kimi): rename kimi API to moonshot (#1609)
qbca42fb091ede4
diff --git a/scripts/model_examples/README.md b/scripts/model_examples/README.mdindex e7b0822fc..74861d347 100644--- a/scripts/model_examples/README.md+++ b/scripts/model_examples/README.md@@ -41,10 +41,10 @@ scripts/model_examples/├── gemini_multimodal.py├── gemini_multiagent_multimodal.py│-├── kimi_call.py # Moonshot AI Kimi-├── kimi_multiagent.py-├── kimi_multimodal.py-├── kimi_multiagent_multimodal.py+├── moonshot_call.py # Moonshot AI (Kimi)+├── moonshot_multiagent.py+├── moonshot_multimodal.py+├── moonshot_multiagent_multimodal.py│├── xai_call.py # xAI Grok├── xai_multiagent.py@@ -80,7 +80,7 @@ scripts/model_examples/| `dashscope` | `DASHSCOPE_API_KEY` | Qwen series, supports `thinking_enable` || `deepseek` | `DEEPSEEK_API_KEY` | Supports only `call` / `multiagent` (no multimodal) || `gemini` | `GEMINI_API_KEY` | Gemini models, supports `thinking_budget` |-| `kimi` | `MOONSHOT_API_KEY` | Moonshot AI kimi-k2.6, etc. |+| `moonshot` | `MOONSHOT_API_KEY` | Moonshot AI kimi-k2.6, etc. || `xai` | `XAI_API_KEY` | Grok models, supports `reasoning_effort` || `ollama` | *(none – auto-detect)* | Local server, default `http://localhost:11434` |diff --git a/scripts/model_examples/kimi_call.py b/scripts/model_examples/moonshot_call.pysimilarity index 88%rename from scripts/model_examples/kimi_call.pyrename to scripts/model_examples/moonshot_call.pyindex 8f4f538de..396edf5e8 100644--- a/scripts/model_examples/kimi_call.py+++ b/scripts/model_examples/moonshot_call.py@@ -1,5 +1,5 @@# -*- coding: utf-8 -*--"""Examples of Kimi (Moonshot AI) model calls."""+"""Examples of Moonshot AI model calls."""import asyncioimport jsonimport os@@ -11,8 +11,8 @@ from agentscope.message import (ToolResultBlock,ToolResultState,)-from agentscope.model import KimiChatModel-from agentscope.credential import KimiCredential+from agentscope.model import MoonshotChatModel+from agentscope.credential import MoonshotCredentialfrom agentscope.tool import Toolkit, ToolChoice# ---------------------------------------------------------------------------@@ -21,9 +21,9 @@ from agentscope.tool import Toolkit, ToolChoiceasync def example_simple_call() -> None:- """Call the Kimi model with a simple text message."""- model = KimiChatModel(- credential=KimiCredential(+ """Call the Moonshot model with a simple text message."""+ model = MoonshotChatModel(+ credential=MoonshotCredential(api_key=os.environ["MOONSHOT_API_KEY"],),model="kimi-k2.6",@@ -61,13 +61,13 @@ def get_weather(city: str) -> str:async def example_tool_call() -> None:- """Call the Kimi model with tool calling enabled."""+ """Call the Moonshot model with tool calling enabled."""toolkit = Toolkit()toolkit.register_function(get_weather)tools = toolkit.get_function_schemas()- model = KimiChatModel(- credential=KimiCredential(+ model = MoonshotChatModel(+ credential=MoonshotCredential(api_key=os.environ["MOONSHOT_API_KEY"],),model="kimi-k2.6",diff --git a/scripts/model_examples/kimi_multiagent.py b/scripts/model_examples/moonshot_multiagent.pysimilarity index 81%rename from scripts/model_examples/kimi_multiagent.pyrename to scripts/model_examples/moonshot_multiagent.pyindex a80af0d26..502818805 100644--- a/scripts/model_examples/kimi_multiagent.py+++ b/scripts/model_examples/moonshot_multiagent.py@@ -1,18 +1,18 @@# -*- coding: utf-8 -*--"""Example of Kimi model calls with KimiMultiAgentFormatter.+"""Example of Moonshot model calls with MoonshotMultiAgentFormatter.The multi-agent formatter wraps prior conversation history in-<history></history> tags and preserves reasoning_content for Kimi's+<history></history> tags and preserves reasoning_content for Moonshot'sPreserved Thinking feature in multi-turn conversations."""import asyncioimport osfrom _utils import stream_and_collect-from agentscope.formatter import KimiMultiAgentFormatter+from agentscope.formatter import MoonshotMultiAgentFormatterfrom agentscope.message import Msg-from agentscope.model import KimiChatModel-from agentscope.credential import KimiCredential+from agentscope.model import MoonshotChatModel+from agentscope.credential import MoonshotCredentialasync def example_multiagent() -> None:@@ -21,10 +21,10 @@ async def example_multiagent() -> None:Alice and Bob discuss the weather, then a moderator (the model) is askedto summarize the conversation."""- formatter = KimiMultiAgentFormatter()+ formatter = MoonshotMultiAgentFormatter()- model = KimiChatModel(- credential=KimiCredential(+ model = MoonshotChatModel(+ credential=MoonshotCredential(api_key=os.environ["MOONSHOT_API_KEY"],),model="kimi-k2.6",diff --git a/scripts/model_examples/kimi_multiagent_multimodal.py b/scripts/model_examples/moonshot_multiagent_multimodal.pysimilarity index 84%rename from scripts/model_examples/kimi_multiagent_multimodal.pyrename to scripts/model_examples/moonshot_multiagent_multimodal.pyindex 489660b38..88fa7534b 100644--- a/scripts/model_examples/kimi_multiagent_multimodal.py+++ b/scripts/model_examples/moonshot_multiagent_multimodal.py@@ -1,13 +1,14 @@# -*- coding: utf-8 -*--"""Example of Kimi model calls with KimiMultiAgentFormatter and image input."""+"""Example of Moonshot model calls with MoonshotMultiAgentFormatter and+image input."""import asyncioimport osfrom _utils import stream_and_collect-from agentscope.formatter import KimiMultiAgentFormatter+from agentscope.formatter import MoonshotMultiAgentFormatterfrom agentscope.message import Msg, TextBlock, DataBlock, URLSource-from agentscope.model import KimiChatModel-from agentscope.credential import KimiCredential+from agentscope.model import MoonshotChatModel+from agentscope.credential import MoonshotCredentialTEST_IMAGE_URL = ("https://help-static-aliyun-doc.aliyuncs.com/file-manage"@@ -17,10 +18,10 @@ TEST_IMAGE_URL = (async def example_multiagent_image_url() -> None:"""Multi-agent conversation where Alice shares an image for the group."""- formatter = KimiMultiAgentFormatter()+ formatter = MoonshotMultiAgentFormatter()- model = KimiChatModel(- credential=KimiCredential(+ model = MoonshotChatModel(+ credential=MoonshotCredential(api_key=os.environ["MOONSHOT_API_KEY"],),model="kimi-k2.6",diff --git a/scripts/model_examples/kimi_multimodal.py b/scripts/model_examples/moonshot_multimodal.pysimilarity index 89%rename from scripts/model_examples/kimi_multimodal.pyrename to scripts/model_examples/moonshot_multimodal.pyindex c0b544fcd..4300975c8 100644--- a/scripts/model_examples/kimi_multimodal.py+++ b/scripts/model_examples/moonshot_multimodal.py@@ -1,5 +1,5 @@# -*- coding: utf-8 -*--"""Example of Kimi model multimodal (vision) calls using DataBlock."""+"""Example of Moonshot model multimodal (vision) calls using DataBlock."""import asyncioimport base64import os@@ -13,8 +13,8 @@ from agentscope.message import (URLSource,Base64Source,)-from agentscope.model import KimiChatModel-from agentscope.credential import KimiCredential+from agentscope.model import MoonshotChatModel+from agentscope.credential import MoonshotCredential# A publicly accessible test image (a simple cat photo)TEST_IMAGE_URL = (@@ -25,8 +25,8 @@ TEST_IMAGE_URL = (async def example_image_url() -> None:"""Call kimi-k2.6 with an image URL and ask what is in the image."""- model = KimiChatModel(- credential=KimiCredential(+ model = MoonshotChatModel(+ credential=MoonshotCredential(api_key=os.environ["MOONSHOT_API_KEY"],),model="kimi-k2.6",@@ -58,9 +58,9 @@ async def example_image_url() -> None:await stream_and_collect(await model(msgs))-def _build_model() -> KimiChatModel:- return KimiChatModel(- credential=KimiCredential(api_key=os.environ["MOONSHOT_API_KEY"]),+def _build_model() -> MoonshotChatModel:+ return MoonshotChatModel(+ credential=MoonshotCredential(api_key=os.environ["MOONSHOT_API_KEY"]),model="kimi-k2.6",stream=True,context_size=262_144,diff --git a/scripts/model_examples/run_tests.py b/scripts/model_examples/run_tests.pyindex 089464256..3a1643e53 100644--- a/scripts/model_examples/run_tests.py+++ b/scripts/model_examples/run_tests.py@@ -157,16 +157,16 @@ ALL_PROVIDERS: list[Provider] = [description="Google Gemini models",),Provider(- name="kimi",+ name="moonshot",env_var="MOONSHOT_API_KEY",- file_prefix="kimi",+ file_prefix="moonshot",supported_tests=["call","multiagent","multimodal","multiagent_multimodal",],- description="Moonshot AI Kimi models",+ description="Moonshot AI (Kimi) models",),Provider(name="xai",diff --git a/src/agentscope/credential/__init__.py b/src/agentscope/credential/__init__.pyindex 1084a4c3e..912379148 100644--- a/src/agentscope/credential/__init__.py+++ b/src/agentscope/credential/__init__.py@@ -5,7 +5,7 @@ from ._anthropic import AnthropicCredentialfrom ._dashscope import DashScopeCredentialfrom ._deepseek import DeepSeekCredentialfrom ._gemini import GeminiCredential-from ._kimi import KimiCredential+from ._moonshot import MoonshotCredentialfrom ._ollama import OllamaCredentialfrom ._openai import OpenAICredentialfrom ._xai import XAICredential@@ -15,7 +15,7 @@ __all__ = ["DashScopeCredential","DeepSeekCredential","GeminiCredential",- "KimiCredential",+ "MoonshotCredential","OllamaCredential","OpenAICredential","XAICredential",@@ -31,7 +31,7 @@ def list_credential() -> list[dict]:DashScopeCredential,DeepSeekCredential,GeminiCredential,- KimiCredential,+ MoonshotCredential,OllamaCredential,OpenAICredential,XAICredential,diff --git a/src/agentscope/credential/_kimi.py b/src/agentscope/credential/_kimi.pydeleted file mode 100644index 3f8369053..000000000--- a/src/agentscope/credential/_kimi.py+++ /dev/null@@ -1,37 +0,0 @@-# -*- coding: utf-8 -*--"""The Kimi (Moonshot AI) credential."""-from typing import Literal, Type, TYPE_CHECKING--from pydantic import Field, SecretStr--from ._base import CredentialBase--if TYPE_CHECKING:- from ..model import ChatModelBase--_KIMI_BASE_URL = "https://api.moonshot.cn/v1"---class KimiCredential(CredentialBase):- """The Kimi (Moonshot AI) credential model."""-- type: Literal["kimi_credential"] = "kimi_credential"- """The credential type."""-- api_key: SecretStr = Field(- description="The Kimi (Moonshot AI) API key.",- )- """The API key."""-- base_url: str = Field(- default=_KIMI_BASE_URL,- description="The base URL for the Kimi API.",- )- """The base URL for the Kimi API."""-- @classmethod- def get_chat_model_class(cls) -> Type["ChatModelBase"]:- """Return the KimiChatModel class."""- from ..model import KimiChatModel-- return KimiChatModeldiff --git a/src/agentscope/credential/_moonshot.py b/src/agentscope/credential/_moonshot.pynew file mode 100644index 000000000..f0b294775--- /dev/null+++ b/src/agentscope/credential/_moonshot.py@@ -0,0 +1,37 @@+# -*- coding: utf-8 -*-+"""The Moonshot AI credential."""+from typing import Literal, Type, TYPE_CHECKING++from pydantic import Field, SecretStr++from ._base import CredentialBase++if TYPE_CHECKING:+ from ..model import ChatModelBase++_MOONSHOT_BASE_URL = "https://api.moonshot.cn/v1"+++class MoonshotCredential(CredentialBase):+ """The Moonshot AI credential model."""++ type: Literal["moonshot_credential"] = "moonshot_credential"+ """The credential type."""++ api_key: SecretStr = Field(+ description="The Moonshot AI API key.",+ )+ """The API key."""++ base_url: str = Field(+ default=_MOONSHOT_BASE_URL,+ description="The base URL for the Moonshot AI API.",+ )+ """The base URL for the Moonshot AI API."""++ @classmethod+ def get_chat_model_class(cls) -> Type["ChatModelBase"]:+ """Return the MoonshotChatModel class."""+ from ..model import MoonshotChatModel++ return MoonshotChatModeldiff --git a/src/agentscope/formatter/__init__.py b/src/agentscope/formatter/__init__.pyindex 6ccf08be7..0594040e8 100644--- a/src/agentscope/formatter/__init__.py+++ b/src/agentscope/formatter/__init__.py@@ -30,7 +30,10 @@ from ._openai_response_formatter import (OpenAIResponseFormatter,OpenAIResponseMultiAgentFormatter,)-from ._kimi_formatter import KimiChatFormatter, KimiMultiAgentFormatter+from ._moonshot_formatter import (+ MoonshotChatFormatter,+ MoonshotMultiAgentFormatter,+)from ._xai_formatter import (XAIChatFormatter,XAIMultiAgentFormatter,@@ -52,8 +55,8 @@ __all__ = ["DeepSeekMultiAgentFormatter","OpenAIResponseFormatter","OpenAIResponseMultiAgentFormatter",- "KimiChatFormatter",- "KimiMultiAgentFormatter",+ "MoonshotChatFormatter",+ "MoonshotMultiAgentFormatter","XAIChatFormatter","XAIMultiAgentFormatter",]diff --git a/src/agentscope/formatter/_kimi_formatter.py b/src/agentscope/formatter/_moonshot_formatter.pysimilarity index 84%rename from src/agentscope/formatter/_kimi_formatter.pyrename to src/agentscope/formatter/_moonshot_formatter.pyindex fb6862cc2..680c77bb7 100644--- a/src/agentscope/formatter/_kimi_formatter.py+++ b/src/agentscope/formatter/_moonshot_formatter.py@@ -1,5 +1,5 @@# -*- coding: utf-8 -*--"""The Kimi (Moonshot AI) formatter for agentscope."""+"""The Moonshot AI formatter for agentscope."""from typing import Anyfrom pydantic import Field@@ -18,13 +18,13 @@ from ..message import ()-class KimiChatFormatter(_OpenAIFormatterBase):- """The Kimi formatter for chatbot scenario.+class MoonshotChatFormatter(_OpenAIFormatterBase):+ """The Moonshot AI formatter for chatbot scenario.- Kimi's API is OpenAI-compatible, but thinking models (``kimi-k2.6``,+ Moonshot's API is OpenAI-compatible, but thinking models (``kimi-k2.6``,``kimi-k2-thinking``) return a ``reasoning_content`` field alongside``content`` in assistant messages. This formatter preserves that field- when re-sending assistant messages back to the API so that Kimi's+ when re-sending assistant messages back to the API so that the*Preserved Thinking* feature works correctly in multi-turn conversations."""@@ -40,7 +40,7 @@ class KimiChatFormatter(_OpenAIFormatterBase):self,msgs: list[Msg],) -> list[dict[str, Any]]:- """Format messages into the Kimi / OpenAI-compatible API format.+ """Format messages into the Moonshot / OpenAI-compatible API format.Behaves identically to :class:`OpenAIChatFormatter` except that:class:`ThinkingBlock` content is placed into the ``reasoning_content``@@ -66,8 +66,8 @@ class KimiChatFormatter(_OpenAIFormatterBase):for block in msg.get_content_blocks():if isinstance(block, ThinkingBlock):- # Preserve reasoning_content for Kimi's multi-turn- # Preserved Thinking feature (kimi-k2.6 / kimi-k2-thinking)+ # Preserve reasoning_content for multi-turn+ # Preserved Thinking (kimi-k2.6 / kimi-k2-thinking)reasoning_parts.append(block.thinking)elif isinstance(block, TextBlock):@@ -83,18 +83,18 @@ class KimiChatFormatter(_OpenAIFormatterBase):elif isinstance(block, HintBlock):if content_blocks or tool_calls:- msg_kimi = {+ msg_moonshot = {"role": msg.role,"name": msg.name,"content": content_blocks or None,}if reasoning_parts:- msg_kimi["reasoning_content"] = "\n".join(+ msg_moonshot["reasoning_content"] = "\n".join(reasoning_parts,)if tool_calls:- msg_kimi["tool_calls"] = tool_calls- messages.append(msg_kimi)+ msg_moonshot["tool_calls"] = tool_calls+ messages.append(msg_moonshot)content_blocks = []reasoning_parts = []tool_calls = []@@ -141,38 +141,38 @@ class KimiChatFormatter(_OpenAIFormatterBase):type(block),)- msg_kimi = {+ msg_moonshot = {"role": msg.role,"name": msg.name,"content": content_blocks or None,}- # Kimi's Preserved Thinking requires `reasoning_content` on ALL+ # Moonshot's Preserved Thinking requires `reasoning_content` on ALL# assistant messages in multi-turn conversations (None when no# thinking took place), so that the model can continue its chain# of thought correctly.if msg.role == "assistant":- msg_kimi["reasoning_content"] = (+ msg_moonshot["reasoning_content"] = ("\n".join(reasoning_parts) if reasoning_parts else "")if tool_calls:- msg_kimi["tool_calls"] = tool_calls+ msg_moonshot["tool_calls"] = tool_calls- if msg_kimi["content"] or msg_kimi.get("tool_calls"):- messages.append(msg_kimi)+ if msg_moonshot["content"] or msg_moonshot.get("tool_calls"):+ messages.append(msg_moonshot)i += 1return messages-class KimiMultiAgentFormatter(_OpenAIFormatterBase):- """Formatter for the Kimi (Moonshot AI) API in multi-agent conversations.+class MoonshotMultiAgentFormatter(_OpenAIFormatterBase):+ """Formatter for the Moonshot AI API in multi-agent conversations.- Kimi's API is OpenAI-compatible, so the multi-agent history collapsing+ Moonshot's API is OpenAI-compatible, so the multi-agent history collapsingstrategy is the same as :class:`OpenAIMultiAgentFormatter`. Tool- sequences are delegated to :class:`KimiChatFormatter` so that+ sequences are delegated to :class:`MoonshotChatFormatter` so that``reasoning_content`` is preserved correctly for multi-turn*Preserved Thinking* conversations.@@ -199,12 +199,12 @@ class KimiMultiAgentFormatter(_OpenAIFormatterBase):)async def format(self, msgs: list[Msg]) -> list[dict[str, Any]]:- """Format input messages into the Kimi API format for multi-agent- conversations.+ """Format input messages into the Moonshot AI API format for+ multi-agent conversations.Non-tool messages from all agents are collapsed into a single usermessage with ``<history></history>`` tags. Tool call / result- sequences are delegated to :class:`KimiChatFormatter`.+ sequences are delegated to :class:`MoonshotChatFormatter`.Args:msgs (`list[Msg]`):@@ -228,7 +228,7 @@ class KimiMultiAgentFormatter(_OpenAIFormatterBase):async for typ, group in self._group_messages(msgs[start_index:]):if typ == "tool_sequence":formatted_msgs.extend(- await KimiChatFormatter(+ await MoonshotChatFormatter(input_types=self.input_types,).format(group),)@@ -248,8 +248,8 @@ class KimiMultiAgentFormatter(_OpenAIFormatterBase):msgs: list[Msg],) -> list[dict[str, Any]]:"""Format a sequence of tool-related messages using- KimiChatFormatter."""- return await KimiChatFormatter(+ MoonshotChatFormatter."""+ return await MoonshotChatFormatter(input_types=self.input_types,).format(msgs)@@ -300,7 +300,7 @@ class KimiMultiAgentFormatter(_OpenAIFormatterBase):@staticmethodasync def _format_system_message(msg: Msg) -> dict[str, Any]:- """Format a system message for the Kimi API."""+ """Format a system message for the Moonshot AI API."""return {"role": "system","content": msg.get_text_content(),diff --git a/src/agentscope/model/__init__.py b/src/agentscope/model/__init__.pyindex 3394c037c..91386556d 100644--- a/src/agentscope/model/__init__.py+++ b/src/agentscope/model/__init__.py@@ -12,7 +12,7 @@ from ._gemini import GeminiChatModelfrom ._ollama import OllamaChatModelfrom ._openai_chat import OpenAIChatModelfrom ._xai import XAIChatModel-from ._kimi import KimiChatModel+from ._moonshot import MoonshotChatModelfrom ._openai_response import OpenAIResponseModel__all__ = [@@ -28,6 +28,6 @@ __all__ = ["OllamaChatModel","OpenAIChatModel","XAIChatModel",- "KimiChatModel",+ "MoonshotChatModel","OpenAIResponseModel",]diff --git a/src/agentscope/model/_kimi/__init__.py b/src/agentscope/model/_kimi/__init__.pydeleted file mode 100644index fb5632be1..000000000--- a/src/agentscope/model/_kimi/__init__.py+++ /dev/null@@ -1,9 +0,0 @@-# -*- coding: utf-8 -*--"""The Kimi (Moonshot AI) LLM API modules."""--from ._model import KimiCredential, KimiChatModel--__all__ = [- "KimiCredential",- "KimiChatModel",-]diff --git a/src/agentscope/model/_moonshot/__init__.py b/src/agentscope/model/_moonshot/__init__.pynew file mode 100644index 000000000..5480a5864--- /dev/null+++ b/src/agentscope/model/_moonshot/__init__.py@@ -0,0 +1,8 @@+# -*- coding: utf-8 -*-+"""The Moonshot AI LLM API modules."""++from ._model import MoonshotChatModel++__all__ = [+ "MoonshotChatModel",+]diff --git a/src/agentscope/model/_kimi/_model.py b/src/agentscope/model/_moonshot/_model.pysimilarity index 90%rename from src/agentscope/model/_kimi/_model.pyrename to src/agentscope/model/_moonshot/_model.pyindex c01f3d9fe..b2678ba03 100644--- a/src/agentscope/model/_kimi/_model.py+++ b/src/agentscope/model/_moonshot/_model.py@@ -1,5 +1,5 @@# -*- coding: utf-8 -*--"""The Kimi (Moonshot AI) chat model implementation."""+"""The Moonshot AI chat model implementation."""from collections import OrderedDictfrom datetime import datetimefrom typing import Literal, Any, AsyncGenerator, TYPE_CHECKING, List@@ -9,8 +9,8 @@ from pydantic import BaseModel, Fieldfrom .._base import ChatModelBase, _TOOL_CHOICE_LITERAL_MODESfrom .._model_response import ChatResponsefrom .._model_usage import ChatUsage-from ...credential import KimiCredential-from ...formatter import FormatterBase, KimiChatFormatter+from ...credential import MoonshotCredential+from ...formatter import FormatterBase, MoonshotChatFormatterfrom ...message import ThinkingBlock, ToolCallBlock, TextBlockfrom ...tool import ToolChoicefrom ...tracing import trace_llm@@ -23,11 +23,11 @@ else:AsyncStream = Any-class KimiChatModel(ChatModelBase):- """The Kimi (Moonshot AI) chat model."""+class MoonshotChatModel(ChatModelBase):+ """The Moonshot AI chat model."""class Parameters(BaseModel):- """The parameters for the Kimi chat model."""+ """The parameters for the Moonshot AI chat model."""max_tokens: int | None = Field(default=None,@@ -52,41 +52,40 @@ class KimiChatModel(ChatModelBase):le=1,)- type: Literal["kimi_chat"] = "kimi_chat"+ type: Literal["moonshot_chat"] = "moonshot_chat""""The type of the chat model."""def __init__(self,- credential: KimiCredential,+ credential: MoonshotCredential,model: str,- parameters: "KimiChatModel.Parameters | None" = None,+ parameters: "MoonshotChatModel.Parameters | None" = None,stream: bool = True,max_retries: int = 3,context_size: int = 131072,formatter: FormatterBase | None = None,) -> None:- """Initialize the Kimi chat model.+ """Initialize the Moonshot AI chat model.Args:- credential (`KimiCredential`):- The Kimi (Moonshot AI) credential used to authenticate API- calls.+ credential (`MoonshotCredential`):+ The Moonshot AI credential used to authenticate API calls.model (`str`):- The Kimi model name, e.g. ``moonshot-v1-8k``.- parameters (`KimiChatModel.Parameters | None`, defaults to \+ The model name, e.g. ``moonshot-v1-8k``, ``kimi-k2.6``.+ parameters (`MoonshotChatModel.Parameters | None`, defaults to \`None`):- The Kimi API parameters. When ``None``, the default- parameters will be used.+ The API parameters. When ``None``, the default parameters+ will be used.stream (`bool`, defaults to `True`):Whether to enable streaming output.max_retries (`int`, defaults to `3`):- The maximum number of retries for the Kimi API.+ The maximum number of retries for the API.context_size (`int`, defaults to `131072`):The model context size used for context compression.formatter (`FormatterBase | None`, defaults to `None`):The formatter that converts ``Msg`` objects to the format- required by the Kimi API. When ``None``, a- ``KimiChatFormatter`` instance will be used.+ required by the API. When ``None``, a+ ``MoonshotChatFormatter`` instance will be used."""super().__init__(model=model,@@ -96,7 +95,7 @@ class KimiChatModel(ChatModelBase):)self.credential = credentialself.parameters = parameters or self.Parameters()- self.formatter = formatter or KimiChatFormatter()+ self.formatter = formatter or MoonshotChatFormatter()@trace_llmasync def _call_api(@@ -107,7 +106,7 @@ class KimiChatModel(ChatModelBase):tool_choice: ToolChoice | None = None,**generate_kwargs: Any,) -> ChatResponse | AsyncGenerator[ChatResponse, None]:- """Call the Kimi chat API (OpenAI-compatible).+ """Call the Moonshot AI chat API (OpenAI-compatible).Args:model_name (`str`):@@ -177,7 +176,7 @@ class KimiChatModel(ChatModelBase):start_datetime: datetime,response: AsyncStream,) -> AsyncGenerator[ChatResponse, None]:- """Parse the Kimi streaming response.+ """Parse the Moonshot AI streaming response.Args:start_datetime (`datetime`):@@ -221,7 +220,7 @@ class KimiChatModel(ChatModelBase):choice = chunk.choices[0]delta = choice.delta- # Kimi thinking models (kimi-k2.6, kimi-k2-thinking) return+ # Thinking models (kimi-k2.6, kimi-k2-thinking) return# reasoning_content before content in the stream.delta_thinking = (getattr(delta, "reasoning_content", None) or ""@@ -296,7 +295,7 @@ class KimiChatModel(ChatModelBase):start_datetime: datetime,response: ChatCompletion,) -> ChatResponse:- """Parse the Kimi non-streaming response.+ """Parse the Moonshot AI non-streaming response.Args:start_datetime (`datetime`):@@ -354,7 +353,8 @@ class KimiChatModel(ChatModelBase):tools: list[dict] | None,tool_choice: ToolChoice | None,) -> tuple[list[dict] | None, str | dict | None]:- """Validate, filter, and format tools and tool_choice for the Kimi API.+ """Validate, filter, and format tools and tool_choice for the+ Moonshot AI API.When ``tool_choice.tools`` is specified the schemas list is filteredto only those tools. When ``tool_choice.mode`` is a specific tool namediff --git a/src/agentscope/model/_kimi/_models/kimi-k2.5.yaml b/src/agentscope/model/_moonshot/_models/kimi-k2.5.yamlsimilarity index 100%rename from src/agentscope/model/_kimi/_models/kimi-k2.5.yamlrename to src/agentscope/model/_moonshot/_models/kimi-k2.5.yamldiff --git a/src/agentscope/model/_kimi/_models/kimi-k2.6.yaml b/src/agentscope/model/_moonshot/_models/kimi-k2.6.yamlsimilarity index 100%rename from src/agentscope/model/_kimi/_models/kimi-k2.6.yamlrename to src/agentscope/model/_moonshot/_models/kimi-k2.6.yamldiff --git a/src/agentscope/model/_kimi/_models/moonshot-v1-128k.yaml b/src/agentscope/model/_moonshot/_models/moonshot-v1-128k.yamlsimilarity index 100%rename from src/agentscope/model/_kimi/_models/moonshot-v1-128k.yamlrename to src/agentscope/model/_moonshot/_models/moonshot-v1-128k.yamldiff --git a/src/agentscope/model/_kimi/_models/moonshot-v1-32k.yaml b/src/agentscope/model/_moonshot/_models/moonshot-v1-32k.yamlsimilarity index 100%rename from src/agentscope/model/_kimi/_models/moonshot-v1-32k.yamlrename to src/agentscope/model/_moonshot/_models/moonshot-v1-32k.yamldiff --git a/src/agentscope/model/_kimi/_models/moonshot-v1-8k.yaml b/src/agentscope/model/_moonshot/_models/moonshot-v1-8k.yamlsimilarity index 100%rename from src/agentscope/model/_kimi/_models/moonshot-v1-8k.yamlrename to src/agentscope/model/_moonshot/_models/moonshot-v1-8k.yamldiff --git a/tests/formatter_kimi_test.py b/tests/formatter_moonshot_test.pysimilarity index 94%rename from tests/formatter_kimi_test.pyrename to tests/formatter_moonshot_test.pyindex 7045088db..5e32aeb9c 100644--- a/tests/formatter_kimi_test.py+++ b/tests/formatter_moonshot_test.py@@ -1,13 +1,13 @@# -*- coding: utf-8 -*--"""Comprehensive formatter unit tests for KimiChatFormatter and-KimiMultiAgentFormatter, following the reference test style with exact+"""Comprehensive formatter unit tests for MoonshotChatFormatter and+MoonshotMultiAgentFormatter, following the reference test style with exactground-truth comparisons."""from unittest import IsolatedAsyncioTestCasefrom agentscope.formatter import (- KimiChatFormatter,- KimiMultiAgentFormatter,+ MoonshotChatFormatter,+ MoonshotMultiAgentFormatter,)from agentscope.message import (Msg,@@ -25,8 +25,8 @@ from agentscope.message._block import ToolResultState_FIXED_ID = "TESTID1234567"-class TestKimiFormatter(IsolatedAsyncioTestCase):- """Comprehensive tests for Kimi Chat and MultiAgent formatters."""+class TestMoonshotFormatter(IsolatedAsyncioTestCase):+ """Comprehensive tests for Moonshot Chat and MultiAgent formatters."""async def asyncSetUp(self) -> None:"""Set up shared message fixtures and expected ground-truth dicts."""@@ -126,7 +126,7 @@ class TestKimiFormatter(IsolatedAsyncioTestCase):]# ---------------------------------------------------------------- # Ground truth: KimiChatFormatter+ # Ground truth: MoonshotChatFormatter# - Same as OpenAI except ALL assistant messages have an extra# "reasoning_content" field (empty string when no ThinkingBlock).# ---------------------------------------------------------------@@ -221,11 +221,13 @@ class TestKimiFormatter(IsolatedAsyncioTestCase):]# ---------------------------------------------------------------- # Ground truth: KimiMultiAgentFormatter+ # Ground truth: MoonshotMultiAgentFormatter# - Same as OpenAI MultiAgent, but tool-sequence assistant messages# carry "reasoning_content": "".# ---------------------------------------------------------------- _hist_prompt = KimiMultiAgentFormatter().conversation_history_prompt+ _hist_prompt = (+ MoonshotMultiAgentFormatter().conversation_history_prompt+ )_conv_text = ("user: What is the capital of France?\n"@@ -314,12 +316,12 @@ class TestKimiFormatter(IsolatedAsyncioTestCase):]# -------------------------------------------------------------------- # KimiChatFormatter tests+ # MoonshotChatFormatter tests# -------------------------------------------------------------------async def test_chat_formatter(self) -> None:"""Chat formatter produces exact output for various subsets."""- fmt = KimiChatFormatter()+ fmt = MoonshotChatFormatter()self.maxDiff = None# Full history@@ -350,9 +352,9 @@ class TestKimiFormatter(IsolatedAsyncioTestCase):async def test_chat_formatter_thinking_to_reasoning_content(self,) -> None:- """ThinkingBlock becomes reasoning_content in Kimi (Preserved+ """ThinkingBlock becomes reasoning_content in Moonshot (PreservedThinking)."""- fmt = KimiChatFormatter()+ fmt = MoonshotChatFormatter()msgs = [Msg(name="assistant",@@ -376,7 +378,7 @@ class TestKimiFormatter(IsolatedAsyncioTestCase):) -> None:"""All assistant messages always have reasoning_content (even whenempty)."""- fmt = KimiChatFormatter()+ fmt = MoonshotChatFormatter()msgs = [Msg(name="assistant",@@ -391,7 +393,7 @@ class TestKimiFormatter(IsolatedAsyncioTestCase):async def test_chat_formatter_base64_image(self) -> None:"""Base64-encoded image is inlined as a data URI."""- fmt = KimiChatFormatter()+ fmt = MoonshotChatFormatter()msgs = [Msg(name="user",@@ -427,12 +429,12 @@ class TestKimiFormatter(IsolatedAsyncioTestCase):)# -------------------------------------------------------------------- # KimiMultiAgentFormatter tests+ # MoonshotMultiAgentFormatter tests# -------------------------------------------------------------------async def test_multiagent_formatter(self) -> None:"""MultiAgent formatter produces exact output for various subsets."""- fmt = KimiMultiAgentFormatter()+ fmt = MoonshotMultiAgentFormatter()self.maxDiff = None# Full historydiff --git a/tests/model_kimi_test.py b/tests/model_moonshot_test.pysimilarity index 91%rename from tests/model_kimi_test.pyrename to tests/model_moonshot_test.pyindex 07c192415..9ee817fff 100644--- a/tests/model_kimi_test.py+++ b/tests/model_moonshot_test.py@@ -1,8 +1,8 @@# -*- coding: utf-8 -*-# pylint: disable=protected-access-"""Unit tests for KimiChatModel response parsing.+"""Unit tests for MoonshotChatModel response parsing.-Formatter tests have been moved to tests/formatter_kimi_test.py.+Formatter tests have been moved to tests/formatter_moonshot_test.py."""import jsonfrom typing import Any@@ -12,8 +12,8 @@ from unittest import IsolatedAsyncioTestCasefrom unittest.mock import MagicMockfrom agentscope.message import TextBlock, ToolCallBlock, ThinkingBlock-from agentscope.model import KimiChatModel-from agentscope.credential import KimiCredential+from agentscope.model import MoonshotChatModel+from agentscope.credential import MoonshotCredentialfrom agentscope.tool import ToolChoice@@ -23,8 +23,8 @@ from agentscope.tool import ToolChoicedef _make_model() -> Any:- return KimiChatModel(- credential=KimiCredential(api_key="test"),+ return MoonshotChatModel(+ credential=MoonshotCredential(api_key="test"),model="kimi-k2-5",stream=False,context_size=131_072,@@ -36,8 +36,8 @@ def _make_model() -> Any:# ----------------------------------------------------------------------------class TestKimiModelParsing(IsolatedAsyncioTestCase):- """Unit tests for KimiChatModel response parsing."""+class TestMoonshotModelParsing(IsolatedAsyncioTestCase):+ """Unit tests for MoonshotChatModel response parsing."""def setUp(self) -> None:"""Set up a fresh model instance and start time."""@@ -50,7 +50,7 @@ class TestKimiModelParsing(IsolatedAsyncioTestCase):tool_calls: Any = None,reasoning: Any = None,) -> "MagicMock":- """Build a mock Kimi API completion response object."""+ """Build a mock Moonshot API completion response object."""msg = MagicMock()msg.content = textsetattr(msg, "reasoning_content", reasoning)@@ -149,8 +149,8 @@ _FT_TOOLS = []-class TestKimiFormatTools(unittest.TestCase):- """Tests for KimiChatModel._format_tools."""+class TestMoonshotFormatTools(unittest.TestCase):+ """Tests for MoonshotChatModel._format_tools."""def setUp(self) -> None:"""Set up model instance."""