POST
/
v1
/
agents
cURL
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",
  "stream": true,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "<string>"
        }
      ]
    }
  ],
  "custom_variables": {
    "source_lang": "auto",
    "target_lang": "zh-CN",
    "glossary": "<string>",
    "strategy": "general",
    "strategy_config": {
      "general": {
        "suggestion": "<string>"
      },
      "cot": {
        "reason_lang": "from"
      }
    }
  }
}'
{
"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

Authorization
string
header
required

Use the following format for authentication: Bearer <your api key>

Headers

Accept-Language
enum<string>
default:en-US,en

Config desired response language for HTTP requests.

Available options:
en-US,en
Example:

"en-US,en"

Body

application/json

Response

Processing successful

The response is of type object.