# Z.AI Integration via LowCodeAPI
**Last Updated**: February 10, 2026
## Overview
Z.AI platform providing AI models, image generation, video generation, audio transcription, and agent capabilities through RESTful APIs.
**Categories:**
- {'id': 'multimodal-ai', 'name': 'Multimodal AI'}
## Base Endpoint
https://api.lowcodeapi.com/zai
**Important**: Always include the provider name in the URL path after `api.lowcodeapi.com/`
## Authentication
**Type:** TOKEN
**Official Documentation:** https://docs.z.ai/api-reference/introduction
## URL Format (Important)
LowCodeAPI supports two URL formats. **Always try the New Format first**, then fall back to Old Format if needed.
### New Format (Priority)
- Path parameters stay in the URL path
- Do NOT include path parameters as query parameters
- Example: `https://api.lowcodeapi.com/{provider}/resource/{id}?api_token=XXX`
### Old Format (Fallback)
- Path parameters become query parameters
- Example: `https://api.lowcodeapi.com/{provider}/resource/id?id={id}&api_token=XXX`
### Decision Flow for AI Agents
1. Always use **New Format** first - keep path parameters in the URL path
2. If you get a 404 or error, try **Old Format** with sanitized path
3. Log which format worked for future requests to this provider
## API Categories
## Common Endpoints
### Code Completion
**Method:** POST
**LowCodeAPI Path:** /api/coding/paas/v4/chat/completions
**New Format URL:**
https://api.lowcodeapi.com/zai/api/coding/paas/v4/chat/completions?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/api/coding/paas/v4/chat/completions?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| do_sample | boolean | |
| max_tokens | number | |
| messages | array | |
| model | string | |
| request_id | string | |
| response_format | object | |
| stop | array | |
| stream | boolean | |
| temperature | number | |
| thinking | object | |
| tool_choice | string | |
| tool_stream | boolean | |
| tools | array | |
| top_p | number | |
| user_id | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/api/coding/paas/v4/chat/completions?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/llm/chat-completion
### Create Chat Completion
**Method:** POST
**LowCodeAPI Path:** /api/paas/v4/chat/completions
**New Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/chat/completions?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/chat/completions?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| do_sample | boolean | |
| max_tokens | number | |
| messages | array | |
| model | string | |
| request_id | string | |
| response_format | object | |
| stop | array | |
| stream | boolean | |
| temperature | number | |
| thinking | object | |
| tool_choice | string | |
| tool_stream | boolean | |
| tools | array | |
| top_p | number | |
| user_id | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/api/paas/v4/chat/completions?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/llm/chat-completion
### Generate Image
**Method:** POST
**LowCodeAPI Path:** /api/paas/v4/generate/image
**New Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/generate/image?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/generate/image?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| model | string | |
| n | number | |
| prompt | string | |
| size | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/api/paas/v4/generate/image?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/image/generate-image
### Generate Video
**Method:** POST
**LowCodeAPI Path:** /api/paas/v4/videos/generations
**New Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/videos/generations?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/videos/generations?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| model | string | |
| prompt | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/api/paas/v4/videos/generations?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/video/generate-video
### Retrieve Video Result Using ID
**Method:** GET
**LowCodeAPI Path:** /api/paas/v4/async-result/{id}
**New Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/async-result/{id}?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/async-result/id?id={id}&api_token=YOUR_API_TOKEN
**Path Parameters:**
| Parameter | Type | Description |
|-----------|------|-------------|
| id | string | |
**Example Request (New Format):**
```bash
curl -X GET 'https://api.lowcodeapi.com/zai/api/paas/v4/async-result/{id}?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/video/get-video-status
### Audio Transcriptions
**Method:** POST
**LowCodeAPI Path:** /api/paas/v4/audio/transcriptions
**New Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/audio/transcriptions?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/api/paas/v4/audio/transcriptions?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| file | file | |
| language | string | |
| model | string | |
| prompt | string | |
| response_format | string | |
| temperature | number | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/api/paas/v4/audio/transcriptions?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/audio/audio-transcriptions
### Tokenizer
**Method:** POST
**LowCodeAPI Path:** /paas/v4/tokenizer
**New Format URL:**
https://api.lowcodeapi.com/zai/paas/v4/tokenizer?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/paas/v4/tokenizer?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| input | string | |
| model | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/paas/v4/tokenizer?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/tools/tokenizer
### Web Search
**Method:** POST
**LowCodeAPI Path:** /paas/v4/web_search
**New Format URL:**
https://api.lowcodeapi.com/zai/paas/v4/web_search?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/paas/v4/web_search?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| max_results | number | |
| query | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/paas/v4/web_search?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/tools/web-search
### Web Reader
**Method:** POST
**LowCodeAPI Path:** /paas/v4/reader
**New Format URL:**
https://api.lowcodeapi.com/zai/paas/v4/reader?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/paas/v4/reader?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| url | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/paas/v4/reader?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/tools/web-reader
### Agent Chat
**Method:** POST
**LowCodeAPI Path:** /api/v1/agents
**New Format URL:**
https://api.lowcodeapi.com/zai/api/v1/agents?api_token=YOUR_API_TOKEN
**Old Format URL:**
https://api.lowcodeapi.com/zai/v1/agents?api_token=YOUR_API_TOKEN
**Request Body:**
| Field | Type | Description |
|-------|------|-------------|
| agent_id | string | |
| messages | array | |
| model | string | |
**Example Request (New Format):**
```bash
curl -X POST 'https://api.lowcodeapi.com/zai/api/v1/agents?api_token=YOUR_API_TOKEN'
```
**Official Documentation:** https://docs.z.ai/api-reference/agents/agent
## Usage Examples
### Example 1: Basic Chat Completion
Creating a simple text completion or chat message:
```bash
# Create a chat completion - no path parameters needed
curl -X POST "https://api.lowcodeapi.com/zai/v1/chat/completions?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-name",
"messages": [
{"role": "user", "content": "Hello, how can you help me?"}
]
}'
# Response includes generated content
```
### Example 2: Text Generation with Path Parameters
Generating text with specific model settings:
```bash
# Generate content using a specific model
curl -X POST "https://api.lowcodeapi.com/zai/v1/models/generate?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Write a short poem about technology",
"max_tokens": 100
}'
# Or if the provider uses model in the path:
curl -X POST "https://api.lowcodeapi.com/zai/v1/models/{MODEL_ID}:generateContent?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"parts": [{"text": "Write a short story"}]}]
}'
```
### Example 3: List Available Models
```bash
# Get list of available models
curl -X GET "https://api.lowcodeapi.com/zai/v1/models?api_token=YOUR_API_TOKEN"
```
## Error Handling
LowCodeAPI returns standard HTTP status codes. Common errors:
| Status Code | Description |
|-------------|-------------|
| 200 | Success - Request completed successfully |
| 400 | Bad Request - Invalid parameters or request body |
| 401 | Unauthorized - Invalid or missing API token |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Endpoint or resource doesn't exist |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Server Error - Provider API error |
All error responses include error details:
```json
{
"data": {
"error": {
"message": "Error description",
"code": "ERROR_CODE"
}
}
}
```
## Complete Endpoint Reference
| Endpoint | Method | Category |
|----------|--------|----------|
| Code Completion | POST | Code Completion |
| Create Chat Completion | POST | Chat |
| Generate Image | POST | Image |
| Generate Video | POST | Video |
| Retrieve Video Result Using ID | GET | Video |
| Audio Transcriptions | POST | Audio |
| Tokenizer | POST | Tool |
| Web Search | POST | Tool |
| Web Reader | POST | Tool |
| Agent Chat | POST | Agent |
| Retrieve Agent Result | POST | Agent |
| Conversation History | POST | Agent |
| File Upload | POST | Agent |
## API Definition Endpoints
You can fetch the complete API specification for this provider:
**New Format (OpenAPI spec):**
```bash
curl 'https://backend.lowcodeapi.com/zai/openapi'
```
**Old Format (API definition):**
```bash
curl 'https://backend.lowcodeapi.com/zai/definition'
```
## Response Format
All responses are wrapped in a `data` key:
```json
{
"data": {
// Actual response from provider (object or array)
}
}
```