Skip to content

Router API

The Router classifies task intent, selects specialist models, and executes requests against model providers. It sits between the Security Gate (which validates inputs) and the Verifier (which validates outputs).

Base URL: https://router.tismjedi-homelab.com


GET /health
{
"status": "ok",
"service": "nomos-router"
}

Classify a task and produce an execution plan without executing it. Useful for inspecting what the router would do before committing.

POST /route
FieldTypeRequiredDescription
textstringYesThe task description or user message
attestation_idstringYesValid attestation ID from the Security Gate
Terminal window
curl -s -X POST https://router.tismjedi-homelab.com/route \
-H "Content-Type: application/json" \
-d '{
"text": "Review this Go code for security vulnerabilities",
"attestation_id": "att_7f3a9b2c1d4e5f6a"
}' | jq .
{
"id": "plan_8e2f1a3b4c5d6e7f",
"status": "planned",
"attestation_id": "att_7f3a9b2c1d4e5f6a",
"tasks": [
{
"id": "task_1a2b3c4d",
"type": "security_analysis",
"specialist": "security",
"model": "claude-opus-4-20250514",
"provider": "anthropic",
"status": "pending",
"result": null,
"tokens_used": 0,
"cost": 0.0,
"elapsed_ms": 0
}
]
}

The response includes the full plan with model and provider assignments. The plan is not executed until you call /dispatch.


Execute a previously created plan.

POST /dispatch
FieldTypeRequiredDescription
plan_idstringYesThe plan ID returned by /route
Terminal window
curl -s -X POST https://router.tismjedi-homelab.com/dispatch \
-H "Content-Type: application/json" \
-d '{"plan_id": "plan_8e2f1a3b4c5d6e7f"}' \
| jq .
{
"id": "plan_8e2f1a3b4c5d6e7f",
"status": "completed",
"attestation_id": "att_7f3a9b2c1d4e5f6a",
"tasks": [
{
"id": "task_1a2b3c4d",
"type": "security_analysis",
"specialist": "security",
"model": "claude-opus-4-20250514",
"provider": "anthropic",
"status": "completed",
"result": "## Security Review\n\n### Critical Issues\n1. SQL injection in `handleQuery`...",
"tokens_used": 1523,
"cost": 0.0187,
"elapsed_ms": 4231
}
]
}

Combined endpoint that routes and executes in a single call. This is the most common usage pattern.

POST /route-and-execute
FieldTypeRequiredDescription
textstringYesThe task description or user message
attestation_idstringYesValid attestation ID from the Security Gate
Terminal window
curl -s -X POST https://router.tismjedi-homelab.com/route-and-execute \
-H "Content-Type: application/json" \
-d '{
"text": "Convert this CSV data to a normalized JSON schema",
"attestation_id": "att_7f3a9b2c1d4e5f6a"
}' | jq .
{
"id": "plan_3c4d5e6f7a8b9c0d",
"status": "completed",
"attestation_id": "att_7f3a9b2c1d4e5f6a",
"tasks": [
{
"id": "task_5e6f7a8b",
"type": "data_analysis",
"specialist": "analyst",
"model": "gemini-2.5-pro",
"provider": "google",
"status": "completed",
"result": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n ...",
"tokens_used": 876,
"cost": 0.0043,
"elapsed_ms": 2156
}
]
}

Check the current status of a plan. Useful for long-running tasks or when using the separate route/dispatch flow.

GET /status/:id
Terminal window
curl -s https://router.tismjedi-homelab.com/status/plan_8e2f1a3b4c5d6e7f | jq .
{
"id": "plan_8e2f1a3b4c5d6e7f",
"status": "executing",
"attestation_id": "att_7f3a9b2c1d4e5f6a",
"tasks": [
{
"id": "task_1a2b3c4d",
"type": "security_analysis",
"specialist": "security",
"model": "claude-opus-4-20250514",
"provider": "anthropic",
"status": "executing",
"result": null,
"tokens_used": 0,
"cost": 0.0,
"elapsed_ms": 0
}
]
}

All router endpoints return the same plan structure.

FieldTypeDescription
idstringUnique plan identifier
statusstringplanned, executing, completed, or failed
attestation_idstringThe attestation from the Security Gate
tasksarrayList of task objects
FieldTypeDescription
idstringUnique task identifier
typestringClassified task type
specialiststringSpecialist role assigned
modelstringModel selected for execution
providerstringAPI provider
statusstringpending, executing, completed, or failed
resultstring or nullModel response (null until completed)
tokens_usedintegerTotal tokens consumed
costfloatEstimated cost in USD
elapsed_msintegerExecution time in milliseconds

The router classifies inputs into one of the following task types:

TypeDescriptionTypical Specialist
code_generationWriting new codecoder
code_reviewReviewing existing codereviewer
security_analysisSecurity audit, vulnerability analysissecurity
document_analysisSummarization, extraction, understandinganalyst
media_conversionFormat conversion, data transformationconverter
strategic_reasoningPlanning, decision-making, complex reasoningstrategist
data_analysisData processing, statistics, visualizationanalyst
general_chatGeneral conversation, Q&Ageneralist

The router maintains a configurable mapping from specialist roles to preferred models. The current defaults:

SpecialistPrimary ModelFallback
coderClaude SonnetGPT-4o
reviewerClaude OpusGPT-4o
securityClaude OpusGPT-4o
analystGemini 2.5 ProClaude Sonnet
converterGPT-4oClaude Sonnet
strategistClaude OpusGemini 2.5 Pro
generalistClaude SonnetGPT-4o

{
"error": "bad_request",
"message": "Missing required field: attestation_id"
}

Invalid or expired attestation.

{
"error": "invalid_attestation",
"message": "Attestation att_xxx is not valid or has expired"
}

Plan ID does not exist.

{
"error": "not_found",
"message": "Plan plan_xxx not found"
}

Upstream model provider returned an error.

{
"error": "provider_error",
"message": "Anthropic API returned 529: Overloaded",
"provider": "anthropic"
}
{
"error": "internal_error",
"message": "Routing pipeline failed"
}