资源
自定义提供方
注册、列出并删除你自己的 OpenAI 兼容模型端点(自带模型)。
POST
/
api
/
v1
/
custom-providers
自定义提供方
curl --request POST \
--url https://api.example.com/api/v1/custom-providers \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"base_url": "<string>",
"api_key": "<string>",
"models": [
{
"id": "<string>",
"label": "<string>",
"contextWindow": 123
}
],
"local": true
}
'import requests
url = "https://api.example.com/api/v1/custom-providers"
payload = {
"name": "<string>",
"base_url": "<string>",
"api_key": "<string>",
"models": [
{
"id": "<string>",
"label": "<string>",
"contextWindow": 123
}
],
"local": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
base_url: '<string>',
api_key: '<string>',
models: [{id: '<string>', label: '<string>', contextWindow: 123}],
local: true
})
};
fetch('https://api.example.com/api/v1/custom-providers', 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/custom-providers",
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>',
'base_url' => '<string>',
'api_key' => '<string>',
'models' => [
[
'id' => '<string>',
'label' => '<string>',
'contextWindow' => 123
]
],
'local' => true
]),
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/custom-providers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"base_url\": \"<string>\",\n \"api_key\": \"<string>\",\n \"models\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"contextWindow\": 123\n }\n ],\n \"local\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/api/v1/custom-providers")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"base_url\": \"<string>\",\n \"api_key\": \"<string>\",\n \"models\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"contextWindow\": 123\n }\n ],\n \"local\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/custom-providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"base_url\": \"<string>\",\n \"api_key\": \"<string>\",\n \"models\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"contextWindow\": 123\n }\n ],\n \"local\": true\n}"
response = http.request(request)
puts response.read_body将任意 OpenAI 兼容的 chat-completions 端点注册为自定义提供方,然后即可在模型方案或编排器图的 Model 节点中,通过带命名空间的 id
返回
然后将其固定到某个密钥上:
custom:<providerId>:<modelId> 引用其模型。发往你自己模型的请求是免费的,不会消耗 Theo 令牌——你直接向你的提供方付费。
身份验证
需要具备billing 权限范围的 API 密钥。
注册一个提供方
POST /api/v1/custom-providers
string
必填
显示名称(1–120 个字符)。
string
必填
该端点的基础 URL——必须是
http(s)。string
必填
提供方的 API 密钥。以加密方式存储;API 永远不会返回该值。
object[]
必填
boolean
本机 / 本地部署:仅可从已关联的桌面端访问,永不从云端派发。默认值为
false。{ id }——即该提供方的 id。可通过 custom:<id>:<modelId> 引用其模型。
列出提供方
GET /api/v1/custom-providers → { providers: [{ id, name, base_url, models }] }。API 密钥永远不会包含在返回结果中。
删除一个提供方
DELETE /api/v1/custom-providers/{id} → { deleted: true }。
示例
curl -X POST https://www.hitheo.ai/api/v1/custom-providers \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My vLLM",
"base_url": "https://llm.example.com/v1",
"api_key": "sk-...",
"models": [{ "id": "my-llama-70b", "label": "Llama 70B", "contextWindow": 131072 }]
}'
await theo.keys.setModelPlan("KEY_ID", {
single_model: { upstream_id: "custom:PROVIDER_ID:my-llama-70b" },
});
此页面对您有帮助吗?
自定义提供方
curl --request POST \
--url https://api.example.com/api/v1/custom-providers \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"base_url": "<string>",
"api_key": "<string>",
"models": [
{
"id": "<string>",
"label": "<string>",
"contextWindow": 123
}
],
"local": true
}
'import requests
url = "https://api.example.com/api/v1/custom-providers"
payload = {
"name": "<string>",
"base_url": "<string>",
"api_key": "<string>",
"models": [
{
"id": "<string>",
"label": "<string>",
"contextWindow": 123
}
],
"local": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
base_url: '<string>',
api_key: '<string>',
models: [{id: '<string>', label: '<string>', contextWindow: 123}],
local: true
})
};
fetch('https://api.example.com/api/v1/custom-providers', 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/custom-providers",
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>',
'base_url' => '<string>',
'api_key' => '<string>',
'models' => [
[
'id' => '<string>',
'label' => '<string>',
'contextWindow' => 123
]
],
'local' => true
]),
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/custom-providers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"base_url\": \"<string>\",\n \"api_key\": \"<string>\",\n \"models\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"contextWindow\": 123\n }\n ],\n \"local\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/api/v1/custom-providers")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"base_url\": \"<string>\",\n \"api_key\": \"<string>\",\n \"models\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"contextWindow\": 123\n }\n ],\n \"local\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/custom-providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"base_url\": \"<string>\",\n \"api_key\": \"<string>\",\n \"models\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"contextWindow\": 123\n }\n ],\n \"local\": true\n}"
response = http.request(request)
puts response.read_body