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

# Use LithosAI with OpenClaw

> Connect OpenClaw directly to LithosAI with a custom OpenAI-compatible provider.

OpenClaw connects directly to LithosAI through a custom OpenAI Chat Completions provider.
You do not need a local proxy or protocol adapter. OpenAI Responses-only behavior is not
available on this route.

## Before you begin

Install OpenClaw, create a key on the [API Keys](https://console.lithosai.cloud/keys) page,
and confirm the model ID you want to use on the
[Models](https://console.lithosai.cloud/models) page.

<Steps>
  <Step title="Export your LithosAI key">
    Export the key in the environment that runs the OpenClaw Gateway.

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

    <Note>
      The Gateway process itself must see `LITHOSAI_API_KEY`. Exporting it in another shell
      does not update a running service; restart the Gateway after changing it.
    </Note>
  </Step>

  <Step title="Add LithosAI as a custom provider">
    Merge the following settings into `~/.openclaw/openclaw.json`.

    ```json5 ~/.openclaw/openclaw.json theme={null}
    {
      agents: {
        defaults: {
          model: { primary: "lithosai/moonshotai/Kimi-K3" }
        }
      },
      models: {
        mode: "merge",
        providers: {
          lithosai: {
            baseUrl: "https://api.lithosai.cloud/v1",
            apiKey: "${LITHOSAI_API_KEY}",
            api: "openai-completions",
            models: [
              {
                id: "moonshotai/Kimi-K3",
                name: "Kimi K3 on LithosAI",
                input: ["text"]
              }
            ]
          }
        }
      }
    }
    ```

    Replace the model ID if you selected a different model in the LithosAI console.
  </Step>

  <Step title="Check and restart OpenClaw">
    Validate the configuration, then restart the Gateway so it reads the new provider.

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

## Verify the connection

In a workspace that contains a `README.md`, ask OpenClaw:

```text theme={null}
Read README.md and reply with only its first Markdown heading.
```

OpenClaw should read the local file and return its heading. This verifies both the model
response and a basic local tool call.

## Troubleshooting

| Symptom                         | Cause                                                                                  |
| ------------------------------- | -------------------------------------------------------------------------------------- |
| The model does not appear       | The provider was not merged into `models.providers`, or the Gateway has not restarted. |
| Authentication fails            | `LITHOSAI_API_KEY` is unavailable to the Gateway process.                              |
| OpenClaw uses a different model | `agents.defaults.model.primary` does not use the `lithosai/` provider prefix.          |

Issues common to every agent are listed under [Common issues](/coding-agents#common-issues).

## Resources

* [OpenClaw custom providers](https://docs.openclaw.ai/gateway/config-tools/custom-providers)
* [OpenClaw provider examples](https://docs.openclaw.ai/concepts/model-providers/custom-providers)
* [Install OpenClaw](https://docs.openclaw.ai/install)
* [LithosAI models](https://console.lithosai.cloud/models)
