Smart Routers
List Smart Routers
Lists Smart Routers in the current workspace, ordered newest first. Use cursor pagination and optional key, profile, or enabled-state filters to narrow the results.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.smart_routers.list()
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.smartRouters.list();
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"limit": Optional[int],
"starting_after": Optional[str],
"ending_before": Optional[str],
"search": Optional[str],
"profile": List[Literal["SMART_ROUTER_PROFILE_UNSPECIFIED", "SMART_ROUTER_PROFILE_QUALITY", "SMART_ROUTER_PROFILE_BALANCED", "SMART_ROUTER_PROFILE_COST"]], # optional
"enabled": Optional[bool],
}
{
limit?: number;
startingAfter?: string;
endingBefore?: string;
search?: string;
profile?: ("SMART_ROUTER_PROFILE_UNSPECIFIED" | "SMART_ROUTER_PROFILE_QUALITY" | "SMART_ROUTER_PROFILE_BALANCED" | "SMART_ROUTER_PROFILE_COST")[];
enabled?: boolean;
}
Show Response
Show Response
{
"object": str,
"data": [{
"smart_router_id": str,
"key": str,
"model_ref": str,
"models": List[str],
"profile": Literal["SMART_ROUTER_PROFILE_UNSPECIFIED", "SMART_ROUTER_PROFILE_QUALITY", "SMART_ROUTER_PROFILE_BALANCED", "SMART_ROUTER_PROFILE_COST"],
"enabled": bool,
"created_at": date,
"updated_at": date,
}],
"has_more": bool,
}
{
object: string;
data: {
smartRouterId: string;
key: string;
modelRef: string;
models: string[];
profile: "SMART_ROUTER_PROFILE_UNSPECIFIED" | "SMART_ROUTER_PROFILE_QUALITY" | "SMART_ROUTER_PROFILE_BALANCED" | "SMART_ROUTER_PROFILE_COST";
enabled: boolean;
createdAt: Date;
updatedAt: Date;
}[];
hasMore: boolean;
}
Create a Smart Router
Creates a Smart Router in the current workspace from 2 to 50 distinct eligible models. The key must be unique in the workspace and becomes part of the model reference used in AI Gateway requests.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.smart_routers.create(key="<key>", models=[
"<value 1>",
"<value 2>",
"<value 3>",
], profile="SMART_ROUTER_PROFILE_QUALITY")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.smartRouters.create({
key: "<key>",
models: [
"<value 1>",
"<value 2>",
"<value 3>",
],
profile: "SMART_ROUTER_PROFILE_QUALITY",
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"key": str, # required
"models": List[str], # required
"profile": Literal["SMART_ROUTER_PROFILE_UNSPECIFIED", "SMART_ROUTER_PROFILE_QUALITY", "SMART_ROUTER_PROFILE_BALANCED", "SMART_ROUTER_PROFILE_COST"], # required
}
{
key: string; // required
models: string[]; // required
profile: "SMART_ROUTER_PROFILE_UNSPECIFIED" | "SMART_ROUTER_PROFILE_QUALITY" | "SMART_ROUTER_PROFILE_BALANCED" | "SMART_ROUTER_PROFILE_COST"; // required
}
Show Response
Show Response
{
"smart_router": {
"smart_router_id": str,
"key": str,
"model_ref": str,
"models": List[str],
"profile": Literal["SMART_ROUTER_PROFILE_UNSPECIFIED", "SMART_ROUTER_PROFILE_QUALITY", "SMART_ROUTER_PROFILE_BALANCED", "SMART_ROUTER_PROFILE_COST"],
"enabled": bool,
"created_at": date,
"updated_at": date,
},
}
{
smartRouter: {
smartRouterId: string;
key: string;
modelRef: string;
models: string[];
profile: "SMART_ROUTER_PROFILE_UNSPECIFIED" | "SMART_ROUTER_PROFILE_QUALITY" | "SMART_ROUTER_PROFILE_BALANCED" | "SMART_ROUTER_PROFILE_COST";
enabled: boolean;
createdAt: Date;
updatedAt: Date;
};
}
Retrieve a Smart Router
Retrieves a Smart Router by ID from the current workspace, including its model reference, model pool, routing profile, and enabled state.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.smart_routers.get(smart_router_id="<id>")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.smartRouters.get({
smartRouterId: "<id>",
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"smart_router_id": str, # required
}
{
smartRouterId: string; // required
}
Show Response
Show Response
{
"smart_router": {
"smart_router_id": str,
"key": str,
"model_ref": str,
"models": List[str],
"profile": Literal["SMART_ROUTER_PROFILE_UNSPECIFIED", "SMART_ROUTER_PROFILE_QUALITY", "SMART_ROUTER_PROFILE_BALANCED", "SMART_ROUTER_PROFILE_COST"],
"enabled": bool,
"created_at": date,
"updated_at": date,
},
}
{
smartRouter: {
smartRouterId: string;
key: string;
modelRef: string;
models: string[];
profile: "SMART_ROUTER_PROFILE_UNSPECIFIED" | "SMART_ROUTER_PROFILE_QUALITY" | "SMART_ROUTER_PROFILE_BALANCED" | "SMART_ROUTER_PROFILE_COST";
enabled: boolean;
createdAt: Date;
updatedAt: Date;
};
}
Delete a Smart Router
Permanently deletes a Smart Router and removes its AI Gateway model configuration. A Smart Router referenced by an experiment cannot be deleted.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.smart_routers.delete(smart_router_id="<id>")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.smartRouters.delete({
smartRouterId: "<id>",
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"smart_router_id": str, # required
}
{
smartRouterId: string; // required
}
Update a Smart Router
Updates the model pool, routing profile, or both. Omitted fields retain their current values. The router key and model reference cannot be changed.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.smart_routers.update(smart_router_id="<id>")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.smartRouters.update({ smartRouterId: "<id>" });
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"smart_router_id": str, # required
"models": List[str], # optional
"profile": Optional[Literal["SMART_ROUTER_PROFILE_UNSPECIFIED", "SMART_ROUTER_PROFILE_QUALITY", "SMART_ROUTER_PROFILE_BALANCED", "SMART_ROUTER_PROFILE_COST"]],
}
{
smartRouterId: string; // required
models?: string[];
profile?: "SMART_ROUTER_PROFILE_UNSPECIFIED" | "SMART_ROUTER_PROFILE_QUALITY" | "SMART_ROUTER_PROFILE_BALANCED" | "SMART_ROUTER_PROFILE_COST";
}
Show Response
Show Response
{
"smart_router": {
"smart_router_id": str,
"key": str,
"model_ref": str,
"models": List[str],
"profile": Literal["SMART_ROUTER_PROFILE_UNSPECIFIED", "SMART_ROUTER_PROFILE_QUALITY", "SMART_ROUTER_PROFILE_BALANCED", "SMART_ROUTER_PROFILE_COST"],
"enabled": bool,
"created_at": date,
"updated_at": date,
},
}
{
smartRouter: {
smartRouterId: string;
key: string;
modelRef: string;
models: string[];
profile: "SMART_ROUTER_PROFILE_UNSPECIFIED" | "SMART_ROUTER_PROFILE_QUALITY" | "SMART_ROUTER_PROFILE_BALANCED" | "SMART_ROUTER_PROFILE_COST";
enabled: boolean;
createdAt: Date;
updatedAt: Date;
};
}