> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lithosai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 在 OpenClaw 中使用 LithosAI

> 通过自定义的 OpenAI 兼容 provider，将 OpenClaw 直接接入 LithosAI。

## 开始之前

安装 OpenClaw CLI，在 [API Key](https://console.lithosai.cloud/keys?lang=zh) 页面创建 key，并在 [模型](https://console.lithosai.cloud/models?lang=zh) 页面选好模型。

<Steps>
  <Step title="设置 API key">
    在 Gateway 的运行环境中设置 key：

    ```bash theme={null}
    export LITHOSAI_API_KEY="your-key"
    ```

    如果 Gateway 以托管服务方式运行，在服务配置里设置这个变量。
  </Step>

  <Step title="配置 LithosAI">
    以下配置以 `moonshotai/Kimi-K3-fast` 为例。

    把配置合并到 `~/.openclaw/openclaw.json`，保留已有设置。按所用模型设置 token 上限。

    <Accordion title="OpenClaw 配置">
      ```json ~/.openclaw/openclaw.json theme={null}
      {
        "agents": {
          "defaults": {
            "model": { "primary": "lithosai/moonshotai/Kimi-K3-fast" },
            "models": {
              "lithosai/moonshotai/Kimi-K3-fast": {}
            },
            "thinkingDefault": "high"
          }
        },
        "models": {
          "mode": "merge",
          "providers": {
            "lithosai": {
              "baseUrl": "https://api.lithosai.cloud/v1",
              "apiKey": "${LITHOSAI_API_KEY}",
              "api": "openai-completions",
              "models": [
                {
                  "id": "moonshotai/Kimi-K3-fast",
                  "name": "moonshotai/Kimi-K3-fast",
                  "reasoning": true,
                  "input": ["text"],
                  "contextWindow": 65536,
                  "maxTokens": 4096,
                  "compat": {
                    "supportsReasoningEffort": true,
                    "supportedReasoningEfforts": ["low", "high", "max"],
                    "reasoningEffortMap": {
                      "low": "low",
                      "high": "high",
                      "max": "max",
                      "xhigh": "max"
                    },
                    "thinkingFormat": "openai",
                    "maxTokensField": "max_tokens"
                  },
                  "thinkingLevelMap": {
                    "minimal": null,
                    "low": "low",
                    "medium": null,
                    "high": "high",
                    "xhigh": null,
                    "max": "max"
                  }
                }
              ]
            }
          }
        }
      }
      ```
    </Accordion>

    要添加其他模型或速度档位，复制 `models.providers.lithosai.models` 中的条目，把 `id` 和 `name` 设为[模型目录](https://console.lithosai.cloud/models?lang=zh)中的模型 ID，并按该模型调整 `contextWindow` 和 `maxTokens`。同时在 `agents.defaults.models` 中加上 `lithosai/<model-id>`。
  </Step>

  <Step title="重启 Gateway">
    重启 Gateway，加载新的 provider 和 key：

    ```bash theme={null}
    openclaw gateway restart
    ```
  </Step>
</Steps>

## 模型与推理强度

* **模型与速度档位**：使用 `/model lithosai/<model-id>`；在 TUI 中使用 `/models`。
* **推理强度**：使用 `/think low`、`/think high` 或 `/think max`。

<Accordion title="不经过 Gateway，使用本地 TUI">
  使用同一份配置，把 key 设为环境变量后运行：

  ```bash theme={null}
  openclaw tui --local
  ```

  用 `/models` 和 `/think` 切换。启动时不要加 `--thinking` 参数，它会覆盖会话中选择的推理强度。
</Accordion>

所有 Agent 通用的问题见[常见问题](/zh/agent-integrations#常见问题)。

## 参考资料

* [OpenClaw 文档](https://docs.openclaw.ai/gateway/config-tools/custom-providers)
* [LithosAI 模型](https://console.lithosai.cloud/models?lang=zh)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.