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

# Z.AI

> Connect WednesdayAI to Z.AI — the API platform for GLM models.

# Z.AI

Z.AI is the API platform for **GLM** models developed by ZhipuAI. It provides a REST API for GLM model access using API key authentication. WednesdayAI uses the `zai` provider to connect to Z.AI.

## Prerequisites

* An API key from the [Z.AI console](https://z.ai)

## Quick setup

### 1. Get an API key

Sign in to the Z.AI console and create an API key. Keys typically start with `sk-`.

Store it on the gateway host:

```bash theme={"dark"}
echo 'ZAI_API_KEY=sk-...' >> ~/.openclaw/.env
```

### 2. Run onboarding

```bash theme={"dark"}
openclaw onboard --auth-choice zai-api-key
```

Or non-interactive:

```bash theme={"dark"}
openclaw onboard --zai-api-key "$ZAI_API_KEY"
```

### 3. Configure

```json5 theme={"dark"}
{
  models: {
    providers: {
      zai: {
        apiKey: "ZAI_API_KEY", // references the env var
      },
    },
  },
  agents: {
    defaults: {
      model: { primary: "zai/glm-5" },
    },
  },
}
```

<Note>
  `apiKey` is the name of the environment variable, not the key value itself. Keep secrets in `.env`, not in committed config files.
</Note>

## Provider settings

| Setting        | Value              |
| -------------- | ------------------ |
| Provider ID    | `zai`              |
| Auth env var   | `ZAI_API_KEY`      |
| Auth method    | Bearer token       |
| Tool streaming | Enabled by default |

## Available models

GLM models are referenced as `zai/<model-id>`:

| Model ID          | Notes                      |
| ----------------- | -------------------------- |
| `zai/glm-5`       | Current flagship           |
| `zai/glm-4.7`     | GLM 4.7                    |
| `zai/glm-4.6`     | GLM 4.6                    |
| `zai/glm-4-flash` | Faster, lower-cost variant |

<Note>
  Check the Z.AI platform for the current model catalog — GLM versions are updated regularly.
</Note>

To disable tool-call streaming for a specific model:

```json5 theme={"dark"}
{
  agents: {
    defaults: {
      models: {
        "zai/glm-5": {
          params: { tool_stream: false },
        },
      },
    },
  },
}
```

## Verification

```bash theme={"dark"}
openclaw models status --probe-provider zai
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    Verify `ZAI_API_KEY` is set correctly in `~/.openclaw/.env` and the key is active in the Z.AI console.
  </Accordion>

  <Accordion title="Model not found">
    GLM model IDs are versioned. Check the Z.AI console for the current list and update your config accordingly.
  </Accordion>
</AccordionGroup>

## Related

* [GLM models overview](/admin/providers/glm)
* [AI providers overview](/admin/providers/index)
* [Reference: config](/reference/config)
