Notice: Kling 4.0 is here: text-to-video and image-to-video are 20% off for a limited time. Try it now
HiAPI
Tutorials
On this page

OpenClaw

Add a HiAPI custom endpoint with OpenClaw's built-in wizard to use Claude and other models in OpenClaw through HiAPI.

OpenClaw is an open-source agent. You can add HiAPI as a model provider with its built-in setup wizard or with commands, then chat in the Dashboard (the console in your browser) or the TUI (the chat interface in your terminal). The steps below use claude-opus-5-5 as the example; HiAPI uses the OpenAI Chat Completions protocol. This tutorial was verified on OpenClaw 2026.10.7.

1. Install OpenClaw

The official install script is recommended; it checks for and prepares the Node.js environment it needs. On Mac / Linux / WSL2, run:

Terminal
curl -fsSL https://openclaw.ai/install.sh | bash

On Windows, use PowerShell:

PowerShell
iwr -useb https://openclaw.ai/install.ps1 | iex

After installing, reopen the terminal and run openclaw --version; seeing the version number is enough.

2. Initialize and open OpenClaw

First prepare a HiAPI API key. To use another model, find its name in the text model list and enter it.

On first use, run this in a terminal:

Terminal
openclaw onboard --install-daemon

Complete the basic setup as prompted. The current version opens the model settings page in your browser; if the classic terminal wizard appears, choose QuickStart, keep main as the default agent, choose Skip for now for the model, channels, search and optional Skills, then connect HiAPI as described below. If you have already initialized, open the Dashboard directly:

Terminal
openclaw dashboard

OpenClaw runs on a background Gateway service. If the Gateway is not running yet, run openclaw gateway run in one terminal and keep the window open, then run openclaw dashboard in another terminal. If you installed the background service, you can also restart it with openclaw gateway restart.

The screenshots below come from a standalone demo instance of OpenClaw 2026.10.7 on October 28, 2026; the port may differ from your machine, so use the address that openclaw dashboard opens.

3. Add HiAPI in OpenClaw

The first time you enter the Model settings page, find Custom OpenAI/Anthropic-compatible endpoint and click Set up endpoint. If you have already initialized, go to Settings → Models → Connect provider → On this Gateway to reach the same entry.

Choose a custom endpoint

3.1 Enter the API address

Set API Base URL to https://api.hiapi.ai/v1, without adding /chat/completions, and click Submit.

Enter the Base URL

3.2 Enter the API key

At the How do you want to provide this API key? step, choose Paste API key now, paste your HiAPI API key, and click Submit.

Choose to paste the API key

Enter the API key

3.3 Choose the protocol

For Endpoint compatibility, choose OpenAI-compatible — Uses /chat/completions (that is, the OpenAI Chat Completions protocol). Use this protocol even when the model is Claude.

Choose the OpenAI-compatible protocol

3.4 Enter the model and provider name

Set Model ID to claude-opus-5-5 and click Submit.

Enter the model ID

Set Endpoint ID to hiapi and click Submit. The full model reference in OpenClaw is then hiapi/claude-opus-5-5.

Set the provider ID

Model alias (optional) is an optional alias; you can leave it empty and submit. When verification finishes, the first-time setup shows “Inference is ready” and “Verified model: hiapi/claude-opus-5-5”.

Model verified

4. Set the default model and verify a chat

Set the default model for new sessions, then check the configuration:

Terminal
openclaw config set agents.defaults.model.primary hiapi/claude-opus-5-5
openclaw config validate
openclaw config get agents.defaults.model.primary

The result should include Config valid, and the last command should print hiapi/claude-opus-5-5, which means the configuration was written. You still need to verify with an actual message:

  1. If you are still on the first-time setup page, click Continue with the web app, then Back to app.
  2. Start a new chat, click the model name below the input box, and choose the model you just configured under the Hiapi group. Existing sessions may still use the model chosen earlier.
  3. Send “Hello, introduce yourself in one sentence.” and wait for a reply.

Model selected in a session

Actual model reply

A normal reply means the connection works. Replies may differ each time; go by the currently selected provider, whether the request succeeds, and the Request logs in the HiAPI console.

To chat in the terminal, run this while the Gateway is running:

Terminal
openclaw tui

5. Write the configuration with commands (optional)

You can also do everything with commands: initialize → write the configuration → verify. Skip this section if you already configured it in the web UI above. First replace YOUR_HIAPI_API_KEY in the commands with your HiAPI API key, then run the command for your system.

Terminal
openclaw config patch --stdin <<'JSON'
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "hiapi/claude-opus-5-5"
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "hiapi": {
        "baseUrl": "https://api.hiapi.ai/v1",
        "apiKey": "YOUR_HIAPI_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "claude-opus-5-5",
            "name": "Claude Opus 5.5"
          }
        ]
      }
    }
  }
}
JSON
PowerShell
@'
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "hiapi/claude-opus-5-5"
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "hiapi": {
        "baseUrl": "https://api.hiapi.ai/v1",
        "apiKey": "YOUR_HIAPI_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "claude-opus-5-5",
            "name": "Claude Opus 5.5"
          }
        ]
      }
    }
  }
}
'@ | openclaw config patch --stdin

This patch adds the hiapi provider and sets the default model; other providers’ configuration is kept. If a hiapi provider already exists, the patch updates its configuration and replaces the models array, so write all existing models into the array first if it had several.

On Windows CMD, save the JSON above as hiapi.patch.json, then run:

Terminal
openclaw config patch --file hiapi.patch.json

After writing, check the configuration as in step 4 and verify with a new chat. If it says the Gateway needs a restart: run openclaw gateway restart if you installed the background service; if it runs in the foreground, press Ctrl+C in that window and run openclaw gateway run again.

6. Troubleshooting

Only issues specific to OpenClaw are listed here. For common errors such as 401, 404 and 429, see Common errors.

ErrorCauseFix
404 / model not availableThe Base URL has /v1 appended twice, or the model name is wrongSet the Base URL to https://api.hiapi.ai/v1 and check the model name in the model list
Protocol mismatchThe protocol was chosen by model vendorFor the Claude example in this tutorial choose OpenAI-compatible, and write openai-completions in the JSON
Dashboard / TUI can’t connectThe Gateway is not running, or the browser is not authorizedConfirm the Gateway is running and open the local console with openclaw dashboard; if it says unauthorized, run that command again
Still using the old modelA session or agent-specific setting overrides the global defaultCheck agents.defaults.model.primary, start a new session, or select the Hiapi model manually in the session
The openclaw command is not foundIt was not installed properly, or the command directory is not on PATHReopen the terminal and run openclaw --version; confirm the install succeeded and the command directory is on PATH
config patch does not existThe OpenClaw version is too oldConfigure with the web wizard first, or update following the official docs and then run the patch command