Tabbit
活动资源博客模型
Tabbit LogoTabbit

Tabbit — 为你工作的 AI 浏览器

主题资源

  • AI Browser Resources
  • Agentic Browser Resources
  • Browser Downloads and Install Guides
  • Browser Comparisons
  • AI Browser Alternatives
  • Browser Productivity Resources

热门指南

  • AI Browser
  • Agentic Browser Download
  • Best AI Browser 2026: Top 9 Tested & Ranked
  • AI Browser Download
  • Free AI Browser
  • Best AI Browser 2026
  • AI Browser Comparison 2026
  • AI Browser for Windows
  • AI Browser for Mac
  • Chrome Alternative 2026

活动

  • 别装了,你在《牛来》里早有原型
  • Tabbit 妙招大赛
  • KPOP SBTI 饭圈人格测试
  • Tabbit 校园共创者计划
  • fifi 的论文文献妙招精选
  • 用户问卷

关于

  • Tabbit 博客
  • 媒体报道
提示词
媒体LongCat 2.0

LongCat-2.0 聊天模板与工具调用配置(官方 Hugging Face 模型卡)

原始来源

Hugging Face

作者meituan-longcat(美团 LongCat 团队)

原文日期2026-06-30

Tabbit 整理2026-08-19

查看原文

一句话结论

模型卡提供了可直接复制使用的聊天模板调用方式:开/关思考模式(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"

可直接使用的内容

1. Transformers 加载

from transformers import LongcatCausalLM
model = LongcatCausalLM.from_pretrained("meituan-longcat/LongCat-2.0", device_map="auto")

2. vLLM 服务

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?"}]}'

3. SGLang 服务(GPU)

pip install sglang
python3 -m sglang.launch_server \
    --model-path "meituan-longcat/LongCat-2.0" \
    --host 0.0.0.0 \
    --port 30000

NPU 部署见 SGLang-FluentLLM;官方另有 GPU 部署 cookbook(GitHub 仓库 README 指向)。

4. 带工具调用的聊天模板(官方示例,注意 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),第三方独立复核见测评目录文档。

Tabbit 小编提醒

提示词内容来自公开资料与 Tabbit 编辑整理。引用前请查看原文授权与适用范围。

LongCat 2.0

在 Tabbit 中使用

LongCat 2.0

相关提示词

媒体LongCat 官方 API 文档站(longcat.chat)2026-07

LongCat-2.0 API 平台接入快速上手(官方 Quick Start + Chat Completions 参考 + 定价)

媒体LongCat 官方 API 文档站(longcat.chat);X(@NousResearch 官方账号佐证免费入口)2026-08-13

Hermes Agent 接入 LongCat-2.0 配置(官方文档 + Nous Portal 免费入口)

媒体LongCat 官方 API 文档站(longcat.chat)2026-06-30

Claude Code 接入 LongCat-2.0 配置(官方文档)

媒体LongCat 官方 API 文档站(longcat.chat)2026-06-30

OpenClaw 接入 LongCat-2.0 配置(官方文档)

LongCat 2.0

相关测评

媒体Hugging Face(meituan-longcat/LongCat-2.0)2026-06-30

LongCat-2.0 官方模型卡:规格与官方基准(含与 Gemini/GPT-5.5/Claude Opus 对比表)

媒体LongCat 官网博客(longcat.chat)2026-06-30

LongCat-2.0 官方技术博客:架构、国产算力训练与推理部署(发布说明)

媒体OpenRouter(第三方模型路由平台)2026-07-20

OpenRouter 渠道数据:LongCat-2.0 定价、实测性能与第三方基准(Artificial Analysis)

媒体aiprofitboardroom.com(博客,属 Julian Goldie 的 AI Profit Boardroom 社区)2026-05-29

AI Profit Boardroom 实测:LongCat 2.0 游戏构建测试与 GLM 5.2 同任务对比