模型卡提供了可直接复制使用的聊天模板调用方式:开/关思考模式(enable_thinking / save_reasoning_content)、函数调用格式(arguments 必须是 dict 而非字符串)、以及 vLLM / SGLang / Docker 三种部署命令。
适合的任务:自托管 LongCat-2.0(GPU 或 NPU);在 Transformers / vLLM / SGLang 中正确构造带工具调用的消息序列;控制思考模式开关
不适合的任务:非代码环境下的快速试用(建议直接用官网聊天 https://longcat.ai 或 API);需要量化部署说明(INT8/FP8 另有模型卡:meituan-longcat/LongCat-2.0-FP8、LongCat-2.0-INT8)
适用的模型版本:LongCat-2.0(含 FP8/INT8 量化版)
适用的客户端、Agent 或 API:Transformers(LongcatCausalLM)、vLLM、SGLang、Docker Model Runner
推荐的推理档位和参数:开启思考模式并保留全部推理内容(enable_thinking=True, save_reasoning_content=True)官方称"for better performance";关闭思考(enable_thinking=False)"for better token efficiency"
from transformers import LongcatCausalLM
model = LongcatCausalLM.from_pretrained("meituan-longcat/LongCat-2.0", device_map="auto")pip install vllm
vllm serve "meituan-longcat/LongCat-2.0"
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{"model": "meituan-longcat/LongCat-2.0",
"messages": [{"role": "user", "content": "What is the capital of France?"}]}'pip install sglang
python3 -m sglang.launch_server \
--model-path "meituan-longcat/LongCat-2.0" \
--host 0.0.0.0 \
--port 30000NPU 部署见 SGLang-FluentLLM;官方另有 GPU 部署 cookbook(GitHub 仓库 README 指向)。
arguments 为 dict)from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("meituan-longcat/LongCat-2.0", trust_remote_code=True)
tools = [
{"type": "function", "function": {
"name": "func_add", "description": "Calculate the sum of two numbers",
"parameters": {"type": "object", "properties": {
"x1": {"type": "number", "description": "The first number to add"},
"x2": {"type": "number", "description": "The second number to add"}},
"required": ["x1", "x2"]}}},
{"type": "function", "function": {
"name": "func_multiply", "description": "Calculate the product of two numbers",
"parameters": {"type": "object", "properties": {
"x1": {"type": "number", "description": "The first number to multiply"},
"x2": {"type": "number", "description": "The second number to multiply"}},
"required": ["x1", "x2"]}}},
]
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Calculate 1+1"},
{"role": "assistant", "reasoning_content": "Calling func_add to calculate 1+1",
# Note: 与标准 OpenAI 格式不同,官方要求 arguments 是 dict 而不是字符串
"tool_calls": [{"type": "function", "function": {"name": "func_add", "arguments": {"x1": 1, "x2": 1}}}]},
{"role": "tool", "name": "func_add", "content": '{"ans": 2}'},
{"role": "assistant", "reasoning_content": "The result is 2", "content": "2"},
{"role": "user", "content": "Check your answer, is it correct?"},
]
# 思考模式开(推荐,保留全部推理内容)
prompt_full = tokenizer.apply_chat_template(
messages, tools=tools, tokenize=False,
enable_thinking=True, add_generation_prompt=True, save_reasoning_content=True)
# 思考模式关(更省 token)
prompt_no_think = tokenizer.apply_chat_template(
messages, tools=tools, tokenize=False,
enable_thinking=False, add_generation_prompt=True)官方模型卡规格:1.6T 总参数、约 48B/token 激活(HF 元数据模型大小显示 1.8T,含 N-gram Embedding 等);原生 1M 上下文;MIT 许可证。
关键特性:LongCat Sparse Attention(SI/CLI/HI 三项正交优化)、3-step MTP 投机解码、135B N-gram Embedding(n-gram size=5)。
社区(r/LocalLLaMA)补充:BF16 全量权重约 3.55TB,FP8 约 2.05TB;FP8/INT8 量化版模型卡同样提供 vLLM/SGLang 部署命令。
训练数据:35T+ tokens、5 万余国产算力芯片、无回滚(官方博客口径)。
自托管门槛高:BF16 全量 3.55TB,个人设备不现实;FP8(2.05TB)仍需多卡集群,官方部署文档面向 SGLang 多节点(prefill-decode 分离、KVP 切分)。
工具调用格式与标准 OpenAI 有差异(arguments 为 dict),接入自研 Agent 时需按此格式适配;官方 API 与 OpenRouter 渠道是否完全一致未在模型卡中说明。
模型卡基准为官方自测(统一 harness),第三方独立复核见测评目录文档。
LongCat 2.0