# LongCat

> LongCat-2.0 的 LongCat API 设置

- 网址：https://funcoding.ai/agents/openclaw/providers/longcat/
- 来源：OpenClaw 官方文档原文（中文），MIT 许可，同步于 2026-10-11
- 官方原文：https://docs.openclaw.ai/zh-CN/providers/longcat

---
[LongCat](https://longcat.ai) 为 LongCat-2.0 提供托管 API。LongCat-2.0 是一款面向编程和智能体工作负载构建的推理模型。OpenClaw 为 LongCat 的 OpenAI 兼容端点提供官方 `longcat` 插件。

| 属性       | 值                                 |
| ---------- | ---------------------------------- |
| 提供商     | `longcat`                 |
| 身份验证   | `LONGCAT_API_KEY`                 |
| API        | OpenAI 兼容的 Chat Completions     |
| 基础 URL   | `https://api.longcat.chat/openai`                 |
| 模型       | `longcat/LongCat-2.0`                 |
| 上下文     | 1,048,576 tokens                   |
| 最大输出   | 131,072 tokens                     |
| 输入       | 文本                               |

## 安装插件

安装官方软件包，然后重启 Gateway 网关：

```bash
openclaw plugins install @openclaw/longcat-provider
openclaw gateway restart
```

## 入门指南

**创建 API key**

登录 [LongCat API 平台](https://longcat.chat/platform/)，并在
[API Keys](https://longcat.chat/platform/api_keys) 页面创建密钥。

**运行新手引导**

```bash
openclaw onboard --auth-choice longcat-api-key
```

**验证模型**

```bash
openclaw models list --provider longcat
```

如果尚未配置主模型，新手引导会添加托管目录并选择 `longcat/LongCat-2.0`。

### 非交互式设置

```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice longcat-api-key \
  --longcat-api-key "$LONGCAT_API_KEY"
```

## 推理行为

LongCat 提供二元思考控制。OpenClaw 将已启用的思考级别映射到
`thinking: { type: "enabled" }`，并将 `/think off` 映射到
`thinking: { type: "disabled" }`。LongCat 目前未记录
`reasoning_effort`，因此 OpenClaw 不会发送它。

LongCat 在 `reasoning_content` 中返回推理内容。OpenClaw 在重放助手工具调用轮次时会保留该字段，以便多轮智能体会话维持提供商预期的消息结构。

## 定价

内置目录采用 LongCat 的按量付费标价，以每百万 token 的美元价格计：未缓存输入 $0.75、缓存输入 $0.015，输出 $2.95。LongCat 可能会提供临时折扣；请以[定价页面](https://longcat.chat/platform/docs/Pricing/LongCat-2.0.html)和你的账单记录为准。

## 自托管 LongCat-2.0

`longcat` 提供商面向 LongCat 的托管 API。对于
[Hugging Face](https://huggingface.co/meituan-longcat/LongCat-2.0) 上的开放权重，请通过 OpenAI 兼容运行时提供该模型，并改用 OpenClaw 现有的
[vLLM](https://funcoding.ai/agents/openclaw/providers/vllm/) 或 [SGLang](https://funcoding.ai/agents/openclaw/providers/sglang/) 提供商。

请在自托管提供商目录中保留运行时的确切模型标识符；不要通过
`longcat/LongCat-2.0` 路由本地部署。

## 故障排查

<details>
<summary>密钥在 shell 中有效，但在 Gateway 网关中无效</summary>

由守护进程管理的 Gateway 网关进程不会继承交互式 shell 中的所有变量。请将
`LONGCAT_API_KEY` 放入 `~/.openclaw/.env`，通过新手引导进行配置，或使用已批准的 secret 引用。

</details>

<details>
<summary>请求因 402 或 429 失败</summary>

`402` 表示账户的 token 配额不足。`429` 表示 API
key 触发了速率限制。请检查 [LongCat 用量](https://longcat.chat/platform/usage)，并在提供商的退避等待时间结束后重试受速率限制的请求。

</details>

<details>
<summary>模型未显示</summary>

运行 `openclaw plugins list` 并确认 `longcat` 插件已启用，然后运行
`openclaw models list --provider longcat`。

</details>

## 相关内容

- [模型提供商](https://funcoding.ai/agents/openclaw/concepts/model-providers/)：提供商配置、模型引用和故障转移行为。
- [LongCat API 文档](https://longcat.chat/platform/docs/)：托管 API 端点、身份验证、限制和示例。
- [LongCat-2.0 模型卡片](https://huggingface.co/meituan-longcat/LongCat-2.0)：架构、部署指南和模型详细信息。
- [Secret](https://funcoding.ai/agents/openclaw/gateway/secrets/)：存储提供商凭据，无需在配置中嵌入明文。
