Strictly assembling LongCat-Flash-Chat's round prefixes, conversation history, and <longcat_tool_call> XML wrapper according to the official template makes it possible to reproduce the multi-turn dialogue and function-calling format of its open-source weights.
Good for: Constructing message sequences for local/self-hosted inference, multi-turn dialogue, tool calling, and Agent harnesses.
Not for: Treating the XML template as an OpenAI/Anthropic API request schema, or rewriting special tokens without a tokenizer configuration.
Applicable model versions: The open-source Meituan LongCat-Flash-Chat weights; the API version has been upgraded, and the current legacy model service has been retired, so the integration surface must be confirmed first.
Applicable clients, Agents, or APIs: The official tokenizer/chat template, SGLang, and vLLM adapters; see the repository's Deployment Guide for specific deployment parameters.
Recommended inference tier and parameters: The model is a non-thinking foundation model; the repository does not provide a temperature/top-p combination that can be reproduced uniformly, so the deployer must fix these values.
[Round 0] USER:{query} ASSISTANT:SYSTEM:{system_prompt} [Round 0] USER:{query} ASSISTANT:SYSTEM:{system_prompt} [Round 0] USER:{query} ASSISTANT:{response}</longcat_s>... [Round N-1] USER:{query} ASSISTANT:{response}</longcat_s> [Round N] USER:{query} ASSISTANT:{tool_description}
## Messages
SYSTEM:{system_prompt} [Round 0] USER:{query} ASSISTANT:
## Tools
You have access to the following tools:
### Tool namespace: function
#### Tool name: {func.name}
Description: {func.description}
InputSchema:
{json.dumps(func.parameters, indent=2)}
For each function call, return a JSON object inside its own XML tag:
<longcat_tool_call>
{"name": <function-name>, "arguments": <args-dict>}
</longcat_tool_call>Read the actual chat template from the repository's tokenizer_config.json; do not rely only on the simplified example in the README.
First run a tool-free first turn and a multi-turn echo test to confirm that the special end marker and round concatenation match.
Serialize the tool schema into ## Tools, requiring the model to output only JSON wrapped in <longcat_tool_call>.
Have the harness parse each XML block, execute the function, return the result as the next-round USER/tool context, and then independently verify the final answer.
Record the model version, tokenizer, inference engine, context length, and tool-calling errors; do not mix the server API's JSON tool schema with the local template.
The official repository provides four templates: first turn, system prompt, multi-turn, and ToolCall.
The tool-calling convention uses <longcat_tool_call> XML tags, with the function name and parameter JSON inside; multiple function calls use multiple consecutive tags.
The official repository says that SGLang and vLLM adapters are available, with detailed deployment instructions in docs/deployment_guide.md.
The template defines the input/output convention for the open-source weights; compatibility with every third-party API gateway is not guaranteed.
The legacy API service has been retired according to the official Change Log; when calling through a new platform, use the current model list and API documentation as the authority.
The ToolCall template defines only the format. It does not guarantee correct tool selection, safe arguments, or successful completion of the final task; the execution layer must perform schema validation, permission isolation, and timeout handling.
The official template writes rounds as [Round N] USER... ASSISTANT and retains the <longcat_s> end marker in multi-turn exchanges.
The official tool format requires function calls to appear inside <longcat_tool_call> tags rather than as free-text descriptions.
LongCat Flash Chat