資源
自定義提供方
註冊、列出並刪除你自己的 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