创建 Environment
curl --request POST \
--url https://agent-api.bigmodel.cn/api/agent/managed/v1/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"name": "<string>",
"description": null,
"metadata": {},
"scope": "organization",
"config": {
"type": "cloud",
"packages": {
"type": "packages",
"apt": [],
"cargo": [],
"gem": [],
"go": [],
"npm": [],
"pip": []
},
"networking": {
"type": "unrestricted"
}
}
}
'import requests
url = "https://agent-api.bigmodel.cn/api/agent/managed/v1/environments"
payload = {
"name": "<string>",
"description": None,
"metadata": {},
"scope": "organization",
"config": {
"type": "cloud",
"packages": {
"type": "packages",
"apt": [],
"cargo": [],
"gem": [],
"go": [],
"npm": [],
"pip": []
},
"networking": { "type": "unrestricted" }
}
}
headers = {
"zai-version": "<zai-version>",
"zai-beta": "<zai-beta>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'zai-version': '<zai-version>',
'zai-beta': '<zai-beta>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
description: null,
metadata: {},
scope: 'organization',
config: {
type: 'cloud',
packages: {type: 'packages', apt: [], cargo: [], gem: [], go: [], npm: [], pip: []},
networking: {type: 'unrestricted'}
}
})
};
fetch('https://agent-api.bigmodel.cn/api/agent/managed/v1/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://agent-api.bigmodel.cn/api/agent/managed/v1/environments")
.header("zai-version", "<zai-version>")
.header("zai-beta", "<zai-beta>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": null,\n \"metadata\": {},\n \"scope\": \"organization\",\n \"config\": {\n \"type\": \"cloud\",\n \"packages\": {\n \"type\": \"packages\",\n \"apt\": [],\n \"cargo\": [],\n \"gem\": [],\n \"go\": [],\n \"npm\": [],\n \"pip\": []\n },\n \"networking\": {\n \"type\": \"unrestricted\"\n }\n }\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agent-api.bigmodel.cn/api/agent/managed/v1/environments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": null,\n \"metadata\": {},\n \"scope\": \"organization\",\n \"config\": {\n \"type\": \"cloud\",\n \"packages\": {\n \"type\": \"packages\",\n \"apt\": [],\n \"cargo\": [],\n \"gem\": [],\n \"go\": [],\n \"npm\": [],\n \"pip\": []\n },\n \"networking\": {\n \"type\": \"unrestricted\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("zai-version", "<zai-version>")
req.Header.Add("zai-beta", "<zai-beta>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agent-api.bigmodel.cn/api/agent/managed/v1/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => null,
'metadata' => [
],
'scope' => 'organization',
'config' => [
'type' => 'cloud',
'packages' => [
'type' => 'packages',
'apt' => [
],
'cargo' => [
],
'gem' => [
],
'go' => [
],
'npm' => [
],
'pip' => [
]
],
'networking' => [
'type' => 'unrestricted'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"zai-beta: <zai-beta>",
"zai-version: <zai-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "env_019e8f00-1ac2-7a6b-8000-3f2d5c8b9a01",
"type": "environment",
"name": "<string>",
"description": "<string>",
"metadata": {},
"config": {
"type": "cloud",
"packages": {
"type": "packages",
"apt": [
"<string>"
],
"cargo": [
"<string>"
],
"gem": [
"<string>"
],
"go": [
"<string>"
],
"npm": [
"<string>"
],
"pip": [
"<string>"
]
},
"networking": {
"type": "unrestricted"
}
},
"scope": "organization",
"state": "active",
"archived_at": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"details": {}
},
"request_id": "req_01J..."
}Environment
创建 Environment
创建供 Managed Session 和 Deployment 使用的云端 Environment。可配置预装软件包和网络策略;省略配置时使用平台默认设置。点击 Try it 按钮可快速试用。
POST
/
agent
/
managed
/
v1
/
environments
创建 Environment
curl --request POST \
--url https://agent-api.bigmodel.cn/api/agent/managed/v1/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"name": "<string>",
"description": null,
"metadata": {},
"scope": "organization",
"config": {
"type": "cloud",
"packages": {
"type": "packages",
"apt": [],
"cargo": [],
"gem": [],
"go": [],
"npm": [],
"pip": []
},
"networking": {
"type": "unrestricted"
}
}
}
'import requests
url = "https://agent-api.bigmodel.cn/api/agent/managed/v1/environments"
payload = {
"name": "<string>",
"description": None,
"metadata": {},
"scope": "organization",
"config": {
"type": "cloud",
"packages": {
"type": "packages",
"apt": [],
"cargo": [],
"gem": [],
"go": [],
"npm": [],
"pip": []
},
"networking": { "type": "unrestricted" }
}
}
headers = {
"zai-version": "<zai-version>",
"zai-beta": "<zai-beta>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'zai-version': '<zai-version>',
'zai-beta': '<zai-beta>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
description: null,
metadata: {},
scope: 'organization',
config: {
type: 'cloud',
packages: {type: 'packages', apt: [], cargo: [], gem: [], go: [], npm: [], pip: []},
networking: {type: 'unrestricted'}
}
})
};
fetch('https://agent-api.bigmodel.cn/api/agent/managed/v1/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://agent-api.bigmodel.cn/api/agent/managed/v1/environments")
.header("zai-version", "<zai-version>")
.header("zai-beta", "<zai-beta>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": null,\n \"metadata\": {},\n \"scope\": \"organization\",\n \"config\": {\n \"type\": \"cloud\",\n \"packages\": {\n \"type\": \"packages\",\n \"apt\": [],\n \"cargo\": [],\n \"gem\": [],\n \"go\": [],\n \"npm\": [],\n \"pip\": []\n },\n \"networking\": {\n \"type\": \"unrestricted\"\n }\n }\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agent-api.bigmodel.cn/api/agent/managed/v1/environments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": null,\n \"metadata\": {},\n \"scope\": \"organization\",\n \"config\": {\n \"type\": \"cloud\",\n \"packages\": {\n \"type\": \"packages\",\n \"apt\": [],\n \"cargo\": [],\n \"gem\": [],\n \"go\": [],\n \"npm\": [],\n \"pip\": []\n },\n \"networking\": {\n \"type\": \"unrestricted\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("zai-version", "<zai-version>")
req.Header.Add("zai-beta", "<zai-beta>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agent-api.bigmodel.cn/api/agent/managed/v1/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => null,
'metadata' => [
],
'scope' => 'organization',
'config' => [
'type' => 'cloud',
'packages' => [
'type' => 'packages',
'apt' => [
],
'cargo' => [
],
'gem' => [
],
'go' => [
],
'npm' => [
],
'pip' => [
]
],
'networking' => [
'type' => 'unrestricted'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"zai-beta: <zai-beta>",
"zai-version: <zai-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "env_019e8f00-1ac2-7a6b-8000-3f2d5c8b9a01",
"type": "environment",
"name": "<string>",
"description": "<string>",
"metadata": {},
"config": {
"type": "cloud",
"packages": {
"type": "packages",
"apt": [
"<string>"
],
"cargo": [
"<string>"
],
"gem": [
"<string>"
],
"go": [
"<string>"
],
"npm": [
"<string>"
],
"pip": [
"<string>"
]
},
"networking": {
"type": "unrestricted"
}
},
"scope": "organization",
"state": "active",
"archived_at": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"details": {}
},
"request_id": "req_01J..."
}Headers
Managed Agents API 协议版本,固定为 2026-05-26。
Available options:
2026-05-26 Example:
"2026-05-26"
必须包含 managed-agents-2026-05-26;可与其他 beta 标识用逗号分隔。
Example:
"managed-agents-2026-05-26"
Body
application/json
创建 Environment。config 内出现未支持的字段时请求会被拒绝。
Environment 名称,长度 1–256 个字符。
Required string length:
1 - 256用途说明;省略或传 null 时不设置。
Maximum string length:
1024客户端自定义元数据;省略时默认为空对象。最多 16 个键,键名长度不超过 64 字符,值必须是长度不超过 512 字符的字符串。
Show child attributes
Show child attributes
公开 API 仅支持 organization;省略或传 null 时也使用 organization。
Available options:
organization 运行环境配置;省略或传 null 时使用 cloud、空 packages、unrestricted networking。
Show child attributes
Show child attributes
Response
请求成功。
Environment ID。
Example:
"env_019e8f00-1ac2-7a6b-8000-3f2d5c8b9a01"
Available options:
environment 用途说明。
客户端自定义元数据;省略时默认为空对象。最多 16 个键,键名长度不超过 64 字符,值必须是长度不超过 512 字符的字符串。
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
organization Available options:
active, archived 归档时间。
创建时间。
更新时间。
Was this page helpful?