# Add MandAPI as an OpenClaw model provider

Register a custom provider, select a real model and check a local chat before connecting channels.

## Register a model connection

Use your existing local OpenClaw installation. Run `openclaw config file` to find the active configuration and keep a copy before merging changes. Choose an exact MandAPI model ID with Chat Completions and tool support appropriate to your agent.

Merge the following provider block into the existing configuration. Replace `MODEL_ID`; preserve your existing providers, channels and workspace settings:

```json
{
  "models": {
    "mode": "merge",
    "providers": {
      "mandapi": {
        "baseUrl": "https://api.mandapi.com/v1",
        "apiKey": "${MANDAPI_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "MODEL_ID",
            "name": "MandAPI"
          }
        ]
      }
    }
  }
}
```

`openai-completions` is OpenClaw's adapter name for Chat Completions. It uses the `/v1` base above. A Responses connection requires a different adapter and a model that supports that format; changing the model name alone does not switch protocols.

## Supply the credential to the running process

Set `MANDAPI_API_KEY` privately before starting the local process. For Bash:

```bash
read -rsp "MandAPI key: " MANDAPI_API_KEY
printf '\n'
export MANDAPI_API_KEY
```

Or PowerShell:

```powershell
$env:MANDAPI_API_KEY = [Net.NetworkCredential]::new('', (Read-Host 'MandAPI key' -AsSecureString)).Password
```

If you run OpenClaw as a background service, supply the variable through that service's environment; a variable in a separate terminal will not automatically reach it. The `${MANDAPI_API_KEY}` text in the JSON is a reference, not the actual key.

## Validate and select

```bash
openclaw config validate
openclaw models list
openclaw models set mandapi/MODEL_ID
```

Start a local chat through your existing OpenClaw interface. Ask one short question without tool actions, then request a small read-only project summary. Check both the selected model and matching MandAPI usage. A local check does not require connecting WhatsApp, Telegram or another messaging channel.

## Troubleshoot the active configuration

If a provider setting appears ignored, inspect whether the active agent's `models.json` overrides the same provider. If authentication fails only in the service, check its inherited environment. If tools fail after text works, inspect model compatibility and existing tool policy. Avoid adding invented context limits or zero-cost metadata to make the entry pass.

To restore the previous connection, reselect the old model and restore only the provider settings changed here.

## References

- [https://docs.openclaw.ai/gateway/config-tools/custom-providers](https://docs.openclaw.ai/gateway/config-tools/custom-providers)
- [https://docs.openclaw.ai/cli/config](https://docs.openclaw.ai/cli/config)
- [https://docs.openclaw.ai/concepts/model-providers](https://docs.openclaw.ai/concepts/model-providers)
- [https://openrouter.ai/docs/cookbook/coding-agents/openclaw-integration](https://openrouter.ai/docs/cookbook/coding-agents/openclaw-integration)
