API Documentation
Routing Service Integration Guide
Online•v1.0•2 models
Base URL
POST /api/functions/ucpRouterAll endpoints use POST with an action field to specify the operation.
POST
ask
Route a prompt to the appropriate AI model
Request
{
"action": "ask",
"prompt": "What is the capital of France?"
}Response
{
"success": true,
"prompt": "What is the capital of France?",
"final_answer": "FAST MODEL: Quick answer...",
"chosen_model": "fast_model",
"confidence": 0.75,
"latency_ms": 234,
"router_packet_snapshot": { ... }
}POST
getPacket
Retrieve the current router packet configuration
Request
{
"action": "getPacket"
}Response
{
"success": true,
"packet": {
"ucp_version": "1.0",
"command_type": "ai_router",
"models": [...],
"selection_policy": {...}
}
}POST
updatePacket
Update the router packet configuration
Request
{
"action": "updatePacket",
"packet": {
"ucp_version": "1.0",
"command_type": "ai_router",
"models": [...],
"selection_policy": {...},
"signature": "dev-signature"
}
}Response
{
"success": true,
"packet": { ... }
}POST
info
Get service information and health check
Request
{
"action": "info"
}Response
{
"success": true,
"service": "UCP AI Router",
"version": "1.0",
"endpoints": {...},
"models": ["fast_model", "smart_model"]
}