技能 API
创建技能
创建一个新技能(默认私有)。
POST
/
api
/
v1
/
skills
/
create
创建技能
curl --request POST \
--url https://api.example.com/api/v1/skills/create \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"category": "<string>",
"system_prompt_ext": "<string>",
"description": "<string>",
"tool_definitions": [
{}
],
"is_public": true
}
'import requests
url = "https://api.example.com/api/v1/skills/create"
payload = {
"name": "<string>",
"slug": "<string>",
"category": "<string>",
"system_prompt_ext": "<string>",
"description": "<string>",
"tool_definitions": [{}],
"is_public": 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>',
slug: '<string>',
category: '<string>',
system_prompt_ext: '<string>',
description: '<string>',
tool_definitions: [{}],
is_public: true
})
};
fetch('https://api.example.com/api/v1/skills/create', 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/skills/create",
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>',
'slug' => '<string>',
'category' => '<string>',
'system_prompt_ext' => '<string>',
'description' => '<string>',
'tool_definitions' => [
[
]
],
'is_public' => 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/skills/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"category\": \"<string>\",\n \"system_prompt_ext\": \"<string>\",\n \"description\": \"<string>\",\n \"tool_definitions\": [\n {}\n ],\n \"is_public\": 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/skills/create")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"category\": \"<string>\",\n \"system_prompt_ext\": \"<string>\",\n \"description\": \"<string>\",\n \"tool_definitions\": [\n {}\n ],\n \"is_public\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/skills/create")
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 \"slug\": \"<string>\",\n \"category\": \"<string>\",\n \"system_prompt_ext\": \"<string>\",\n \"description\": \"<string>\",\n \"tool_definitions\": [\n {}\n ],\n \"is_public\": true\n}"
response = http.request(request)
puts response.read_body{
"skill": {}
}创建一个新技能。技能默认是私有的 —— 使用提交技能可将其发布到应用市场。
身份验证
需要 Bearer 令牌。参见身份验证。请求体
string
必填
技能的可读名称。
string
必填
唯一标识符。必须为小写字母数字并可包含连字符(例如
"inventory-check")。string
必填
技能类别。可选值为:
productivity、domain、integration、automation、creative。string
必填
当该技能被启用时注入到 LLM 上下文中的系统提示扩展。
string
该技能功能的简短描述。
object[]
该技能提供的工具定义。
请求示例
curl -X POST https://www.hitheo.ai/api/v1/skills/create \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Inventory Check",
"slug": "inventory-check",
"category": "automation",
"system_prompt_ext": "You are an inventory specialist. Use check_stock to look up levels.",
"description": "Real-time inventory lookup and reorder alerts",
"tool_definitions": [
{
"name": "check_stock",
"description": "Look up current stock levels for a SKU",
"inputSchema": {
"type": "object",
"properties": { "sku": { "type": "string" } },
"required": ["sku"]
}
}
]
}'
const skill = await theo.createSkill({
name: "Inventory Check",
slug: "inventory-check",
category: "automation",
system_prompt_ext: "You are an inventory specialist. Use check_stock to look up levels.",
description: "Real-time inventory lookup and reorder alerts",
tool_definitions: [
{
name: "check_stock",
description: "Look up current stock levels for a SKU",
inputSchema: {
type: "object",
properties: { sku: { type: "string" } },
required: ["sku"],
},
},
],
});
响应(HTTP 201)
object
已创建的技能对象,包含全部字段,包括生成的
id。错误
| 状态码 | 代码 | 描述 |
|---|---|---|
| 400 | validation_error | 缺少必填字段或 slug 格式无效 |
| 409 | conflict | 已存在使用该 slug 的技能 |
此页面对您有帮助吗?
创建技能
curl --request POST \
--url https://api.example.com/api/v1/skills/create \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"category": "<string>",
"system_prompt_ext": "<string>",
"description": "<string>",
"tool_definitions": [
{}
],
"is_public": true
}
'import requests
url = "https://api.example.com/api/v1/skills/create"
payload = {
"name": "<string>",
"slug": "<string>",
"category": "<string>",
"system_prompt_ext": "<string>",
"description": "<string>",
"tool_definitions": [{}],
"is_public": 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>',
slug: '<string>',
category: '<string>',
system_prompt_ext: '<string>',
description: '<string>',
tool_definitions: [{}],
is_public: true
})
};
fetch('https://api.example.com/api/v1/skills/create', 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/skills/create",
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>',
'slug' => '<string>',
'category' => '<string>',
'system_prompt_ext' => '<string>',
'description' => '<string>',
'tool_definitions' => [
[
]
],
'is_public' => 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/skills/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"category\": \"<string>\",\n \"system_prompt_ext\": \"<string>\",\n \"description\": \"<string>\",\n \"tool_definitions\": [\n {}\n ],\n \"is_public\": 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/skills/create")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"category\": \"<string>\",\n \"system_prompt_ext\": \"<string>\",\n \"description\": \"<string>\",\n \"tool_definitions\": [\n {}\n ],\n \"is_public\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/skills/create")
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 \"slug\": \"<string>\",\n \"category\": \"<string>\",\n \"system_prompt_ext\": \"<string>\",\n \"description\": \"<string>\",\n \"tool_definitions\": [\n {}\n ],\n \"is_public\": true\n}"
response = http.request(request)
puts response.read_body{
"skill": {}
}