Skip to main content

Debug Endpoint

The debug endpoint runs the routing classifier on a prompt and returns the full decision - without making any provider call or consuming any credits. Use it to understand why a prompt was routed to a particular tier, or to verify that your tier floor and ceiling settings are working as expected. Endpoint:
POST https://api.routor.ai/v1/routing/debug

Request

{
  "prompt": "Prove that the square root of 2 is irrational.",
  "system_prompt": "You are a math tutor.",
  "max_output_tokens": 1024,
  "tools": [],
  "messages": [{ "role": "user", "content": "Prove that the square root of 2 is irrational." }]
}
FieldRequiredDescription
promptYesThe user message to classify
system_promptNoSystem prompt - affects context length estimate
max_output_tokensNoExpected output length - affects cost estimate
toolsNoTool definitions - used to detect the tool-calling scenario and rerank models by function-calling accuracy
messagesNoFull conversation. Defaults to a single user message built from prompt. Used for history-floor detection and tool-scenario classification
profileNoRouting profile: auto (default)

Response

{
  "decision": {
    "model":          "deepseek/deepseek-v4-pro",
    "tier":           "COMPLEX",
    "category":       "math",
    "confidence":     0.91,
    "method":         "rules",
    "reasoning":      "rules: score=0.340, confidence=0.91, signals=[reasoning (proof, theorem), ...]",
    "costEstimate":   0.0042,
    "baselineCost":   0.0280,
    "savings":        0.85,
    "filteredChain": [
      "deepseek/deepseek-v4-pro",
      "openai/gpt-5.5",
      "anthropic/claude-opus-4.8"
    ],
    "profile":        "auto",
    "historyFloor":   null,
    "toolScenario":   null,
    "bfclScore":      null
  }
}

Response Fields

All fields are nested under a decision object.
FieldDescription
tierAssigned tier: NANO, SIMPLE, LIGHT, STANDARD, or COMPLEX
confidenceHow confident the classifier is, from 0 to 1
modelThe model that would be selected for this request
categoryDetected task category (e.g. math, coding_general_debugging_refactoring_testing, simple_qa)
methodHow the tier was decided: rules (rule-based classifier)
reasoningHuman-readable explanation of the decision, including score, signals, and any applied overrides
costEstimateEstimated cost in USD for this request on the selected model (including the routing markup)
baselineCostWhat this would cost on the baseline model (Claude Opus 4.8)
savingsFraction saved vs baseline, from 0 to 1
filteredChainOrdered list of models that would be tried - primary first, fallbacks after
profileRouting profile used: auto, tier, or direct
historyFloorTier floor applied from conversation history, if any (null when not applicable)
toolScenarioDetected tool-calling scenario (single, parallel, multi_turn, web_search, memory, optional), or null when no tools are present
bfclScoreThe selected model’s BFCL score for the detected tool scenario, or null

Example: Debugging a Misclassification

If a prompt is routing to an unexpected tier, call the debug endpoint to inspect the decision:
curl https://api.routor.ai/v1/routing/debug \
  -H "Authorization: Bearer sk-routor-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "What is a callback function?",
    "max_output_tokens": 512
  }'
Response:
{
  "decision": {
    "model":          "moonshot/kimi-k2.6",
    "tier":           "LIGHT",
    "category":       "coding_general_debugging_refactoring_testing",
    "confidence":     0.78,
    "method":         "rules",
    "reasoning":      "rules: score=0.120, confidence=0.78, signals=[code (function), ...]",
    "costEstimate":   0.0003,
    "baselineCost":   0.0062,
    "savings":        0.95,
    "filteredChain": [
      "moonshot/kimi-k2.6",
      "google/gemini-3.5-flash",
      "deepseek/deepseek-v4-flash"
    ],
    "profile":        "auto",
    "historyFloor":   null,
    "toolScenario":   null,
    "bfclScore":      null
  }
}
If the tier feels wrong for your use case, you can override it with a routor_tier_floor on the request or save a Routing Profile with the right constraints.

Authentication

Same as all other endpoints:
Authorization: Bearer sk-routor-YOUR_KEY_HERE