> ## Documentation Index
> Fetch the complete documentation index at: https://docs.4096bytes.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenClaw

> Configure 4096bytes as a custom model Provider in OpenClaw

OpenClaw can connect to 4096bytes through a custom model Provider. Write the OpenAI compatible Provider config, set the agent default model, restart the gateway, and activate the new model.

## Prerequisites

* You have completed [Create an account](/en/quickstart/create-account).
* You have completed [Get an API Key](/en/quickstart/get-api-key).
* OpenClaw is installed and `openclaw --version` works.
* You have the 4096bytes API Key, Base URL, and model name.

<Warning>
  The commands below write the API Key into local OpenClaw config. Do not commit commands, config files, screenshots, or terminal output that contain the real API Key.
</Warning>

## Configure a custom Provider

Run this command to add 4096bytes as a custom model Provider.

```bash theme={null}
openclaw config set models.providers.4096bytes '{
  "api": "openai-completions",
  "baseUrl": "https://api.4096bytes.com/v1",
  "apiKey": "YOUR_4096BYTES_API_KEY",
  "auth": "api-key",
  "headers": {
    "User-Agent": "Mozilla/5.0"
  },
  "models": [
    {
      "id": "gpt-5.5",
      "name": "GPT-5.5",
      "contextWindow": 200000,
      "reasoning": true,
      "input": [
        "text"
      ]
    }
  ]
}' --strict-json --merge
```

Replace `YOUR_4096BYTES_API_KEY` with the API Key you created in the dashboard. Use the current dashboard values for `id`, `name`, `contextWindow`, and `reasoning`.

<Tip>
  The command uses `--strict-json`. JSON cannot include trailing commas, or OpenClaw will reject the config.
</Tip>

## Set the agent default model

Set the 4096bytes model as the agent default model and give it a short alias.

```bash theme={null}
openclaw config set agents.defaults.models '{"4096bytes/gpt-5.5": {"alias": "G55"}}' --strict-json --merge
```

If your model name is not `gpt-5.5`, replace `4096bytes/gpt-5.5` in the command.

## Restart the gateway

After writing the config, restart the OpenClaw gateway.

```bash theme={null}
openclaw gateway restart
```

## Activate the new model

Set the current session to use the 4096bytes model.

```bash theme={null}
openclaw models set 4096bytes/gpt-5.5
```

If you use another model name, replace `gpt-5.5` with the model ID shown in the dashboard.

## Test the model call

Send a short message to verify the connection.

```bash theme={null}
openclaw chat --message "hi"
```

If OpenClaw responds without authentication or model-not-found errors, the config is active.

## Common issues

<AccordionGroup>
  <Accordion title="OpenClaw says the JSON is invalid">
    Check for trailing commas, unescaped quotes, or missing braces. With `--strict-json`, the value must be valid JSON.
  </Accordion>

  <Accordion title="Authentication failed">
    Check that `apiKey` is complete and copied without extra spaces or newlines. Confirm the API Key was not deleted, expired, or over quota.
  </Accordion>

  <Accordion title="Model not found">
    Confirm that the `id` in `models` matches the model ID used by `openclaw models set`. Copy the model name from the dashboard instead of old screenshots or another user's config.
  </Accordion>

  <Accordion title="Config does not take effect">
    Run `openclaw gateway restart` first. If it still fails, check that both `models.providers.4096bytes` and `agents.defaults.models` were written successfully.
  </Accordion>
</AccordionGroup>
