> ## 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.

# 在 Pi 中使用 LithosAI

> 通过 OpenAI Chat Completions API，将 Pi 直接接入 LithosAI。

## 开始之前

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

<Steps>
  <Step title="设置 API key">
    把 key 设为环境变量：

    ```bash theme={null}
    export LITHOSAI_API_KEY="your-key"
    ```
  </Step>

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

    把配置添加到 `~/.pi/agent/models.json`。保留已有的 provider，并按所用模型设置 token 上限。

    <Accordion title="Pi 配置">
      ```json ~/.pi/agent/models.json theme={null}
      {
        "providers": {
          "lithosai": {
            "baseUrl": "https://api.lithosai.cloud/v1",
            "api": "openai-completions",
            "apiKey": "$LITHOSAI_API_KEY",
            "models": [
              {
                "id": "moonshotai/Kimi-K3-fast",
                "name": "moonshotai/Kimi-K3-fast",
                "reasoning": true,
                "contextWindow": 32768,
                "maxTokens": 4096,
                "thinkingLevelMap": {
                  "minimal": null,
                  "low": "low",
                  "medium": null,
                  "high": "high",
                  "xhigh": null,
                  "max": "max"
                },
                "compat": {
                  "supportsReasoningEffort": true,
                  "maxTokensField": "max_tokens"
                }
              }
            ]
          }
        }
      }
      ```
    </Accordion>

    要添加其他模型或速度档位，复制 `providers.lithosai.models` 中的条目，把 `id` 和 `name` 设为[模型目录](https://console.lithosai.cloud/models?lang=zh)中的模型 ID，并按该模型调整 `contextWindow` 和 `maxTokens`。重新打开 Pi 使配置生效。
  </Step>

  <Step title="开始对话">
    运行以下命令：

    ```bash theme={null}
    pi --provider lithosai --model moonshotai/Kimi-K3-fast --thinking high
    ```
  </Step>
</Steps>

## 模型与推理强度

* **模型与速度档位**：在当前对话中用 `/model` 切换。
* **推理强度**：打开 `/settings`，选择 **low**、**high** 或 **max**。

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

## 参考资料

* [Pi 文档](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent)
* [LithosAI 模型](https://console.lithosai.cloud/models?lang=zh)


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