{
  "name": "BrainstormRouter",
  "description": "Runtime control plane for production AI agents. Drop-in OpenAI & Anthropic-compatible proxy with intelligent routing, budget enforcement, quality scoring, and full observability across multiple AI providers.",
  "url": "https://api.brainstormrouter.com",
  "documentation_url": "https://docs.brainstormrouter.com",
  "llms_txt_url": "https://brainstormrouter.com/llms.txt",
  "agent_playbook_url": "https://brainstormrouter.com/llms-agent-playbook.txt",
  "openapi_url": "https://api.brainstormrouter.com/openapi.json",
  "auth": {
    "type": "bearer",
    "header": "Authorization",
    "description": "API key from POST /v1/register or dashboard"
  },
  "registration": {
    "endpoint": "https://api.brainstormrouter.com/v1/register",
    "method": "POST",
    "auth": "none",
    "requires_invite_code": true,
    "fields": {
      "invite_code": {
        "required": true,
        "description": "Invite code for tenant creation"
      },
      "tenant_name": {
        "required": true,
        "description": "Display name for the tenant"
      },
      "admin_email": {
        "required": true,
        "description": "Admin email for billing/notifications"
      },
      "accept_tos": {
        "required": true,
        "type": "boolean",
        "must_be": true
      },
      "tenant_slug": {
        "required": false,
        "description": "Custom slug (auto-generated if omitted)"
      },
      "key_name": {
        "required": false,
        "description": "Name for the auto-created API key"
      }
    },
    "note": "Machine-registered tenants are API-only. Dashboard access requires a separate browser-based signup."
  },
  "auto_routing": {
    "description": "Set model='auto' to activate BrainstormRouter's intelligence engine for automatic model selection.",
    "variants": {
      "auto": "Best overall model (quality-weighted Thompson sampling)",
      "auto:fast": "Fastest model (latency-optimized)",
      "auto:floor": "Cheapest model (cost-optimized)",
      "auto:best": "Most capable model (quality-only, ignores cost)"
    },
    "strategies": {
      "thompson_sampling": {
        "description": "Learns which models produce best results via UCB1 (< 500 samples) and Gaussian Thompson Sampling (>= 500 samples).",
        "min_samples": 50,
        "exploration_threshold": 500
      },
      "complexity_based": {
        "description": "Scores request complexity (0-10) from message count, tools, images, tokens, content analysis, and memory signals.",
        "thresholds": {
          "simple": "<2",
          "moderate": "2-4",
          "complex": ">=5"
        },
        "routing": {
          "simple": "cheapest model",
          "moderate": "mid-range model",
          "complex": "most capable model"
        }
      },
      "cheapest_fallback": {
        "description": "When no history or complexity signal, picks lowest-cost chat-capable model."
      }
    },
    "response_headers": [
      "X-BR-Selection-Method",
      "X-BR-Complexity-Level",
      "X-BR-Complexity-Score",
      "X-BR-Selection-Confidence",
      "X-BR-Models-Considered"
    ]
  },
  "capabilities": [
    "chat_completions",
    "model_routing",
    "thompson_sampling",
    "agent_memory",
    "guardrails",
    "observability",
    "governance",
    "mcp_server",
    "scim_provisioning",
    "mtls_agent_identity",
    "agent_bootstrap",
    "agent_hr_record",
    "agent_self_awareness",
    "agent_delegation",
    "platform_admin",
    "machine_registration",
    "batch_provider_registration",
    "graduated_trust_degradation",
    "delegated_provisioning",
    "evidence_ledger",
    "budget_management",
    "kill_switch",
    "machine_actionable_errors",
    "runnable_catalog",
    "provider_health_transparency",
    "cli_binary"
  ],
  "agent_endpoints": {
    "discovery": {
      "method": "GET",
      "path": "/v1/discovery",
      "description": "First call after auth — routing capabilities, provider health, budget, model stats, intelligence headers"
    },
    "self_awareness": {
      "method": "GET",
      "path": "/v1/self",
      "description": "Full self-awareness: identity, capabilities, health, budget, memory, config, suggestions, recent errors"
    },
    "runnable_catalog": {
      "method": "GET",
      "path": "/v1/catalog/runnable",
      "description": "Models that will actually work right now — filtered by circuit breaker, sentinel, BYOK keys, and budget"
    },
    "provider_health": {
      "method": "GET",
      "path": "/v1/health/providers",
      "description": "Per-provider health matrix: sentinel probes + circuit breaker state + BYOK key status"
    }
  },
  "error_recovery": {
    "description": "Every error response includes a 'recovery' field with machine-actionable next steps",
    "headers": [
      "X-BR-Recovery-Action",
      "X-BR-Recovery-Endpoint",
      "X-BR-Recovery-Docs"
    ],
    "actions": [
      "increase_budget",
      "use_alternative_model",
      "register_provider",
      "retry_after",
      "retry_with_fallback",
      "check_status",
      "check_guardrails",
      "authenticate"
    ]
  },
  "mcp": {
    "endpoint": "https://api.brainstormrouter.com/v1/mcp/connect",
    "transport": "streamable-http",
    "description": "BrainstormRouter operates as both MCP server (exposing 80 control-plane tools) and MCP gateway (registering, governing, and proxying external MCP servers with secretless access).",
    "secretless_access": "Upstream MCP server credentials are stored on server registrations, never exposed to calling agents. Agents authenticate to BrainstormRouter; the gateway injects stored credentials when proxying tool calls.",
    "tools": [
      {
        "name": "br_route_completion",
        "description": "Send a message to any AI model. Set model='auto' for automatic cost/quality optimization. Supports streaming, tool calls, and vision.",
        "permission": "router.write"
      },
      {
        "name": "br_list_models",
        "description": "List all available models with pricing and capabilities. Use to discover what's routable before making completions.",
        "permission": "router.read"
      },
      {
        "name": "br_compare_models",
        "description": "Run the same prompt on 2-6 models in parallel. Returns per-model output, cost, latency, quality signals, and picks cheapest/fastest/best.",
        "permission": "router.write"
      },
      {
        "name": "br_get_usage",
        "description": "Check how much you've spent and how many requests you've made. Specify period: 'day', 'week', or 'month'.",
        "permission": "audit.read"
      },
      {
        "name": "br_explain_request",
        "description": "Get full routing explanation for a past request. Shows model selection method, alternatives, complexity, guardrails, cost, and latency.",
        "permission": "audit.read"
      },
      {
        "name": "br_estimate_cost",
        "description": "Predict cost before executing a request. Send messages and model to get estimated cost in USD, token counts, and cheaper alternatives.",
        "permission": "router.read"
      },
      {
        "name": "br_set_alias",
        "description": "Create a model shortcut. Example: alias 'fast' to 'anthropic/claude-haiku-4-5'. Use aliases in completions for easy switching.",
        "permission": "config.write"
      },
      {
        "name": "br_list_aliases",
        "description": "View all model aliases configured for your tenant. Aliases map friendly names to model IDs.",
        "permission": "config.read"
      },
      {
        "name": "br_patch_aliases",
        "description": "Bulk update aliases in one call. Set value to null to delete. Useful for swapping model tiers across all aliases.",
        "permission": "config.write"
      },
      {
        "name": "br_get_health",
        "description": "Check if BrainstormRouter is operational. Returns version, uptime, and endpoint counts. Use as a connectivity test.",
        "permission": "router.read"
      },
      {
        "name": "br_memory_list",
        "description": "Read all persistent memory entries. Returns facts organized by block (semantic, episodic, procedural, system).",
        "permission": "memory.read"
      },
      {
        "name": "br_memory_store",
        "description": "Save a fact that persists across sessions. Specify block: 'semantic' for knowledge, 'episodic' for events, 'procedural' for how-to.",
        "permission": "memory.write"
      },
      {
        "name": "br_memory_query",
        "description": "Search memory by keyword relevance. Returns scored results. Use before completions to inject relevant context.",
        "permission": "memory.read"
      },
      {
        "name": "br_memory_delete",
        "description": "Remove a memory entry by its ID. Permanent — cannot be undone.",
        "permission": "memory.write"
      },
      {
        "name": "br_memory_update",
        "description": "Edit a memory entry's text or toggle its pinned status. Pinned entries are always included in context.",
        "permission": "memory.write"
      },
      {
        "name": "br_memory_shared_store",
        "description": "Save a fact visible to ALL agents in your tenant. Use for team knowledge, shared policies, or cross-agent coordination.",
        "permission": "memory.write"
      },
      {
        "name": "br_memory_shared_list",
        "description": "Read shared memory entries accessible by all agents in your tenant.",
        "permission": "memory.read"
      },
      {
        "name": "br_list_prompts",
        "description": "List prompt templates with versions and A/B test status. Use to find reusable system prompts for your tenant.",
        "permission": "config.read"
      },
      {
        "name": "br_evaluate_prompt",
        "description": "Run a prompt template against test cases with scoring. Supports exact_match, contains, validity, and llm_judge scorers. Returns pass/fail per case.",
        "permission": "config.write"
      },
      {
        "name": "br_get_eval_results",
        "description": "Get stored evaluation run results for a prompt. Shows pass rate, scores, and per-case details from previous evaluations.",
        "permission": "config.read"
      },
      {
        "name": "br_list_presets",
        "description": "List routing presets — saved model+parameter combos. Reference as '@preset/slug' in completions.",
        "permission": "config.read"
      },
      {
        "name": "br_pattern_recommend",
        "description": "Get task execution pattern recommendations. Query what approaches work best for a task type before starting work."
      },
      {
        "name": "br_request_patterns",
        "description": "Get request pattern intelligence — which models succeed best for which request types (tool use, code, large context, etc.).",
        "permission": "router.read"
      },
      {
        "name": "br_routing_advise",
        "description": "Get predictive routing advice — recommended model with reasoning chain, evidence from similar past requests, alternatives with tradeoffs, and confidence score.",
        "permission": "router.read"
      },
      {
        "name": "br_fleet_insights",
        "description": "Get fleet-wide model intelligence: capability scores, success rates, best-for/weak-at signals. Query a model or get top-10 overview.",
        "permission": "router.read"
      },
      {
        "name": "br_get_ops_status",
        "description": "Full operations dashboard: endpoint health, budget status, usage trends, guardrail stats. Start here for system overview.",
        "permission": "router.read"
      },
      {
        "name": "br_get_insights",
        "description": "Get cost optimization recommendations. Identifies waste, suggests cheaper models, and estimates potential savings.",
        "permission": "audit.read"
      },
      {
        "name": "br_get_governance",
        "description": "Governance health check: memory usage by block, compliance status, audit trail statistics.",
        "permission": "audit.read"
      },
      {
        "name": "br_list_agents",
        "description": "List all agent profiles with lifecycle state, department, and cost center. Use to audit your agent fleet.",
        "permission": "agent.profile.read"
      },
      {
        "name": "br_get_leaderboard",
        "description": "Rank models by real performance: quality score, speed, value. Powered by Thompson sampling from actual usage data.",
        "permission": "router.read"
      },
      {
        "name": "br_recommend_model",
        "description": "Get ranked model recommendations for a task. Returns top models with scores, estimated costs, and reasons based on real production data.",
        "permission": "router.read"
      },
      {
        "name": "br_consensus",
        "description": "Evaluate consensus across multiple model responses. Submit 2-5 pre-collected responses and get the best answer via majority vote, quality scoring, or weighted Thompson sampling.",
        "permission": "router.write"
      },
      {
        "name": "br_bootstrap_agent",
        "description": "Create a new agent identity in one call. Returns profile + JWT + budget. Required before independent agent action.",
        "permission": "agent.bootstrap"
      },
      {
        "name": "br_agent_status",
        "description": "Full self-check: profile, budget remaining, rate limit headroom, recent anomaly events, and governance state.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_agent_limits",
        "description": "Check your budget and rate limit status. Shows enforced limits, current spend, and remaining capacity.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_agent_anomaly",
        "description": "View your recent security events. High anomaly scores may trigger trust degradation — check here to understand why.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_delegate_agent",
        "description": "Spawn a sub-agent with a sliced budget from your own. Requires agent JWT. The child inherits your trust tier.",
        "permission": "agent.delegate"
      },
      {
        "name": "br_list_sub_agents",
        "description": "List your active sub-agents. Shows budget consumed, remaining capacity, and lifecycle state for each.",
        "permission": "agent.delegate"
      },
      {
        "name": "br_terminate_sub_agent",
        "description": "Terminate a sub-agent and reclaim its unspent budget back to your allocation. Irreversible.",
        "permission": "agent.delegate"
      },
      {
        "name": "br_get_agent_skill",
        "description": "Read an agent's accumulated skill — domain knowledge, learned patterns, project context. Skills grow from completions.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_update_agent_skill",
        "description": "Update an agent's skill with new knowledge, patterns, or standards. Partial merge — only specified fields change.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_list_agent_skills",
        "description": "List all agents and their skill summaries: domain, version, pattern count, total completions.",
        "permission": "agent.profile.read"
      },
      {
        "name": "br_get_skill_history",
        "description": "View how an agent's skill evolved over time. Shows version snapshots with triggers (accumulation, manual, seed).",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_get_employment_profile",
        "description": "Full Workday-style employment profile — identity, compensation, objectives, performance reviews, heartbeat, and compliance.",
        "permission": "agent.profile.read"
      },
      {
        "name": "br_set_objectives",
        "description": "Set MBOs (Management by Objectives) — measurable targets with auto-tracked progress from production data.",
        "permission": "agent.profile.write"
      },
      {
        "name": "br_get_performance_review",
        "description": "Performance review — current rating (exceeds/meets/needs_improvement/pip), review history, PIP status, promotion eligibility.",
        "permission": "agent.profile.read"
      },
      {
        "name": "br_trigger_review",
        "description": "Force an immediate off-cycle performance review for an agent.",
        "permission": "agent.profile.write"
      },
      {
        "name": "br_update_compensation",
        "description": "Update compensation — salary tier (intern/junior/senior/staff/principal), daily and monthly budget.",
        "permission": "agent.profile.write"
      },
      {
        "name": "br_get_heartbeat",
        "description": "Unified agent health surface — lifecycle state, anomaly score, reputation tier, and budget remaining in one call.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_workspace_list",
        "description": "List all workspace files for an agent — SOUL.md, context files, reference docs.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_workspace_get",
        "description": "Read a workspace file by name (e.g. SOUL.md, SESSION_CONTEXT.md).",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_workspace_put",
        "description": "Create or update a workspace file. Use for SOUL.md, context files, or reference docs (prefix with ref/).",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_workspace_delete",
        "description": "Delete a workspace file.",
        "permission": "agent.profile.self"
      },
      {
        "name": "br_list_config",
        "description": "List all tenant configuration sections with versions. Sections include routing, guardrails, security, mesh, and more.",
        "permission": "config.read"
      },
      {
        "name": "br_get_config",
        "description": "Read a specific config section by key. Returns the current value and OCC version number.",
        "permission": "config.read"
      },
      {
        "name": "br_set_config",
        "description": "Update a config section. Pass the full section value — it replaces the current config atomically.",
        "permission": "config.write"
      },
      {
        "name": "br_get_insights_daily",
        "description": "Daily cost breakdown by model. Shows per-model spend, request counts, and average cost. Use for budget planning.",
        "permission": "audit.read"
      },
      {
        "name": "br_get_insights_forecast",
        "description": "Predict when your budget will run out. Uses 30-day trend data to project daily and monthly depletion dates.",
        "permission": "audit.read"
      },
      {
        "name": "br_get_capacity",
        "description": "Provider health matrix: 24h request counts, success rates, latency, and health status per provider.",
        "permission": "router.read"
      },
      {
        "name": "br_get_security_status",
        "description": "Security posture overview: policy engine state, rule count, anomaly detector metrics. Check after config changes.",
        "permission": "security.read"
      },
      {
        "name": "br_get_policies",
        "description": "Read the active security policy ruleset. Shows all rules with conditions, actions, and priorities.",
        "permission": "security.read"
      },
      {
        "name": "br_test_policy",
        "description": "Dry-run a request context against security policies. See which rules would match without affecting live traffic.",
        "permission": "security.read"
      },
      {
        "name": "br_get_siem_config",
        "description": "View SIEM export settings: destination (Splunk/LogScale), format (OCSF/CEF/JSON), and event filters.",
        "permission": "security.read"
      },
      {
        "name": "br_update_siem_config",
        "description": "Configure SIEM export: set destination URL, auth token, format, and which event types to forward.",
        "permission": "security.write"
      },
      {
        "name": "br_get_guardrail_config",
        "description": "View active guardrail pipeline: enabled scanners, mode (block/warn/log), PII detection settings.",
        "permission": "config.read"
      },
      {
        "name": "br_update_guardrail_config",
        "description": "Configure guardrails: enable/disable scanners, set mode, adjust PII detection sensitivity.",
        "permission": "config.write"
      },
      {
        "name": "br_test_guardrails",
        "description": "Test content against guardrails without affecting traffic. Returns which scanners would trigger and why.",
        "permission": "config.write"
      },
      {
        "name": "br_get_budget_status",
        "description": "Check budget: daily and monthly spend vs limits. Shows remaining capacity and whether limits are enforced.",
        "permission": "audit.read"
      },
      {
        "name": "br_get_budget_forecast",
        "description": "Predict budget depletion: projected spend rate, estimated exhaustion date, anomaly alerts if spending spikes.",
        "permission": "audit.read"
      },
      {
        "name": "br_activate_killswitch",
        "description": "EMERGENCY: Immediately halt ALL AI routing for this tenant. Reversible via br_deactivate_killswitch. Use with caution.",
        "permission": "security.write"
      },
      {
        "name": "br_deactivate_killswitch",
        "description": "Resume AI routing after emergency stop. All pending requests will start flowing again immediately.",
        "permission": "security.write"
      },
      {
        "name": "br_get_killswitch_status",
        "description": "Check kill switch state and activation history. Shows who activated, when, and the reason given.",
        "permission": "security.read"
      },
      {
        "name": "br_killswitch_scope",
        "description": "Surgically kill a specific agent, tool, or provider without stopping all routing. More precise than full kill switch.",
        "permission": "security.write"
      },
      {
        "name": "br_list_killswitch_scopes",
        "description": "List all active scoped kill switches with their type, target, reason, and activation time.",
        "permission": "security.read"
      },
      {
        "name": "br_deactivate_killswitch_scope",
        "description": "Remove a scoped kill switch, re-enabling the targeted agent, tool, or provider.",
        "permission": "security.write"
      },
      {
        "name": "br_policy_dry_run",
        "description": "Simulate a policy evaluation: pass any request context and see exactly which rules match, in what order.",
        "permission": "security.read"
      },
      {
        "name": "br_replay_decisions",
        "description": "Review recent routing decisions: which model was chosen, why, and what alternatives were considered.",
        "permission": "audit.read"
      },
      {
        "name": "br_session_timeline",
        "description": "Reconstruct a chronological session timeline: usage, security events, memory mutations. For incident investigation.",
        "permission": "audit.read"
      },
      {
        "name": "br_forensic_snapshots",
        "description": "View forensic proof-of-death records for terminated agents. Contains final state, budget, and termination reason.",
        "permission": "security.read"
      },
      {
        "name": "br_list_pending_approvals",
        "description": "List pending human-in-the-loop approval requests. Agents can queue actions that require human sign-off.",
        "permission": "security.read"
      },
      {
        "name": "br_approve_request",
        "description": "Approve a pending HITL request. The queued action will execute immediately upon approval.",
        "permission": "security.write"
      },
      {
        "name": "br_reject_request",
        "description": "Reject a pending HITL request. The queued action is discarded and the requester is notified.",
        "permission": "security.write"
      },
      {
        "name": "br_list_tenants",
        "description": "List all tenants with status, spend, and model count. Filter by status: pending, active, suspended. Admin only.",
        "permission": "platform.admin"
      },
      {
        "name": "br_approve_tenant",
        "description": "Activate a pending tenant. They gain immediate access to the API. Admin only.",
        "permission": "platform.admin"
      },
      {
        "name": "br_reject_tenant",
        "description": "Reject a pending tenant application. They cannot access the API. Admin only.",
        "permission": "platform.admin"
      },
      {
        "name": "br_get_business_digest",
        "description": "Executive summary: total tenants, aggregate spend, pending approvals, growth trends. Admin only.",
        "permission": "platform.admin"
      },
      {
        "name": "br_create_invite_code",
        "description": "Generate a beta invite code. Required for POST /v1/register. Set max_uses and expiry. Admin only.",
        "permission": "platform.admin"
      },
      {
        "name": "br_mcp_server_health",
        "description": "Probe a registered MCP server's health. Tests connectivity, refreshes OAuth2 tokens if needed.",
        "permission": "config.read"
      },
      {
        "name": "br_my_permissions",
        "description": "View your RBAC roles and permissions. Shows what you can and cannot do, plus how to request elevated access.",
        "permission": "router.read"
      },
      {
        "name": "br_guardrail_metrics",
        "description": "Guardrail scanner performance: pass/fail/error rates per scanner, feedback summary, and trend data.",
        "permission": "security.read"
      },
      {
        "name": "br_onboard",
        "description": "One-call agent setup. Returns recommended models, relevant tools, configuration, and first-steps guide based on your preferences.",
        "permission": "router.read"
      },
      {
        "name": "br_mesh_execute",
        "description": "Execute a distributed workflow on the mesh. Steps run in parallel when independent, sequential when dependent. Streams SSE progress.",
        "permission": "router.write"
      },
      {
        "name": "br_route_recommend",
        "description": "Delegate model selection to BrainstormRouter intelligence — returns optimal model using Thompson sampling, auto-selection, and cost-quality frontier.",
        "permission": "router.read"
      },
      {
        "name": "br_feedback_report",
        "description": "Report outcome feedback for a model request — feeds Thompson sampling learning loop. Use after task completion to report success/failure/partial.",
        "permission": "router.write"
      },
      {
        "name": "br_trajectory_record",
        "description": "Record an orchestration trajectory — multi-phase agentic workflow with per-phase model, cost, duration, tools, and outcome. Feeds BrainstormLLM training flywheel.",
        "permission": "audit.write"
      },
      {
        "name": "br_trajectory_query",
        "description": "Query orchestration trajectories with filters: project, request_type, source, limit, since. Returns newest first.",
        "permission": "audit.read"
      },
      {
        "name": "br_task_run_report",
        "description": "Report a completed task run with cost, duration, and model used. Feeds telemetry for CLI agent task tracking.",
        "permission": "audit.write"
      },
      {
        "name": "br_project_register",
        "description": "Register or sync a CLI project. Upserts by name with optional path, description, and budget limits.",
        "permission": "config.write"
      },
      {
        "name": "br_memory_blocks_sync",
        "description": "Bulk upsert core memory blocks for a project. Syncs CLAUDE.md, conventions, and other structured knowledge into memory.",
        "permission": "memory.write"
      },
      {
        "name": "br_project_config",
        "description": "Set project configuration: model, budget, guardrails, conventions, protected paths. Use to sync team-wide settings.",
        "permission": "config.write"
      },
      {
        "name": "br_project_activity",
        "description": "View active sessions and recent changes on a project. Shows who is working, what they're doing, and cost so far.",
        "permission": "router.read"
      }
    ]
  },
  "sdks": {
    "typescript": {
      "package": "brainstormrouter",
      "registry": "npm"
    },
    "python": {
      "package": "brainstormrouter",
      "registry": "pypi"
    }
  },
  "providers_supported": [
    "openai",
    "anthropic",
    "google",
    "bedrock",
    "ollama"
  ]
}
