Routing Studio
查看密钥的有效路由
返回当前实际驱动该 API 密钥补全请求的路由规则。
GET
/
api
/
v1
/
keys
/
{id}
/
effective-routing
查看密钥的有效路由
curl --request GET \
--url https://api.example.com/api/v1/keys/{id}/effective-routingimport requests
url = "https://api.example.com/api/v1/keys/{id}/effective-routing"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/keys/{id}/effective-routing', 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}/effective-routing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/keys/{id}/effective-routing"
req, _ := http.NewRequest("GET", url, nil)
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}/effective-routing")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/keys/{id}/effective-routing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body返回将实际驱动指定密钥补全请求的 Routing Studio 快照,并附带一个
source 枚举,便于仪表盘向客户说明该规则的来源。这四种来源对应解析层级:
key— 针对该密钥的规则(可能是隐藏偏好,也可能是显式绑定到该密钥的共享偏好)。org_default— 没有针对该密钥的绑定;回退到当前组织的默认偏好。user_default— 既没有针对该密钥的规则,也没有组织默认偏好;回退到用户的个人默认偏好。none— 没有任何规则生效;路由引擎按未修改的方式运行。
身份验证
需要具备billing API 密钥作用域的 Bearer 令牌,且对该密钥拥有访问权限。
请求示例
curl https://www.hitheo.ai/api/v1/keys/{id}/effective-routing \
-H "Authorization: Bearer $THEO_API_KEY"
const eff = await theo.routingRules.effective(keyId);
console.log(eff.source); // "key" | "org_default" | "user_default" | "none"
console.log(eff.preference_name); // "This key's rules" | "ACME Legal Default" | null
响应
{
"key_id": "key_abc",
"source": "key",
"is_per_key": true,
"preference_id": "1f4f2c1a-22ce-4b07-9c0b-9c4f4b9b1d2e",
"preference_name": "This key's rules",
"rules": [
{
"id": "r_a4b8c01x9y",
"pattern": "\\b(clause|provision|indemnity|warranty)\\b",
"target_mode": "think",
"confidence": 0.92,
"description": "Contract terms get the analytical engine."
}
],
"examples": [{ "prompt": "Look at this clause", "expected_mode": "think" }],
"confidence_floor_overrides": { "think": 0.65 }
}
is_per_key: true— 当前生效的来源是该密钥的隐藏专属偏好(即通过/api/v1/keys/{id}/routing-rules保存的规则)。preference_name— 便于展示的名称。隐藏的密钥专属偏好会渲染为"This key's rules",以确保__key:标记不会泄露到面向客户的界面上。- 当
source为"none"时,preference_id和preference_name均为null,规则数组和示例数组均为空。
错误
404 not_found— 密钥不存在、已被撤销,或调用者无权访问。
此页面对您有帮助吗?
查看密钥的有效路由
curl --request GET \
--url https://api.example.com/api/v1/keys/{id}/effective-routingimport requests
url = "https://api.example.com/api/v1/keys/{id}/effective-routing"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/keys/{id}/effective-routing', 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}/effective-routing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/keys/{id}/effective-routing"
req, _ := http.NewRequest("GET", url, nil)
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}/effective-routing")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/keys/{id}/effective-routing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body