Invoke a model with routing
POST
/
v1
/
model-router
/
invoke
Invoke a model with routing
curl --request POST \
--url https://api-sandbox.featherhq.com/v1/model-router/invoke \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"messages": [
{
"content": "<string>"
}
],
"router_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config_overrides": {},
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"smart_routing": false
}
'import requests
url = "https://api-sandbox.featherhq.com/v1/model-router/invoke"
payload = {
"messages": [{ "content": "<string>" }],
"router_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config_overrides": {},
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"smart_routing": False
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>'}],
router_config_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
config_overrides: {},
session_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
smart_routing: false
})
};
fetch('https://api-sandbox.featherhq.com/v1/model-router/invoke', 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-sandbox.featherhq.com/v1/model-router/invoke",
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([
'messages' => [
[
'content' => '<string>'
]
],
'router_config_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'config_overrides' => [
],
'session_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'smart_routing' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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-sandbox.featherhq.com/v1/model-router/invoke"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"router_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config_overrides\": {},\n \"session_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"smart_routing\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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-sandbox.featherhq.com/v1/model-router/invoke")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"router_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config_overrides\": {},\n \"session_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"smart_routing\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.featherhq.com/v1/model-router/invoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"router_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config_overrides\": {},\n \"session_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"smart_routing\": false\n}"
response = http.request(request)
puts response.read_body{
"content": "<string>",
"model_identifier": "<string>",
"provider": "<string>",
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_cost_usd": 123,
"output_cost_usd": 123,
"total_cost_usd": 123,
"latency_ms": 123,
"cache_cost_usd": 0,
"routing_metadata": {
"classifier_model": "<string>",
"classifier_tier": "economy",
"classifier_confidence": 123,
"recommended_model": "<string>",
"executed_model": "<string>",
"candidate_chain": [
"<string>"
],
"reason": "<string>"
},
"parsed_output": {},
"execution_engine": "pydantic_text",
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"cache_hit": false,
"route_decision_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"retryable": true,
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retryable": true,
"retry_after": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
application/json
Response
Successful Response
Show child attributes
Show child attributes
Available options:
pydantic_text, pydantic_structured Was this page helpful?
⌘I
Invoke a model with routing
curl --request POST \
--url https://api-sandbox.featherhq.com/v1/model-router/invoke \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"messages": [
{
"content": "<string>"
}
],
"router_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config_overrides": {},
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"smart_routing": false
}
'import requests
url = "https://api-sandbox.featherhq.com/v1/model-router/invoke"
payload = {
"messages": [{ "content": "<string>" }],
"router_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config_overrides": {},
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"smart_routing": False
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>'}],
router_config_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
config_overrides: {},
session_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
smart_routing: false
})
};
fetch('https://api-sandbox.featherhq.com/v1/model-router/invoke', 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-sandbox.featherhq.com/v1/model-router/invoke",
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([
'messages' => [
[
'content' => '<string>'
]
],
'router_config_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'config_overrides' => [
],
'session_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'smart_routing' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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-sandbox.featherhq.com/v1/model-router/invoke"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"router_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config_overrides\": {},\n \"session_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"smart_routing\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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-sandbox.featherhq.com/v1/model-router/invoke")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"router_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config_overrides\": {},\n \"session_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"smart_routing\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.featherhq.com/v1/model-router/invoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"router_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config_overrides\": {},\n \"session_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"smart_routing\": false\n}"
response = http.request(request)
puts response.read_body{
"content": "<string>",
"model_identifier": "<string>",
"provider": "<string>",
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_cost_usd": 123,
"output_cost_usd": 123,
"total_cost_usd": 123,
"latency_ms": 123,
"cache_cost_usd": 0,
"routing_metadata": {
"classifier_model": "<string>",
"classifier_tier": "economy",
"classifier_confidence": 123,
"recommended_model": "<string>",
"executed_model": "<string>",
"candidate_chain": [
"<string>"
],
"reason": "<string>"
},
"parsed_output": {},
"execution_engine": "pydantic_text",
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"cache_hit": false,
"route_decision_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"retryable": true,
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retryable": true,
"retry_after": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}