- list - List Smart Routers
- create - Create a Smart Router
- get - Retrieve a Smart Router
- delete - Delete a Smart Router
- update - Update a Smart Router
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)
| Parameter |
Type |
Required |
Description |
limit |
Optional[int] |
➖ |
N/A |
starting_after |
Optional[str] |
➖ |
N/A |
ending_before |
Optional[str] |
➖ |
N/A |
search |
Optional[str] |
➖ |
N/A |
profile |
List[models.SmartRouterProfile] |
➖ |
N/A |
enabled |
Optional[bool] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.ListSmartRoutersResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
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)
| Parameter |
Type |
Required |
Description |
key |
str |
✔️ |
Unique key for the Smart Router within the workspace. Use lowercase letters, numbers, and hyphens. |
models |
List[str] |
✔️ |
Pool of 2 to 50 distinct eligible models. Each value uses provider/model format. |
profile |
models.SmartRouterProfile |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CreateSmartRouterResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
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)
| Parameter |
Type |
Required |
Description |
smart_router_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetSmartRouterResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
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)
| Parameter |
Type |
Required |
Description |
smart_router_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.DeleteSmartRouterResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
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)
| Parameter |
Type |
Required |
Description |
smart_router_id |
str |
✔️ |
N/A |
models |
List[str] |
➖ |
Replacement pool of 2 to 50 distinct eligible models. Each value uses provider/model format. Omit to keep the current pool. |
profile |
Optional[models.SmartRouterProfile] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.UpdateSmartRouterResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |