curl --request POST \
--url https://api.z.ai/api/v1/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "general_translation",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"stream": true,
"custom_variables": {
"glossary": "<string>",
"strategy_config": {
"general": {
"suggestion": "<string>"
},
"cot": {}
}
}
}
'import requests
url = "https://api.z.ai/api/v1/agents"
payload = {
"agent_id": "general_translation",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"stream": True,
"custom_variables": {
"glossary": "<string>",
"strategy_config": {
"general": { "suggestion": "<string>" },
"cot": {}
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: 'general_translation',
messages: [{role: 'user', content: [{type: 'text', text: '<string>'}]}],
stream: true,
custom_variables: {
glossary: '<string>',
strategy_config: {general: {suggestion: '<string>'}, cot: {}}
}
})
};
fetch('https://api.z.ai/api/v1/agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.z.ai/api/v1/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"general_translation\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"stream\": true,\n \"custom_variables\": {\n \"glossary\": \"<string>\",\n \"strategy_config\": {\n \"general\": {\n \"suggestion\": \"<string>\"\n },\n \"cot\": {}\n }\n }\n}")
.asString();{
"id": "<string>",
"agent_id": "<string>",
"choices": [
{
"index": 123,
"finish_reason": "<string>",
"messages": [
{
"role": "<string>",
"content": {
"text": "<string>",
"type": "<string>"
}
}
]
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"total_calls": 123
}
}Agent Chat
General Translation: General Translation API provides large model-based multilingual translation services, including general translation, paraphrase translation, two-step translation, and three-pass translation strategies. It supports automatic language detection, glossary customization, translation suggestions, and streaming output. Users only need to call the Translation API, input the text to be processed, specify the source language (auto-detection supported) and target language to receive high-quality translation results.
Popular Special Effects Videos: Popular special effects videos are intelligent templates launched based on trending features from pan-entertainment platforms, designed to precisely adapt to short video creative production needs. Currently, three effect templates are available: French Kiss, Body Shake Dance, and Sexy Me. After selecting a template, users only need to upload an image and enter corresponding prompts to generate a special effects video.
GLM Slide/Poster Agent: An intelligent creation agent built for working people and creators. It goes beyond traditional engineering-style assembly tools—supporting one-click generation of slides or posters from natural language instructions. By natively integrating content generation with layout aesthetics and design conventions, it helps you quickly produce polished, professional-grade materials while lowering design barriers and boosting creative efficiency.
curl --request POST \
--url https://api.z.ai/api/v1/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "general_translation",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"stream": true,
"custom_variables": {
"glossary": "<string>",
"strategy_config": {
"general": {
"suggestion": "<string>"
},
"cot": {}
}
}
}
'import requests
url = "https://api.z.ai/api/v1/agents"
payload = {
"agent_id": "general_translation",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"stream": True,
"custom_variables": {
"glossary": "<string>",
"strategy_config": {
"general": { "suggestion": "<string>" },
"cot": {}
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: 'general_translation',
messages: [{role: 'user', content: [{type: 'text', text: '<string>'}]}],
stream: true,
custom_variables: {
glossary: '<string>',
strategy_config: {general: {suggestion: '<string>'}, cot: {}}
}
})
};
fetch('https://api.z.ai/api/v1/agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.z.ai/api/v1/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"general_translation\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"stream\": true,\n \"custom_variables\": {\n \"glossary\": \"<string>\",\n \"strategy_config\": {\n \"general\": {\n \"suggestion\": \"<string>\"\n },\n \"cot\": {}\n }\n }\n}")
.asString();{
"id": "<string>",
"agent_id": "<string>",
"choices": [
{
"index": 123,
"finish_reason": "<string>",
"messages": [
{
"role": "<string>",
"content": {
"text": "<string>",
"type": "<string>"
}
}
]
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"total_calls": 123
}
}Authorizations
Headers
Config desired response language for HTTP requests.
en-US,en "en-US,en"
Body
- General Translation
- Popular Special Effects Videos
- GLM Slide/Poster
Agent ID: general_translation.
general_translation Session message body.
Hide child attributes
Hide child attributes
User input role: user
user "user"
False for sync calls (default). True for streaming.
Hide child attributes
Hide child attributes
Supported language codes (default: auto):
auto: Auto Detectzh-CN: Simplified Chinesezh-TW: Traditional Chinesewyw: Classical Chineseyue: Cantoneseen: Englishja: Japaneseko: Koreanfr: Frenchde: Germanes: Spanishru: Russianpt: Portugueseit: Italianar: Arabichi: Hindibg: Bulgariancs: Czechda: Danishel: Greeket: Estonianfi: Finnishhu: Hungarianid: Indonesianlt: Lithuanianlv: Latviannl: Dutchno: Norwegian Bokmålpl: Polishro: Romaniansk: Slovaksl: Sloveniansv: Swedishth: Thaitr: Turkishuk: Ukrainianvi: Vietnamesemy: Burmesems: MalayPinyin: PinyinIPA: International Phonetic Alphabet
auto, zh-CN, zh-TW, wyw, yue, en, ja, ko, fr, de, es, ru, pt, it, ar, hi, bg, cs, da, el, et, fi, hu, id, lt, lv, nl, no, pl, ro, sk, sl, sv, th, tr, uk, vi, my, ms, Pinyin, IPA Target language code (default: zh-CN):
zh-CN: Simplified Chinesezh-TW: Traditional Chinesewyw: Classical Chineseyue: Cantoneseen: Englishen-GB: English (British)en-US: English (American)ja: Japaneseko: Koreanfr: Frenchde: Germanes: Spanishru: Russianpt: Portugueseit: Italianar: Arabichi: Hindibg: Bulgariancs: Czechda: Danishel: Greeket: Estonianfi: Finnishhu: Hungarianid: Indonesianlt: Lithuanianlv: Latviannl: Dutchno: Norwegian Bokmålpl: Polishro: Romaniansk: Slovaksl: Sloveniansv: Swedishth: Thaitr: Turkishuk: Ukrainianvi: Vietnamesemy: Burmesems: MalayPinyin: PinyinIPA: International Phonetic Alphabet .
zh-CN, zh-TW, wyw, yue, en, en-GB, en-US, ja, ko, fr, de, es, ru, pt, it, ar, hi, bg, cs, da, el, et, fi, hu, id, lt, lv, nl, no, pl, ro, sk, sl, sv, th, tr, uk, vi, my, ms, Pinyin, IPA Glossary ID.
Translation strategy (default: general),Optional:
general: General Translationparaphrase: Paraphrase Translationtwo_step: Two-Step Translationthree_step: Three-Stage Translationreflection: Reflection Translation; cot: COT Translation
general, paraphrase, two_step, three_step, reflection Strategy parameters.
Hide child attributes
Hide child attributes
Response
Processing successful
- General Translation
- Popular Special Effects Videos
- GLM Slide/Poster
Task ID.
Agent ID.
Task status.
Model output content.
Hide child attributes
Hide child attributes
Result index.
Termination reason: stop (normal completion), tool_calls (model calls), length (token limit exceeded), sensitive (content flagged), network_error (model inference error).
Was this page helpful?