# Z.ai

> Use GLM to generate text, images, and video, transcribe audio, and extract or search web content.

App · 14 actions. Web page: https://docs.lodol.com/docs/integrations/z-ai

## Actions

### Count tokens

Count tokens in Z.ai.

**Inputs**

- Prompt (`prompt`, text, required): Enter the text to send to the model.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "created": 1,
    "id": "example",
    "request_id": "example",
    "usage": {
      "image_tokens": 1.0,
      "prompt_tokens": 1.0,
      "total_tokens": 1.0,
      "video_tokens": 1.0
    }
  }
}
```

### Generate image

Generate image in Z.ai.

**Inputs**

- Prompt (`prompt`, text, required): Prompt.
- Quality (`quality`, text): Quality. One of: `hd`, `standard`. Default: `hd`.
- Image size (`size`, text): Size. Default: `1280x1280`.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "content_filter": [],
    "created": 1,
    "data": []
  }
}
```

### Generate text

Generate text in Z.ai.

**Inputs**

- Model (`model`, text, required): Model. One of: `glm-5.3`, `glm-5.2`, `glm-5.1`, `glm-5`, `glm-4.7`, `glm-4.6`.
- Reasoning effort (`reasoning_effort`, text): Reasoning effort. One of: `max`, `xhigh`, `high`, `medium`, `low`, `minimal`, `none`. Default: `max`.
- Temperature (`temperature`, number): Temperature. From 0.0 to 1.0. Default: `1.0`.
- Top p (`top_p`, number): Top p. From 0.01 to 1.0. Default: `0.95`.
- Max tokens (`max_tokens`, number): Max tokens. From 1 to 131072.
- Prompt (`prompt`, text, required): Enter the text to send to the model.
- System instruction (`system_instruction`, text): Give the model instructions for its reply.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "choices": [],
    "created": 1,
    "id": "example",
    "model": "example",
    "request_id": "example",
    "usage": {
      "completion_tokens": 1.0,
      "prompt_tokens": 1.0,
      "prompt_tokens_details": {
        "cached_tokens": 1.0
      },
      "total_tokens": 1
    },
    "web_search": []
  }
}
```

### Generate video

Generate video in Z.ai.

**Inputs**

- Prompt (`prompt`, text): Prompt.
- Quality (`quality`, text): Quality. One of: `speed`, `quality`.
- With audio (`with_audio`, true/false): With audio.
- Image URL (`image_url`, list): Image URL.
- Size (`size`, text): Size. One of: `1280x720`, `720x1280`, `1024x1024`, `1920x1080`, `1080x1920`, `2048x1080`, `3840x2160`.
- Fps (`fps`, number): Fps. One of: `30`, `60`.
- Duration (`duration`, number): Duration. One of: `5`, `10`.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "id": "example",
    "model": "example",
    "request_id": "example",
    "task_status": "example"
  }
}
```

### Get agent conversation

Get agent conversation in Z.ai.

**Inputs**

- Agent ID (`agent_id`, text, required): Enter the agent ID used when starting the job or conversation.
- Conversation ID (`conversation_id`, text, required): Conversation ID.
- Custom variables (`custom_variables`, object): Custom variables.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "agent_id": "example",
    "choices": [],
    "conversation_id": "example",
    "error": {
      "code": "example",
      "message": "example"
    }
  }
}
```

### Get agent result

Get agent result in Z.ai.

**Inputs**

- Agent ID (`agent_id`, text, required): Enter the agent ID used when starting the job or conversation.
- Async ID (`async_id`, text, required): Async ID.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "agent_id": "example",
    "async_id": "example",
    "choices": [],
    "status": "example"
  }
}
```

### Get generation

Get generation in Z.ai.

**Inputs**

- Generation ID (`generation_id`, text, required): Generation ID.

**Outputs**

- `data` (object): Video Generation

**Example output**

```json
{
  "data": {
    "image_result": [],
    "model": "example",
    "request_id": "example",
    "task_status": "example",
    "video_result": []
  }
}
```

### Parse document

Parse document in Z.ai.

**Inputs**

- File (`file`, text, required): File.
- Return crop images (`return_crop_images`, true/false): Return crop images. Default: `false`.
- Need layout visualization (`need_layout_visualization`, true/false): Need layout visualization. Default: `false`.
- Start page ID (`start_page_id`, number): Start page ID. At least 1.
- End page ID (`end_page_id`, number): End page ID. At least 1.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "created": 1,
    "data_info": {
      "num_pages": 1,
      "pages": []
    },
    "id": "example",
    "layout_details": [],
    "layout_visualization": [],
    "md_results": "example",
    "model": "example",
    "request_id": "example",
    "usage": {
      "completion_tokens": 1.0,
      "prompt_tokens": 1.0,
      "prompt_tokens_details": {
        "cached_tokens": 1.0
      },
      "total_tokens": 1
    }
  }
}
```

### Read web page

Read web page in Z.ai.

**Inputs**

- URL (`url`, text, required): URL.
- No cache (`no_cache`, true/false): No cache. Default: `false`.
- Return format (`return_format`, text): Return format. Default: `markdown`.
- Retain images (`retain_images`, true/false): Retain images. Default: `true`.
- No gfm (`no_gfm`, true/false): No gfm. Default: `false`.
- Keep img data URL (`keep_img_data_url`, true/false): Keep img data URL. Default: `false`.
- With images summary (`with_images_summary`, true/false): With images summary. Default: `false`.
- With links summary (`with_links_summary`, true/false): With links summary. Default: `false`.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "created": 1,
    "id": "example",
    "model": "example",
    "reader_result": {
      "content": "example",
      "description": "example",
      "external": {
        "stylesheet": {}
      },
      "metadata": {
        "description": "example",
        "format-detection": "example",
        "keywords": "example",
        "viewport": "example"
      },
      "title": "example",
      "url": "example"
    },
    "request_id": "example"
  }
}
```

### Search web

Search web in Z.ai.

**Inputs**

- Search query (`search_query`, text, required): Search query.
- Count (`count`, number): Count. From 1 to 50.
- Search domain filter (`search_domain_filter`, text): Search domain filter.
- Search recency filter (`search_recency_filter`, text): Search recency filter. One of: `oneDay`, `oneWeek`, `oneMonth`, `oneYear`, `noLimit`.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "created": 1,
    "id": "example",
    "search_result": []
  }
}
```

### Start image generation

Start image generation in Z.ai.

**Inputs**

- Prompt (`prompt`, text, required): Prompt.
- Quality (`quality`, text): Quality. One of: `hd`. Default: `hd`.
- Image size (`size`, text): Size. Default: `1280x1280`.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "id": "example",
    "model": "example",
    "request_id": "example",
    "task_status": "example"
  }
}
```

### Transcribe audio

Transcribe audio in Z.ai.

**Inputs**

- File (`file`, text, required): Choose a workflow file or enter its public download URL.
- Prompt (`prompt`, text): Prompt.
- Hotwords (`hotwords`, list): Hotwords.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "created": 1,
    "id": "example",
    "model": "example",
    "request_id": "example",
    "text": "example"
  }
}
```

### Translate text

Translate text in Z.ai.

**Inputs**

- Text to translate (`prompt`, text, required): Text to translate.
- Target language (`target_language`, text, required): Choose the language for the translation. One of: `zh-CN`, `zh-TW`, `wyw`, `yue`, `en`, `en-GB`, `en-US`, `ja`, `ko`, `fr`, and 32 more.

**Outputs**

- `data` (object): General Translation

**Example output**

```json
{
  "data": {
    "agent_id": "example",
    "choices": [],
    "id": "example",
    "status": "example",
    "usage": {
      "completion_tokens": 1,
      "prompt_tokens": 1,
      "total_calls": 1,
      "total_tokens": 1
    }
  }
}
```

### Upload agent file

Upload agent file in Z.ai.

**Inputs**

- File (`file`, text, required): Choose a workflow file or enter its public download URL.
- Purpose (`purpose`, text, required): Purpose. One of: `user_data` (User data), `agent`.

**Outputs**

- `data` (object): Response value.

**Example output**

```json
{
  "data": {
    "bytes": 1,
    "created_at": 1,
    "filename": "example",
    "id": "example",
    "object": "example",
    "purpose": "example"
  }
}
```
