Skip to content
Sign In Get Started

POST /v1/routing/explain

The endpoint uses the same Feedback-driven and Smart Cost planners as live routing, including feature/master switches, actual history, constraints and shadow approval. It does not dispatch models, emit a request/response log, or increment rotation/usage counters. The authenticated audit event and explain rate budget still apply.

Send a chat request directly as the JSON body, with ordinary HTTP headers. The endpoint does not accept a wrapper containing request, locale or headers.

Terminal window
curl -s https://api.floopy.ai/v1/routing/explain \
-H "Authorization: Bearer $FLOOPY_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept-Language: en" \
-H "floopy-routing-rule: $ROUTING_RULE_ID" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Summarise this report."}]}'

floopy-routing-rule selects an organization-scoped rule before optimization. Reserved identity/internal headers are removed from the simulated context. Unknown body fields return 400 unknown_field; invalid chat data returns 400 invalid_body.

The audit is nested under audit. This illustrative untested trial keeps Feedback-driven as the governing strategy:

{
"dry_run": true,
"would_select": {"provider":"openai","model":"gpt-4o-mini"},
"confidence": 0.0,
"confidence_reason": "insufficient_samples",
"firewall_decision": "pass",
"audit": {
"strategy_id": "feedback_driven",
"reason": "would_dispatch",
"phase": "auto",
"exploration_draw": "explore_untested",
"exploration": "explore_untested",
"exploration_rate_effective": 0.2,
"history_available": true,
"winner_origin": "smart_cost_candidate",
"winner": {"provider":"openai","model":"gpt-4o-mini"},
"candidates": [
{"provider":"openai","model":"gpt-4o-mini","score":0.61},
{"provider":"openai","model":"gpt-4o","score":0.86}
],
"filtered": []
}
}
FieldMeaning
would_selectFirst proposed provider/model; null when blocked or unresolved.
audit.strategy_idGoverning policy. Joint mode is feedback_driven.
audit.smart_costOptional participation, baseline, chosen pair, complexity and effective reason.
audit.exploration_drawBand drawn before pool availability and constraints.
audit.explorationEffective selection band; can be exploit when a drawn exploration pool is empty.
audit.history_availableDistinguishes usable empty history from a failed query.
audit.winner_originapproved_target or smart_cost_candidate for optimized routing.
audit.candidates / audit.filteredProposed dispatch chain and rejected candidates.
audit.evidence.samples_in_windowActual winner’s sample count.
audit.evidence.recent_regressionsTagged count: { "kind": "exact", "n": 0 }, or { "kind": "at_least", "n": 10 }.
confidence / confidence_reasonConfidence for the proposed winner; insufficient data can yield zero.
explanationLocalized rendered text and template ID.

In joint mode, candidate scores represent Feedback-driven quality; audit.smart_cost.model_score, when available, records cost utility separately. audit.smart_cost.savings_estimate is zero during planning/explain because token usage is unknown. Live request logs populate it after usage is known, in microdollars. Bypass does not remove quality, cost or shadow constraints.

Content-Language identifies the locale selected from Accept-Language. The firewall runs under the same plan/header gates; blocked requests return 200 with no proposed winner and a firewall filter reason.

Selection is reproducible internally with the same request seed, configuration and evidence snapshot. Each HTTP explain call gets a new request ID and current evidence, so exploratory calls can differ. Round-robin peeks without advancing its counter; concurrent live traffic can change the next turn. Provider failures, retries and stream outcomes are not simulated. Active MCP agent loops return audit.reason: "agent_loop_not_simulated" without a fabricated winner; send floopy-mcp-disabled: true to inspect the ordinary strategy chain.

The endpoint requires the audit API kill switch and eligible plan/permissions. Its budget is 30 calls/minute per organization and 10 per API key; the body cap is 64 KiB. Rejected feature/permission checks return 403, the kill switch returns 404, and exceeded budgets return 429.

See routing decision flow, constraints, and confidence.