OpenClaw Configuration

Add your own LLM gateway and API key to OpenClaw with the CLI or by editing the config file directly.

Option 1: CLI (Recommended)

Use openclaw config set to configure a provider quickly.

Example
# Set gateway and models
# For models, you can visit https://www.bitnow.ai/models to get the list of supportedmodels
openclaw config set models.providers.bitnow '{
  "baseUrl": "https://gateway.bitnow.ai/v1",
  "api": "openai-completions",
  "apiKey": "<<Your API Key>>",
  "models": [
    {
      "id": "<<MODEL_NAME>>",
      "name": "<<MODEL_NAME>>",
      "input": ["text"]
    }]
}'

# Set auth profile
openclaw config set auth.profiles.bitnow:default '{"provider": "bitnow", "mode": "api_key"}'

# Set default model
openclaw config set agents.defaults.model '{"primary": "bitnow/<<MODEL_NAME>>"}'

Option 2: Manual Config

Edit ~/.openclaw/openclaw.json and add a provider under models.providers.

"auth": {
    "profiles": {
      "bitnow:default": {
        "provider": "bitnow",
        "mode": "api_key"
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "bitnow": {
        "baseUrl": "https://gateway.bitnow.ai/v1",
        "api": "openai-completions",
        "apiKey": "<<Your API Key>>",
        "models": [
          {
            "id": "<<MODEL_NAME>>",
            "name": "<<MODEL_NAME>>",
            "input": [
              "text"
            ],
            "contextWindow": 128000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bitnow/<<MODEL_NAME>>"
      },
      "models": {
        "bitnow/<<MODEL_NAME>>": {}
      },
      ...other agents configurations
    }

After configuring the provider and models, you need to restart the OpenClaw gateway to apply the change, and then start a new session.

openclaw gateway restart