Python SDK
from decimalai.skill_router import SkillRouter
router = SkillRouter(api_key="dai_sk_...")
result = router.smart_route(query="Find flights to Tokyo", top_k=5)curl --request POST \
--url https://api.decimal.ai/api/v1/skills/route \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "Find flights to Tokyo",
"top_k": 5,
"include_attachments": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'Find flights to Tokyo', top_k: 5, include_attachments: true})
};
fetch('https://api.decimal.ai/api/v1/skills/route', 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.decimal.ai/api/v1/skills/route",
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([
'query' => 'Find flights to Tokyo',
'top_k' => 5,
'include_attachments' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.decimal.ai/api/v1/skills/route"
payload := strings.NewReader("{\n \"query\": \"Find flights to Tokyo\",\n \"top_k\": 5,\n \"include_attachments\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.decimal.ai/api/v1/skills/route")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"Find flights to Tokyo\",\n \"top_k\": 5,\n \"include_attachments\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decimal.ai/api/v1/skills/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"Find flights to Tokyo\",\n \"top_k\": 5,\n \"include_attachments\": true\n}"
response = http.request(request)
puts response.read_body{
"matched_skill": "search-flights",
"confidence": 0.92,
"alternatives": [
{
"name": "book-flights",
"score": 0.45
}
],
"attachments": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}skills
Smart-route a query to the best skill
Smart routing: semantic search + performance re-ranking.
Embeds the query, finds relevant skills via cosine similarity, then re-ranks by historical performance data. When the caller’s whole eligible menu fits the description token budget, returns the full menu instead, rather than truncating to a top-N slice.
If include_attachments is true (default), the response includes
bundled script content for skills that have multi-file bundles.
POST
/
api
/
v1
/
skills
/
route
Python SDK
from decimalai.skill_router import SkillRouter
router = SkillRouter(api_key="dai_sk_...")
result = router.smart_route(query="Find flights to Tokyo", top_k=5)curl --request POST \
--url https://api.decimal.ai/api/v1/skills/route \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "Find flights to Tokyo",
"top_k": 5,
"include_attachments": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'Find flights to Tokyo', top_k: 5, include_attachments: true})
};
fetch('https://api.decimal.ai/api/v1/skills/route', 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.decimal.ai/api/v1/skills/route",
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([
'query' => 'Find flights to Tokyo',
'top_k' => 5,
'include_attachments' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.decimal.ai/api/v1/skills/route"
payload := strings.NewReader("{\n \"query\": \"Find flights to Tokyo\",\n \"top_k\": 5,\n \"include_attachments\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.decimal.ai/api/v1/skills/route")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"Find flights to Tokyo\",\n \"top_k\": 5,\n \"include_attachments\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decimal.ai/api/v1/skills/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"Find flights to Tokyo\",\n \"top_k\": 5,\n \"include_attachments\": true\n}"
response = http.request(request)
puts response.read_body{
"matched_skill": "search-flights",
"confidence": 0.92,
"alternatives": [
{
"name": "book-flights",
"score": 0.45
}
],
"attachments": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}⌘I