资源
密钥编排器图
读取或替换某个密钥的可执行编排器图——入口 → 分类器/路由器 → 模型 → 护栏。
GET
/
api
/
v1
/
keys
/
{id}
/
orchestrator-graph
密钥编排器图
curl --request GET \
--url https://api.example.com/api/v1/keys/{id}/orchestrator-graph \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"nodes": [
{}
],
"edges": [
{}
]
}
'import requests
url = "https://api.example.com/api/v1/keys/{id}/orchestrator-graph"
payload = {
"enabled": True,
"nodes": [{}],
"edges": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true, nodes: [{}], edges: [{}]})
};
fetch('https://api.example.com/api/v1/keys/{id}/orchestrator-graph', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/keys/{id}/orchestrator-graph",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'nodes' => [
[
]
],
'edges' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/keys/{id}/orchestrator-graph"
payload := strings.NewReader("{\n \"enabled\": true,\n \"nodes\": [\n {}\n ],\n \"edges\": [\n {}\n ]\n}")
req, _ := http.NewRequest("GET", url, payload)
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))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/keys/{id}/orchestrator-graph")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"nodes\": [\n {}\n ],\n \"edges\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/keys/{id}/orchestrator-graph")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"nodes\": [\n {}\n ],\n \"edges\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"key_id": "<string>",
"graph": {}
}编排器图是一个按密钥运行的可执行流程:
Entry → Classifier / Router → Model → Guardrail(入口 → 分类器 / 路由器 → 模型 → 护栏)。当 enabled 为真时,发往该密钥的每一次请求都会沿着你绘制的路径运行——路由、模型选择、各节点技能以及护栏都会一并生效。它的优先级高于模型方案,并且在原生端点和兼容 OpenAI 的端点上同时生效。
这是仪表盘中编排器画布以及 MCP 配置工具背后的 REST 接口。
身份验证
需要拥有billing 权限范围的 API 密钥;调用方必须是该密钥的所有者。
路径参数
string
必填
API 密钥的 UUID。
获取图
GET /api/v1/keys/{id}/orchestrator-graph
string
API 密钥的 UUID。
object | null
已保存的图(
{ version, enabled, nodes, edges }),若未设置则为 null。替换图
PUT /api/v1/keys/{id}/orchestrator-graph
boolean
必填
为
true 时,编排器将运行该图。启用的图必须包含一个 entry 节点,以及至少一个带有引擎的 model 节点,否则请求会被拒绝。object[]
必填
最多 100 个节点。每个节点的结构为:
{ id, type, position?, config? }。type 取值为 entry、classifier、router、model、guardrail、description、output 之一。模型节点的 config.upstreamId 即其引擎;护栏节点的 config.guardrailPolicyId 即其策略(位于模型之前 = 审查输入,之后 = 审查输出)。object[]
必填
每条边的结构为:
{ id, source, target, modes?, when?, default? }。分类器分支使用 modes(该边所对应的模式);路由器分支使用 when(关键词);default 为回退边。示例
curl -X PUT https://www.hitheo.ai/api/v1/keys/KEY_ID/orchestrator-graph \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"nodes": [
{ "id": "entry", "type": "entry", "config": { "label": "User Prompt" } },
{ "id": "classifier", "type": "classifier", "config": { "label": "Classifier" } },
{ "id": "m_fast", "type": "model", "config": { "upstreamId": "arca-velox-5.1", "label": "fast" } },
{ "id": "m_think", "type": "model", "config": { "upstreamId": "arca-magnus-5.1", "label": "think" } }
],
"edges": [
{ "id": "e_in", "source": "entry", "target": "classifier" },
{ "id": "e_fast", "source": "classifier", "target": "m_fast", "modes": ["fast"] },
{ "id": "e_think", "source": "classifier", "target": "m_think", "modes": ["think"] }
]
}'
await theo.keys.setOrchestratorGraph("KEY_ID", { enabled: true, nodes, edges });
此页面对您有帮助吗?
密钥编排器图
curl --request GET \
--url https://api.example.com/api/v1/keys/{id}/orchestrator-graph \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"nodes": [
{}
],
"edges": [
{}
]
}
'import requests
url = "https://api.example.com/api/v1/keys/{id}/orchestrator-graph"
payload = {
"enabled": True,
"nodes": [{}],
"edges": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true, nodes: [{}], edges: [{}]})
};
fetch('https://api.example.com/api/v1/keys/{id}/orchestrator-graph', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/keys/{id}/orchestrator-graph",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'nodes' => [
[
]
],
'edges' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/keys/{id}/orchestrator-graph"
payload := strings.NewReader("{\n \"enabled\": true,\n \"nodes\": [\n {}\n ],\n \"edges\": [\n {}\n ]\n}")
req, _ := http.NewRequest("GET", url, payload)
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))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/keys/{id}/orchestrator-graph")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"nodes\": [\n {}\n ],\n \"edges\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/keys/{id}/orchestrator-graph")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"nodes\": [\n {}\n ],\n \"edges\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"key_id": "<string>",
"graph": {}
}