adaptive-memory-multi-model-router 2.14.49 → 2.14.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +82 -0
- package/.env.example +303 -0
- package/.github/DISCUSSIONS_WELCOME.md +27 -0
- package/.github/DISCUSSION_TEMPLATE.yml +5 -0
- package/.github/FUNDING.yml +2 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +94 -0
- package/.github/ISSUE_TEMPLATE/config.yml +17 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +71 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +71 -0
- package/.github/dependabot.yml +9 -0
- package/.github/workflows/auto-publish.yml +51 -0
- package/.github/workflows/ci.yml +263 -0
- package/.github/workflows/codeql.yml +38 -0
- package/.github/workflows/npm-publish.yml +20 -0
- package/.github/workflows/pages.yml +37 -0
- package/.github/workflows/stale.yml +54 -0
- package/.publish-tick +1 -0
- package/.well-known/ai-plugin.json +16 -0
- package/AGENT_COUNCIL_FINDINGS.md +142 -0
- package/ARCHITECTURE.md +346 -0
- package/AUDIT_REPORT.md +28 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +50 -0
- package/CONTRIBUTORS.md +20 -0
- package/Dockerfile +53 -0
- package/Dockerfile.proxy +33 -0
- package/HEALTH_REPORT.md +118 -0
- package/IMPROVEMENT_PLAN.md +107 -0
- package/LANDING.md +43 -0
- package/LAUNCH-PAIN-DRIVEN.md +339 -0
- package/LAUNCH.md +337 -0
- package/LAUNCH_CHECKLIST.md +141 -0
- package/LAUNCH_SNAPSHOT.md +260 -0
- package/MANIFESTO.md +41 -0
- package/POPULARITY_BOOSTERS.md +285 -0
- package/PR_STATUS_REPORT.md +148 -0
- package/README.md +10 -0
- package/REDESIGN.md +95 -0
- package/RUNKIT.md +83 -0
- package/SECURITY.md +29 -0
- package/SUBMISSIONS.md +43 -0
- package/_schema.html +53 -0
- package/ai-plugin.json +16 -0
- package/articles/AI_AGENT_LLM_ROUTING.md +150 -0
- package/articles/CHINESE_DIRECTORIES.md +100 -0
- package/articles/CHINESE_SUBMISSIONS_READY.md +322 -0
- package/articles/COMPETITOR_ALERTS.md +31 -0
- package/articles/COMPLETE_POSTING_DIRECTORY.md +147 -0
- package/articles/CONTENT_STRUCTURE.md +292 -0
- package/articles/DEVTO_COST_GUIDE.md +473 -0
- package/articles/DEVTO_FINAL.md +416 -0
- package/articles/DEVTO_MULTI_PROVIDER.md +542 -0
- package/articles/DEVTO_READY.md +255 -0
- package/articles/DEVTO_V2_ANNOUNCEMENT.md +160 -0
- package/articles/DEVTO_VIRAL_GROWTH.md +280 -0
- package/articles/FRESH_devto.md +460 -0
- package/articles/FRESH_devto_2026_05.md +73 -0
- package/articles/FRESH_hackernews.md +14 -0
- package/articles/FRESH_reddit_ml.md +90 -0
- package/articles/FRESH_reddit_node.md +198 -0
- package/articles/FRESH_reddit_sideproject.md +72 -0
- package/articles/FRESH_reddit_webdev.md +130 -0
- package/articles/FROM_ZERO_TO_10K.md +107 -0
- package/articles/HN_10X_BETTER.md +430 -0
- package/articles/HN_ACCOUNT_GUIDE.md +21 -0
- package/articles/HN_CHINESE_STYLE.md +308 -0
- package/articles/HN_FINAL.md +148 -0
- package/articles/HN_POSTED_VERSION.md +56 -0
- package/articles/HN_POST_READY.md +137 -0
- package/articles/HN_RESEARCH.md +364 -0
- package/articles/HN_SHOW_routerarena.md +17 -0
- package/articles/HN_TIMING_GUIDE.md +52 -0
- package/articles/INDIEHACKERS_POST.md +52 -0
- package/articles/INDIEHACKERS_READY.md +120 -0
- package/articles/LLM_BENCHMARK_DEEP_DIVE.md +153 -0
- package/articles/MASTER_POSTING_DIRECTORY.md +189 -0
- package/articles/NEWSLETTER_SEND_NOW.md +259 -0
- package/articles/NEWSLETTER_SUBMISSIONS.md +112 -0
- package/articles/PAIN-DRIVEN-devto-v2.md +308 -0
- package/articles/PAIN-DRIVEN-devto-v3.md +268 -0
- package/articles/PAIN-DRIVEN-devto.md +242 -0
- package/articles/PAIN-DRIVEN-hackernews-v2.md +138 -0
- package/articles/PAIN-DRIVEN-hackernews-v3.md +151 -0
- package/articles/PAIN-DRIVEN-hackernews.md +131 -0
- package/articles/PAIN-DRIVEN-reddit-v2.md +301 -0
- package/articles/PAIN-DRIVEN-reddit-v3.md +236 -0
- package/articles/PAIN-DRIVEN-reddit.md +218 -0
- package/articles/PAIN-DRIVEN-twitter-v2.md +110 -0
- package/articles/PAIN-DRIVEN-twitter-v3.md +121 -0
- package/articles/PAIN-DRIVEN-twitter.md +120 -0
- package/articles/PORTKEY_VS_A3M.md +147 -0
- package/articles/POSTING_KIT_2026_05.md +67 -0
- package/articles/PRESS_KIT_routerarena.md +77 -0
- package/articles/PRODUCTHUNT_LISTING.md +48 -0
- package/articles/PRODUCTHUNT_READY.md +106 -0
- package/articles/PR_PLAN_vault.md +125 -0
- package/articles/REDDIT_FINAL.md +232 -0
- package/articles/REDDIT_POST.md +67 -0
- package/articles/REDDIT_SUBMISSION_READY.md +348 -0
- package/articles/ROUTERARENA_LEADER.md +45 -0
- package/articles/SHOW_HN_FINAL.md +29 -0
- package/articles/TWEETS_10K_DOWNLOADS.md +47 -0
- package/articles/TWEETS_BENCHMARK_FIRST.md +46 -0
- package/articles/TWEETS_MCP_PLAY.md +51 -0
- package/articles/TWEETS_SEQUENTIAL_BROKEN.md +49 -0
- package/articles/TWEETS_WHY_BUILD.md +54 -0
- package/articles/TWEETS_routerarena_leader.md +53 -0
- package/articles/TWEET_STORM_READY.md +165 -0
- package/articles/TWITTER_FINAL.md +167 -0
- package/articles/WHY_10X_BETTER.md +261 -0
- package/articles/WHY_CHINESE_STYLE_BETTER.md +323 -0
- package/articles/ai-discoverability-llm-routing.md +210 -0
- package/articles/devto-llm-routing.md +138 -0
- package/articles/hackernews-show-hn.md +54 -0
- package/articles/hashnode-llm-cost-optimization.md +125 -0
- package/articles/hn_show_2026_05.md +11 -0
- package/articles/medium-building-llm-router.md +205 -0
- package/articles/reddit-ml.md +76 -0
- package/articles/twitter-thread-cost-savings.md +50 -0
- package/articles/youtube-tutorial-script.md +262 -0
- package/assets/a3m_3blue1brown.mp4 +0 -0
- package/assets/banner.svg +109 -0
- package/assets/chart-cost-v2.svg +91 -0
- package/assets/chart-cost-v3.svg +143 -0
- package/assets/chart-features-v2.svg +132 -0
- package/assets/chart-features-v3.svg +211 -0
- package/assets/chart-growth-v2.svg +122 -0
- package/assets/chart-growth-v3.svg +189 -0
- package/assets/cost-comparison.svg +134 -0
- package/assets/cost-simple.svg +64 -0
- package/assets/demo-hn.gif +0 -0
- package/assets/feature-matrix.svg +136 -0
- package/assets/growth-chart-animated.svg +76 -0
- package/assets/growth-chart.svg +82 -0
- package/assets/growth-simple.svg +69 -0
- package/assets/hero-diagram.svg +81 -0
- package/assets/logo-new.svg +21 -0
- package/assets/logo.svg +68 -0
- package/assets/provider-comparison.svg +121 -0
- package/assets/social-preview-new.svg +100 -0
- package/assets/social-preview.svg +194 -0
- package/assets/social-v2.svg +130 -0
- package/assets/social-v3.svg +212 -0
- package/benchmark-provider-results.json +245 -0
- package/benchmark-results.json +54 -0
- package/council-votes/architecture-vote.md +121 -0
- package/council-votes/coverage-vote.md +93 -0
- package/data/adaptive-benchmark.json +92 -0
- package/data/benchmark-results.json +47 -0
- package/data/labeled-benchmark.json +88 -0
- package/demo/3blue1brown_video.py +285 -0
- package/demo/3blue1brown_video_v2.py +310 -0
- package/demo/IMPROVED_PROMPTS.md +229 -0
- package/demo/VEO3_PROMPTS.md +269 -0
- package/demo/VIDEO_PRODUCTION_GUIDE.md +333 -0
- package/demo/a3m_3blue1brown.mp4 +0 -0
- package/demo/asciinema-demo.sh +195 -0
- package/demo/demo-hn.tape +74 -0
- package/demo/demo-script.md +53 -0
- package/demo/demo-script.sh +62 -0
- package/demo/demo.svg +75 -0
- package/demo/frame1_ai_data_center.png +0 -0
- package/demo/frame1_sunset_video.mp4 +0 -0
- package/demo/frame2_cost_comparison.png +0 -0
- package/demo/frame2_cost_comparison_fallback.png +0 -0
- package/demo/frame3_parallel_execution.png +0 -0
- package/demo/frame3_parallel_execution_fallback.png +0 -0
- package/demo/frame4_providers.png +0 -0
- package/demo/frame4_providers_fallback.png +0 -0
- package/demo/frame5_endcard.png +0 -0
- package/demo/frame5_endcard_fallback.png +0 -0
- package/demo/new_frame1_hook.png +0 -0
- package/demo/new_frame2_proof.png +0 -0
- package/demo/new_frame3_wow.png +0 -0
- package/demo/new_frame4_social.png +0 -0
- package/demo/new_frame5_cta.png +0 -0
- package/demo/package.json +13 -0
- package/demo/product-video-final.mp4 +0 -0
- package/demo/product-video-hype-v1.mp4 +0 -0
- package/demo/product-video-v1.mp4 +0 -0
- package/demo/public/index.html +762 -0
- package/demo/recording.cast +55 -0
- package/demo/server.js +405 -0
- package/demo-new.tape +71 -0
- package/demo-real.sh +198 -0
- package/demo-simple.tape +205 -0
- package/demo.html +520 -0
- package/demo.sh +85 -0
- package/demo.tape +259 -0
- package/dist/analytics/costAnalytics.d.ts.map +1 -0
- package/dist/analytics/costAnalytics.js.map +1 -0
- package/dist/benchmark/comprehensive.js.map +1 -0
- package/dist/benchmark/reproducible.d.ts.map +1 -0
- package/dist/benchmark/reproducible.js.map +1 -0
- package/dist/cache/prefixCache.d.ts.map +1 -0
- package/dist/cache/prefixCache.js.map +1 -0
- package/dist/cache/responseCache.d.ts.map +1 -0
- package/dist/cache/responseCache.js.map +1 -0
- package/dist/cache/semanticCache.d.ts.map +1 -0
- package/dist/cache/semanticCache.js.map +1 -0
- package/dist/cli/setupWizard.d.ts.map +1 -0
- package/dist/cli/setupWizard.js.map +1 -0
- package/dist/cost/budgetEnforcer.d.ts.map +1 -0
- package/dist/cost/budgetEnforcer.js.map +1 -0
- package/dist/cost/costTracker.d.ts.map +1 -0
- package/dist/cost/costTracker.js.map +1 -0
- package/dist/ensemble/multiRoundDialog.js.map +1 -0
- package/dist/ensemble/shapleyValue.js.map +1 -0
- package/dist/integrations/langchainAdapter.d.ts.map +1 -0
- package/dist/integrations/langchainAdapter.js.map +1 -0
- package/dist/integrations/oauth.d.ts.map +1 -0
- package/dist/integrations/oauth.js.map +1 -0
- package/dist/integrations/scienceAdapter.js.map +1 -0
- package/dist/memory/autoFetch.d.ts.map +1 -0
- package/dist/memory/autoFetch.js.map +1 -0
- package/dist/memory/episodicMemory.d.ts.map +1 -0
- package/dist/memory/episodicMemory.js.map +1 -0
- package/dist/memory/hybridMemory.js.map +1 -0
- package/dist/memory/memoryTree.d.ts.map +1 -0
- package/dist/memory/memoryTree.js.map +1 -0
- package/dist/memory/obsidianVault.d.ts.map +1 -0
- package/dist/memory/obsidianVault.js.map +1 -0
- package/dist/memory/reasoningBank.js.map +1 -0
- package/dist/observability/changeWatch.d.ts.map +1 -0
- package/dist/observability/changeWatch.js.map +1 -0
- package/dist/observability/fatigueDetector.d.ts.map +1 -0
- package/dist/observability/fatigueDetector.js.map +1 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/middleware.d.ts.map +1 -0
- package/dist/observability/middleware.js.map +1 -0
- package/dist/observability/tracer.d.ts.map +1 -0
- package/dist/observability/tracer.js.map +1 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/orchestration/haloOrchestrator.d.ts.map +1 -0
- package/dist/orchestration/haloOrchestrator.js.map +1 -0
- package/dist/orchestration/mctsWorkflow.d.ts.map +1 -0
- package/dist/orchestration/mctsWorkflow.js.map +1 -0
- package/dist/providers/localProvider.d.ts.map +1 -0
- package/dist/providers/localProvider.js.map +1 -0
- package/dist/providers/providerConfig.d.ts.map +1 -0
- package/dist/providers/providerConfig.js.map +1 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/routing/advancedRouter.d.ts.map +1 -0
- package/dist/routing/advancedRouter.js +1 -1
- package/dist/routing/advancedRouter.js.map +1 -0
- package/dist/routing/crossModelValidation.d.ts.map +1 -0
- package/dist/routing/crossModelValidation.js.map +1 -0
- package/dist/routing/providerHealth.d.ts.map +1 -0
- package/dist/routing/providerHealth.js.map +1 -0
- package/dist/routing/providerRetry.d.ts.map +1 -0
- package/dist/routing/providerRetry.js.map +1 -0
- package/dist/scripts/banner.js +29 -0
- package/dist/security/guardrails.d.ts.map +1 -0
- package/dist/security/guardrails.js.map +1 -0
- package/dist/server/dashboard.d.ts.map +1 -0
- package/dist/server/dashboard.js.map +1 -0
- package/dist/server/modelMapper.d.ts.map +1 -0
- package/dist/server/modelMapper.js.map +1 -0
- package/dist/server/proxyServer.d.ts.map +1 -0
- package/dist/server/proxyServer.js.map +1 -0
- package/dist/skills/__tests__/skill_manager.test.d.ts +2 -0
- package/dist/skills/__tests__/skill_manager.test.d.ts.map +1 -0
- package/dist/skills/__tests__/skill_manager.test.js +268 -0
- package/dist/skills/__tests__/skill_manager.test.js.map +1 -0
- package/dist/tools/tmlpdTools.d.ts.map +1 -0
- package/dist/tools/tmlpdTools.js.map +1 -0
- package/dist/tui/dashboard.d.ts.map +1 -0
- package/dist/tui/dashboard.js.map +1 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/utils/batchProcessor.d.ts.map +1 -0
- package/dist/utils/batchProcessor.js.map +1 -0
- package/dist/utils/compression.d.ts.map +1 -0
- package/dist/utils/compression.js.map +1 -0
- package/dist/utils/costUtils.d.ts.map +1 -0
- package/dist/utils/costUtils.js.map +1 -0
- package/dist/utils/reliability.d.ts.map +1 -0
- package/dist/utils/reliability.js.map +1 -0
- package/dist/utils/sorting.d.ts.map +1 -0
- package/dist/utils/sorting.js.map +1 -0
- package/dist/utils/speculativeDecoding.d.ts.map +1 -0
- package/dist/utils/speculativeDecoding.js.map +1 -0
- package/dist/utils/tokenUtils.d.ts.map +1 -0
- package/dist/utils/tokenUtils.js.map +1 -0
- package/docs/.nojekyll +0 -0
- package/docs/ANALYSIS_PRINCIPLES.md +162 -0
- package/docs/API.md +855 -0
- package/docs/ARCHITECTURAL-IMPROVEMENTS-2025.md +1391 -0
- package/docs/ARCHITECTURAL-IMPROVEMENTS-REVISED-2025.md +1051 -0
- package/docs/BENCHMARK.md +170 -0
- package/docs/CHINESE_PROVIDER_RELIABILITY.md +37 -0
- package/docs/CITATIONS.md +74 -0
- package/docs/CLAIMS_AND_EVIDENCE.md +58 -0
- package/docs/CONFIGURATION.md +476 -0
- package/docs/COUNCIL_DECISION.json +816 -0
- package/docs/COUNCIL_SUMMARY.md +319 -0
- package/docs/COUNCIL_V2.2_DECISION.md +416 -0
- package/docs/ENGINEERING_SPEC.md +55 -0
- package/docs/FACTORY_RESET.md +34 -0
- package/docs/GEO.md +66 -0
- package/docs/GEO_OPTIMIZATION.md +30 -0
- package/docs/GEO_ROOT_CAUSE.md +136 -0
- package/docs/GEO_STATUS.md +85 -0
- package/docs/GEO_TEST_RESULTS.md +176 -0
- package/docs/HN_CHECKLIST.md +38 -0
- package/docs/HN_FOUNDER_COMMENT.md +17 -0
- package/docs/HN_SUBMISSION_FINAL.md +180 -0
- package/docs/HN_SUBMISSION_V3.md +56 -0
- package/docs/IMPROVEMENT_ROADMAP.md +515 -0
- package/docs/INTEGRATIONS.md +420 -0
- package/docs/LANGCHAIN_INTEGRATION.md +147 -0
- package/docs/LLM_COUNCIL_DECISION.md +508 -0
- package/docs/MIDDLEWARE_CHAIN.md +35 -0
- package/docs/PROMO_CHECKLIST.md +200 -0
- package/docs/QUICKSTART.md +271 -0
- package/docs/QUICK_START.md +43 -0
- package/docs/QUICK_START_VISIBILITY.md +782 -0
- package/docs/REDDIT_GAP_ANALYSIS.md +299 -0
- package/docs/RELEASE_CHECKLIST.md +32 -0
- package/docs/REPRODUCIBILITY.md +63 -0
- package/docs/RESEARCH_BACKED_IMPROVEMENTS.md +1180 -0
- package/docs/ROUTING_RUBRIC.md +197 -0
- package/docs/SEO_AUDIT.md +186 -0
- package/docs/SOCIAL_LISTENING.md +219 -0
- package/docs/TMLPD_QNA.md +751 -0
- package/docs/TMLPD_V2.1_COMPLETE.md +763 -0
- package/docs/TMLPD_V2.2_RESEARCH_ROADMAP.md +754 -0
- package/docs/UPDATE_TOPICS.md +15 -0
- package/docs/USE_CASES.md +59 -0
- package/docs/V2.2_IMPLEMENTATION_COMPLETE.md +446 -0
- package/docs/V2_IMPLEMENTATION_GUIDE.md +388 -0
- package/docs/VERCEL_AI_SDK.md +209 -0
- package/docs/VISIBILITY_ADOPTION_PLAN.md +1005 -0
- package/docs/_config.yml +49 -0
- package/docs/ai-plugin.json +16 -0
- package/docs/api.html +513 -0
- package/docs/architecture-diagram.md +40 -0
- package/docs/benchmark-chart.png +0 -0
- package/docs/benchmark.html +387 -0
- package/docs/blog/routerarena-number-one.html +73 -0
- package/docs/cli-cheatsheet.md +339 -0
- package/docs/compare.md +109 -0
- package/docs/comparison-litellm.md +88 -0
- package/docs/comparison.md +108 -0
- package/docs/cost-chart-ascii.md +42 -0
- package/docs/cost-comparison-chart.svg +88 -0
- package/docs/curl-examples.md +247 -0
- package/docs/demo-auto.html +264 -0
- package/docs/demo.html +416 -0
- package/docs/geo/GENERATIVE_ENGINE_OPTIMIZATION.md +232 -0
- package/docs/index.html +507 -0
- package/docs/launch-content/LAUNCH_EXECUTION_CHECKLIST.md +421 -0
- package/docs/launch-content/README.md +457 -0
- package/docs/launch-content/assets/cost_comparison_100_tasks.png +0 -0
- package/docs/launch-content/assets/cumulative_savings.png +0 -0
- package/docs/launch-content/assets/parallel_speedup.png +0 -0
- package/docs/launch-content/assets/provider_pricing_comparison.png +0 -0
- package/docs/launch-content/assets/task_breakdown_comparison.png +0 -0
- package/docs/launch-content/generate_charts.py +313 -0
- package/docs/launch-content/hn_show_post.md +139 -0
- package/docs/launch-content/partner_outreach_templates.md +745 -0
- package/docs/launch-content/reddit_posts.md +467 -0
- package/docs/launch-content/twitter_thread.txt +460 -0
- package/{llms.txt.bak → docs/llms.txt} +6 -6
- package/docs/npm-downloads-chart.svg +43 -0
- package/docs/openapi.json +139 -0
- package/docs/openapi.yaml +1318 -0
- package/docs/quick-start.html +366 -0
- package/docs/robots.txt +52 -0
- package/docs/sitemap.xml +57 -0
- package/docs/styles.css +682 -0
- package/docs/well-known/ai-plugin.json +16 -0
- package/docs/wellknown/ai-plugin.json +16 -0
- package/docs-site/assets/og-banner.svg +194 -0
- package/docs-site/index.html +632 -0
- package/eval/README.md +46 -0
- package/eval/baselines/main.json +12 -0
- package/eval/benchmark_dataset.jsonl +16 -0
- package/eval/check_golden_routes.js +64 -0
- package/eval/datasets/catalog.json +33 -0
- package/eval/datasets/slices/cn_provider_reliability_v1.jsonl +3 -0
- package/eval/datasets/slices/cost_pressure_v1.jsonl +3 -0
- package/eval/datasets/slices/safety_guardrails_v1.jsonl +3 -0
- package/eval/evals.json +199 -0
- package/eval/fault_injection_thresholds.json +3 -0
- package/eval/generate_report.js +128 -0
- package/eval/golden_routes.json +114 -0
- package/eval/lib/experiment_registry.js +24 -0
- package/eval/run_eval.js +197 -0
- package/eval/run_fault_injection.js +201 -0
- package/eval/run_shadow_eval.js +85 -0
- package/eval/thresholds.json +9 -0
- package/examples/QUICKSTART.md +183 -0
- package/examples/README.md +61 -0
- package/examples/a3m-sdk.js +124 -0
- package/examples/basic-route.js +54 -0
- package/examples/chat-loop.js +202 -0
- package/examples/classify-then-route.js +102 -0
- package/examples/cost-compare.js +120 -0
- package/examples/ensemble.js +160 -0
- package/examples/whatsapp-telegram-bridge-demo.js +302 -0
- package/examples/whatsapp-telegram-bridge.js +269 -0
- package/hf-space/README.md +23 -0
- package/hf-space/app.py +240 -0
- package/hf-space/requirements.txt +1 -0
- package/huggingface_space/README.md +35 -0
- package/huggingface_space/app.py +126 -0
- package/huggingface_space/create_space.py +208 -0
- package/huggingface_space/requirements.txt +1 -0
- package/mcp-server/README.md +188 -0
- package/mcp-server/package.json +29 -0
- package/mcp-server/src/index.ts +744 -0
- package/mcp-server/tsconfig.json +19 -0
- package/openclaw-alexa-bridge/ALL_REMAINING_FIXES_PLAN.md +313 -0
- package/openclaw-alexa-bridge/REMAINING_FIXES_SUMMARY.md +277 -0
- package/openclaw-alexa-bridge/src/alexa_handler_no_tmlpd.js +1234 -0
- package/openclaw-alexa-bridge/test_fixes.js +77 -0
- package/package.json +73 -270
- package/playground/README.md +51 -0
- package/playground/codesandbox.json +12 -0
- package/playground/index.js +39 -0
- package/proxy/README.md +227 -0
- package/proxy/package-lock.json +831 -0
- package/proxy/package.json +17 -0
- package/proxy/rate-limit.js +145 -0
- package/proxy/rate-limit.test.js +311 -0
- package/proxy/server.js +970 -0
- package/python/README.md +102 -0
- package/python/a3m/__init__.py +6 -0
- package/python/a3m/client.py +190 -0
- package/python/a3m/models.py +40 -0
- package/python/a3m/sync_client.py +61 -0
- package/python/examples.py +53 -0
- package/python/integrations.py +330 -0
- package/python/pyproject.toml +23 -0
- package/python/setup.py +28 -0
- package/python/tmlpd.py +369 -0
- package/qna/REDDIT_GAP_ANALYSIS.md +299 -0
- package/qna/TMLPD_QNA.md +751 -0
- package/research/FINDING_001_safety.md +28 -0
- package/research/FINDING_002_error_diversity.md +32 -0
- package/research/FINDING_003_confidence_weighted_voting.md +32 -0
- package/research/FINDING_004_cross_model_semantic_detection.md +37 -0
- package/research/FINDING_005_knowledge_gap_orthogonality.md +34 -0
- package/research/HALLUCINATION_RESEARCH.md +27 -0
- package/research/PUBLISH_LOG.md +3 -0
- package/research/ensemble-voting.md +324 -0
- package/research/loss-functions.md +545 -0
- package/research-log.md +49 -0
- package/scripts/banner.js +29 -0
- package/scripts/benchmark-local-routerarena.ts +176 -0
- package/scripts/benchmark.js +145 -0
- package/scripts/benchmark.sh +61 -0
- package/scripts/compare-providers.sh +230 -0
- package/scripts/content-planner.js +25 -0
- package/scripts/create-labeled-benchmark.ts +105 -0
- package/scripts/cross_post.py +443 -0
- package/scripts/local-router-benchmark.ts +154 -0
- package/scripts/post-all.sh +41 -0
- package/scripts/publish_fcc.py +106 -0
- package/scripts/push-to-gitee.sh +25 -0
- package/scripts/routerarena_ensemble.js +144 -0
- package/scripts/routing-benchmark-v2.js +373 -0
- package/scripts/routing-benchmark-v3.js +118 -0
- package/scripts/routing-benchmark.js +462 -0
- package/scripts/run-labeled-benchmark.mjs +104 -0
- package/scripts/run-mmlu-benchmark.js +176 -0
- package/scripts/run-provider-benchmark.js +244 -0
- package/scripts/update-npm-badges.js +158 -0
- package/skill/SKILL.md +238 -0
- package/src/__tests__/integration/tmpld_integration.test.py +540 -0
- package/src/routing/advancedRouter.ts +1 -1
- package/src/skills/__tests__/skill_manager.test.ts +328 -0
- package/submissions/benchmarks/ALL_PLATFORMS_SUBMISSION.md +94 -0
- package/submissions/benchmarks/LLMROUTERBENCH_SUBMISSION.md +121 -0
- package/submissions/benchmarks/MMRBENCH_SUBMISSION.md +94 -0
- package/submissions/benchmarks/ROUTERARENA_UPDATE.md +83 -0
- package/submissions/benchmarks/ROUTERBENCH_SUBMISSION.md +225 -0
- package/test-council/1-structure-tests.test.js +353 -0
- package/test-council/1-structure-tests.test.ts +353 -0
- package/test-council/2-edge-case-tests.test.ts +361 -0
- package/test-council/3-performance-tests.test.ts +669 -0
- package/test-council/4-integration-tests.test.ts +391 -0
- package/test-council/5-agent-council-eval.test.ts +413 -0
- package/test-council/AGENT_COUNCIL_ARCHITECTURE.md +349 -0
- package/test-council/TEST_COUNCIL_REPORT.md +201 -0
- package/test-council/agents/edge-case-agent.ts +363 -0
- package/test-council/agents/performance-agent.ts +426 -0
- package/test-council/agents/structure-agent.ts +227 -0
- package/test-council/council.md +183 -0
- package/tests/__mocks__/tokenUtils.ts +8 -0
- package/tests/memory/episodicMemory.test.ts +227 -0
- package/tests/package-lock.json +1628 -0
- package/tests/package.json +18 -0
- package/tests/routing/ensembleVoting.test.ts +236 -0
- package/tests/routing/providerRetry.test.ts +360 -0
- package/tests/routing/queryTypePresets.test.ts +208 -0
- package/tests/security/guardrailEngine.test.ts +700 -0
- package/tests/tsconfig.json +21 -0
- package/tests/vitest.config.ts +18 -0
- package/tmlpd-pi-extension/README.md +66 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.d.ts +114 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.js +285 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.js.map +1 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.d.ts +58 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.js +153 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.js.map +1 -0
- package/tmlpd-pi-extension/dist/cli.js +59 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.d.ts +95 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.js +240 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.js.map +1 -0
- package/tmlpd-pi-extension/dist/index.d.ts +723 -0
- package/tmlpd-pi-extension/dist/index.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/index.js +239 -0
- package/tmlpd-pi-extension/dist/index.js.map +1 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.d.ts +82 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.js +145 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.js.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.d.ts +102 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.js +207 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.js.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.d.ts +85 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.js +210 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.js.map +1 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.d.ts +102 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.js +338 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.js.map +1 -0
- package/tmlpd-pi-extension/dist/providers/registry.d.ts +55 -0
- package/tmlpd-pi-extension/dist/providers/registry.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/providers/registry.js +138 -0
- package/tmlpd-pi-extension/dist/providers/registry.js.map +1 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.d.ts +68 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.js +332 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.js.map +1 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.d.ts +101 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.js +368 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.d.ts +96 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.js +170 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/compression.d.ts +61 -0
- package/tmlpd-pi-extension/dist/utils/compression.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/compression.js +281 -0
- package/tmlpd-pi-extension/dist/utils/compression.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/reliability.d.ts +74 -0
- package/tmlpd-pi-extension/dist/utils/reliability.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/reliability.js +177 -0
- package/tmlpd-pi-extension/dist/utils/reliability.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.d.ts +117 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.js +246 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.d.ts +50 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.js +124 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.js.map +1 -0
- package/tmlpd-pi-extension/examples/QUICKSTART.md +183 -0
- package/tmlpd-pi-extension/package-lock.json +79 -0
- package/tmlpd-pi-extension/package.json +172 -0
- package/tmlpd-pi-extension/python/examples.py +53 -0
- package/tmlpd-pi-extension/python/integrations.py +330 -0
- package/tmlpd-pi-extension/python/setup.py +28 -0
- package/tmlpd-pi-extension/python/tmlpd.py +369 -0
- package/tmlpd-pi-extension/qna/REDDIT_GAP_ANALYSIS.md +299 -0
- package/tmlpd-pi-extension/qna/TMLPD_QNA.md +751 -0
- package/tmlpd-pi-extension/skill/SKILL.md +238 -0
- package/tmlpd-pi-extension/src/cache/responseCache.ts +147 -0
- package/tmlpd-pi-extension/src/cost/costTracker.ts +302 -0
- package/tmlpd-pi-extension/src/index.ts +232 -0
- package/tmlpd-pi-extension/src/memory/episodicMemory.ts +257 -0
- package/tmlpd-pi-extension/src/orchestration/haloOrchestrator.ts +266 -0
- package/tmlpd-pi-extension/src/orchestration/mctsWorkflow.ts +262 -0
- package/tmlpd-pi-extension/src/providers/localProvider.ts +406 -0
- package/tmlpd-pi-extension/src/providers/registry.ts +164 -0
- package/tmlpd-pi-extension/src/routing/ensembleVoting.ts +159 -0
- package/tmlpd-pi-extension/src/routing/queryTypePresets.ts +136 -0
- package/tmlpd-pi-extension/src/tools/tmlpdTools.ts +433 -0
- package/tmlpd-pi-extension/src/utils/batchProcessor.ts +232 -0
- package/tmlpd-pi-extension/src/utils/compression.ts +325 -0
- package/tmlpd-pi-extension/src/utils/reliability.ts +221 -0
- package/tmlpd-pi-extension/src/utils/tokenUtils.ts +145 -0
- package/tmlpd-pi-extension/tsconfig.json +18 -0
- package/tsconfig.build.json +29 -0
- package/tsconfig.json +18 -0
- package/README.md.bak +0 -1185
- package/src/routing/advancedRouter.ts.bak +0 -650
- package/test.js.bak +0 -376
- /package/{llms-full.txt.bak → docs/llms-full.txt} +0 -0
|
@@ -0,0 +1,1318 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: A3M Router API
|
|
4
|
+
description: |
|
|
5
|
+
Open-source AI gateway that routes queries across 47+ LLM providers
|
|
6
|
+
with intelligent model selection. Unique differentiator: parallel
|
|
7
|
+
multi-LLM execution with ensemble voting (no competitor does this —
|
|
8
|
+
everyone does sequential fallback).
|
|
9
|
+
|
|
10
|
+
Key features:
|
|
11
|
+
- OpenAI-compatible proxy server (drop-in for any OpenAI SDK)
|
|
12
|
+
- Intelligent routing by query complexity, domain, cost constraints
|
|
13
|
+
- Parallel ensemble execution across multiple providers
|
|
14
|
+
- 47+ baked-in provider definitions (free, cheap, mid, premium, enterprise)
|
|
15
|
+
- Semantic caching, guardrails, cost tracking, observability
|
|
16
|
+
- TUI dashboard, CLI, MCP server, LangChain adapter
|
|
17
|
+
|
|
18
|
+
Version 2.14.0 — 19.5 KB, zero ML dependencies.
|
|
19
|
+
version: 2.14.0
|
|
20
|
+
contact:
|
|
21
|
+
name: GitHub
|
|
22
|
+
url: https://github.com/Das-rebel/a3m-router
|
|
23
|
+
license:
|
|
24
|
+
name: MIT
|
|
25
|
+
url: https://opensource.org/licenses/MIT
|
|
26
|
+
|
|
27
|
+
servers:
|
|
28
|
+
- url: http://localhost:8787
|
|
29
|
+
description: Local proxy server (default port, can be overridden via PORT env)
|
|
30
|
+
- url: https://api.a3m-router.dev
|
|
31
|
+
description: Production deployment (self-hosted)
|
|
32
|
+
|
|
33
|
+
paths:
|
|
34
|
+
# ============================================================
|
|
35
|
+
# CHAT COMPLETIONS
|
|
36
|
+
# ============================================================
|
|
37
|
+
/v1/chat/completions:
|
|
38
|
+
post:
|
|
39
|
+
summary: Create a routed chat completion
|
|
40
|
+
description: |
|
|
41
|
+
OpenAI-compatible chat completions endpoint. Accepts standard OpenAI
|
|
42
|
+
request format. Set model="auto" for intelligent routing, or use
|
|
43
|
+
"provider/model" format (e.g., "groq/llama-3.3-70b-versatile") to
|
|
44
|
+
pin a specific provider.
|
|
45
|
+
|
|
46
|
+
Supports both streaming (SSE) and non-streaming responses. When the
|
|
47
|
+
primary provider fails, automatically falls back through alternative
|
|
48
|
+
configured providers.
|
|
49
|
+
operationId: createChatCompletion
|
|
50
|
+
tags:
|
|
51
|
+
- Completions
|
|
52
|
+
requestBody:
|
|
53
|
+
required: true
|
|
54
|
+
content:
|
|
55
|
+
application/json:
|
|
56
|
+
schema:
|
|
57
|
+
type: object
|
|
58
|
+
required:
|
|
59
|
+
- messages
|
|
60
|
+
properties:
|
|
61
|
+
model:
|
|
62
|
+
type: string
|
|
63
|
+
default: auto
|
|
64
|
+
description: |
|
|
65
|
+
Model or routing mode to use.
|
|
66
|
+
|
|
67
|
+
Special routing values:
|
|
68
|
+
- "auto" — Route based on query complexity (recommended)
|
|
69
|
+
- "free" — Route to free tier only
|
|
70
|
+
- "cheap" — Route to cheap tier only
|
|
71
|
+
|
|
72
|
+
Specific model formats:
|
|
73
|
+
- "provider/model" (e.g., "groq/llama-3.3-70b-versatile")
|
|
74
|
+
- Standard model names map to configured providers
|
|
75
|
+
(e.g., "gpt-4o", "claude-sonnet")
|
|
76
|
+
example: auto
|
|
77
|
+
messages:
|
|
78
|
+
type: array
|
|
79
|
+
description: Array of message objects in OpenAI format
|
|
80
|
+
minItems: 1
|
|
81
|
+
items:
|
|
82
|
+
type: object
|
|
83
|
+
required:
|
|
84
|
+
- role
|
|
85
|
+
- content
|
|
86
|
+
properties:
|
|
87
|
+
role:
|
|
88
|
+
type: string
|
|
89
|
+
enum:
|
|
90
|
+
- system
|
|
91
|
+
- user
|
|
92
|
+
- assistant
|
|
93
|
+
- tool
|
|
94
|
+
description: Message role
|
|
95
|
+
content:
|
|
96
|
+
type: string
|
|
97
|
+
description: Message content
|
|
98
|
+
temperature:
|
|
99
|
+
type: number
|
|
100
|
+
default: null
|
|
101
|
+
description: Sampling temperature (0–2). Provider default if unset.
|
|
102
|
+
minimum: 0
|
|
103
|
+
maximum: 2
|
|
104
|
+
max_tokens:
|
|
105
|
+
type: integer
|
|
106
|
+
default: 1024
|
|
107
|
+
description: Maximum tokens to generate
|
|
108
|
+
minimum: 1
|
|
109
|
+
stream:
|
|
110
|
+
type: boolean
|
|
111
|
+
default: false
|
|
112
|
+
description: |
|
|
113
|
+
If true, send SSE stream of partial completions. Token-by-token
|
|
114
|
+
deltas in OpenAI chat.completion.chunk format.
|
|
115
|
+
top_p:
|
|
116
|
+
type: number
|
|
117
|
+
description: Nucleus sampling parameter
|
|
118
|
+
minimum: 0
|
|
119
|
+
maximum: 1
|
|
120
|
+
frequency_penalty:
|
|
121
|
+
type: number
|
|
122
|
+
description: Frequency penalty (-2 to 2)
|
|
123
|
+
minimum: -2
|
|
124
|
+
maximum: 2
|
|
125
|
+
presence_penalty:
|
|
126
|
+
type: number
|
|
127
|
+
description: Presence penalty (-2 to 2)
|
|
128
|
+
minimum: -2
|
|
129
|
+
maximum: 2
|
|
130
|
+
stop:
|
|
131
|
+
oneOf:
|
|
132
|
+
- type: string
|
|
133
|
+
- type: array
|
|
134
|
+
items:
|
|
135
|
+
type: string
|
|
136
|
+
description: Stop sequence(s)
|
|
137
|
+
n:
|
|
138
|
+
type: integer
|
|
139
|
+
default: 1
|
|
140
|
+
description: Number of completions to generate
|
|
141
|
+
example:
|
|
142
|
+
model: auto
|
|
143
|
+
messages:
|
|
144
|
+
- role: system
|
|
145
|
+
content: You are a helpful assistant.
|
|
146
|
+
- role: user
|
|
147
|
+
content: Write a haiku about Kubernetes
|
|
148
|
+
temperature: 0.7
|
|
149
|
+
max_tokens: 256
|
|
150
|
+
stream: false
|
|
151
|
+
responses:
|
|
152
|
+
"200":
|
|
153
|
+
description: Successful completion (non-streaming)
|
|
154
|
+
content:
|
|
155
|
+
application/json:
|
|
156
|
+
schema:
|
|
157
|
+
type: object
|
|
158
|
+
properties:
|
|
159
|
+
id:
|
|
160
|
+
type: string
|
|
161
|
+
description: Unique completion ID
|
|
162
|
+
example: chatcmpl-a1b2c3d4
|
|
163
|
+
object:
|
|
164
|
+
type: string
|
|
165
|
+
default: chat.completion
|
|
166
|
+
created:
|
|
167
|
+
type: integer
|
|
168
|
+
description: Unix timestamp
|
|
169
|
+
model:
|
|
170
|
+
type: string
|
|
171
|
+
description: Actual model used (resolved via routing)
|
|
172
|
+
example: llama-3.3-70b-versatile
|
|
173
|
+
choices:
|
|
174
|
+
type: array
|
|
175
|
+
items:
|
|
176
|
+
type: object
|
|
177
|
+
properties:
|
|
178
|
+
index:
|
|
179
|
+
type: integer
|
|
180
|
+
message:
|
|
181
|
+
type: object
|
|
182
|
+
properties:
|
|
183
|
+
role:
|
|
184
|
+
type: string
|
|
185
|
+
example: assistant
|
|
186
|
+
content:
|
|
187
|
+
type: string
|
|
188
|
+
example: "Pods drift through the cloud\nOrchestrator hums softly\nContainers at rest"
|
|
189
|
+
finish_reason:
|
|
190
|
+
type: string
|
|
191
|
+
example: stop
|
|
192
|
+
usage:
|
|
193
|
+
type: object
|
|
194
|
+
properties:
|
|
195
|
+
prompt_tokens:
|
|
196
|
+
type: integer
|
|
197
|
+
completion_tokens:
|
|
198
|
+
type: integer
|
|
199
|
+
total_tokens:
|
|
200
|
+
type: integer
|
|
201
|
+
example:
|
|
202
|
+
id: chatcmpl-a1b2c3d4e5f
|
|
203
|
+
object: chat.completion
|
|
204
|
+
created: 1716000000
|
|
205
|
+
model: llama-3.3-70b-versatile
|
|
206
|
+
choices:
|
|
207
|
+
- index: 0
|
|
208
|
+
message:
|
|
209
|
+
role: assistant
|
|
210
|
+
content: "Pods drift through the cloud\nOrchestrator hums softly\nContainers at rest"
|
|
211
|
+
finish_reason: stop
|
|
212
|
+
usage:
|
|
213
|
+
prompt_tokens: 24
|
|
214
|
+
completion_tokens: 15
|
|
215
|
+
total_tokens: 39
|
|
216
|
+
"400":
|
|
217
|
+
description: Invalid request (malformed JSON or missing fields)
|
|
218
|
+
content:
|
|
219
|
+
application/json:
|
|
220
|
+
schema:
|
|
221
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
222
|
+
"502":
|
|
223
|
+
description: Upstream provider error
|
|
224
|
+
content:
|
|
225
|
+
application/json:
|
|
226
|
+
schema:
|
|
227
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
228
|
+
"503":
|
|
229
|
+
description: No providers available (no API keys configured)
|
|
230
|
+
content:
|
|
231
|
+
application/json:
|
|
232
|
+
schema:
|
|
233
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
234
|
+
|
|
235
|
+
# ============================================================
|
|
236
|
+
# TEXT COMPLETIONS
|
|
237
|
+
# ============================================================
|
|
238
|
+
/v1/completions:
|
|
239
|
+
post:
|
|
240
|
+
summary: Create a text completion
|
|
241
|
+
description: |
|
|
242
|
+
OpenAI-compatible text completions endpoint. Converts prompts to
|
|
243
|
+
chat messages internally and routes through A3M.
|
|
244
|
+
|
|
245
|
+
Supports streaming and non-streaming modes.
|
|
246
|
+
operationId: createCompletion
|
|
247
|
+
tags:
|
|
248
|
+
- Completions
|
|
249
|
+
requestBody:
|
|
250
|
+
required: true
|
|
251
|
+
content:
|
|
252
|
+
application/json:
|
|
253
|
+
schema:
|
|
254
|
+
type: object
|
|
255
|
+
required:
|
|
256
|
+
- prompt
|
|
257
|
+
properties:
|
|
258
|
+
model:
|
|
259
|
+
type: string
|
|
260
|
+
default: auto
|
|
261
|
+
description: Model or routing mode (same semantics as /v1/chat/completions)
|
|
262
|
+
prompt:
|
|
263
|
+
oneOf:
|
|
264
|
+
- type: string
|
|
265
|
+
- type: array
|
|
266
|
+
items:
|
|
267
|
+
type: string
|
|
268
|
+
description: Text prompt(s) to complete
|
|
269
|
+
stream:
|
|
270
|
+
type: boolean
|
|
271
|
+
default: false
|
|
272
|
+
description: Enable SSE streaming
|
|
273
|
+
temperature:
|
|
274
|
+
type: number
|
|
275
|
+
minimum: 0
|
|
276
|
+
maximum: 2
|
|
277
|
+
max_tokens:
|
|
278
|
+
type: integer
|
|
279
|
+
default: 1024
|
|
280
|
+
top_p:
|
|
281
|
+
type: number
|
|
282
|
+
echo:
|
|
283
|
+
type: boolean
|
|
284
|
+
default: false
|
|
285
|
+
description: Echo the prompt in the response
|
|
286
|
+
stop:
|
|
287
|
+
oneOf:
|
|
288
|
+
- type: string
|
|
289
|
+
- type: array
|
|
290
|
+
items:
|
|
291
|
+
type: string
|
|
292
|
+
example:
|
|
293
|
+
model: auto
|
|
294
|
+
prompt: "The capital of France is"
|
|
295
|
+
max_tokens: 50
|
|
296
|
+
responses:
|
|
297
|
+
"200":
|
|
298
|
+
description: Successful completion
|
|
299
|
+
content:
|
|
300
|
+
application/json:
|
|
301
|
+
schema:
|
|
302
|
+
type: object
|
|
303
|
+
properties:
|
|
304
|
+
id:
|
|
305
|
+
type: string
|
|
306
|
+
object:
|
|
307
|
+
type: string
|
|
308
|
+
default: text_completion
|
|
309
|
+
created:
|
|
310
|
+
type: integer
|
|
311
|
+
model:
|
|
312
|
+
type: string
|
|
313
|
+
choices:
|
|
314
|
+
type: array
|
|
315
|
+
items:
|
|
316
|
+
type: object
|
|
317
|
+
properties:
|
|
318
|
+
text:
|
|
319
|
+
type: string
|
|
320
|
+
index:
|
|
321
|
+
type: integer
|
|
322
|
+
finish_reason:
|
|
323
|
+
type: string
|
|
324
|
+
usage:
|
|
325
|
+
type: object
|
|
326
|
+
properties:
|
|
327
|
+
prompt_tokens:
|
|
328
|
+
type: integer
|
|
329
|
+
completion_tokens:
|
|
330
|
+
type: integer
|
|
331
|
+
total_tokens:
|
|
332
|
+
type: integer
|
|
333
|
+
example:
|
|
334
|
+
id: chatcmpl-abc123
|
|
335
|
+
object: text_completion
|
|
336
|
+
created: 1716000000
|
|
337
|
+
model: llama-3.3-70b-versatile
|
|
338
|
+
choices:
|
|
339
|
+
- text: " Paris."
|
|
340
|
+
index: 0
|
|
341
|
+
finish_reason: stop
|
|
342
|
+
usage:
|
|
343
|
+
prompt_tokens: 5
|
|
344
|
+
completion_tokens: 2
|
|
345
|
+
total_tokens: 7
|
|
346
|
+
"400":
|
|
347
|
+
description: Invalid request
|
|
348
|
+
content:
|
|
349
|
+
application/json:
|
|
350
|
+
schema:
|
|
351
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
352
|
+
"502":
|
|
353
|
+
description: Upstream provider error
|
|
354
|
+
content:
|
|
355
|
+
application/json:
|
|
356
|
+
schema:
|
|
357
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
358
|
+
|
|
359
|
+
# ============================================================
|
|
360
|
+
# ROUTE (QUERY ANALYSIS)
|
|
361
|
+
# ============================================================
|
|
362
|
+
/v1/route:
|
|
363
|
+
post:
|
|
364
|
+
summary: Route a query without executing it
|
|
365
|
+
description: |
|
|
366
|
+
Analyze a query and return the optimal routing decision —
|
|
367
|
+
model selection, tier, cost estimate, complexity score, and
|
|
368
|
+
fallback alternatives — without calling any LLM provider.
|
|
369
|
+
operationId: routeQuery
|
|
370
|
+
tags:
|
|
371
|
+
- Routing
|
|
372
|
+
requestBody:
|
|
373
|
+
required: true
|
|
374
|
+
content:
|
|
375
|
+
application/json:
|
|
376
|
+
schema:
|
|
377
|
+
type: object
|
|
378
|
+
required:
|
|
379
|
+
- query
|
|
380
|
+
properties:
|
|
381
|
+
query:
|
|
382
|
+
type: string
|
|
383
|
+
description: The query to route
|
|
384
|
+
example: Write a Python function to sort an array
|
|
385
|
+
max_cost:
|
|
386
|
+
type: number
|
|
387
|
+
description: Maximum acceptable cost in USD
|
|
388
|
+
example: 0.001
|
|
389
|
+
preferred_tier:
|
|
390
|
+
type: string
|
|
391
|
+
enum:
|
|
392
|
+
- free
|
|
393
|
+
- cheap
|
|
394
|
+
- mid
|
|
395
|
+
- premium
|
|
396
|
+
description: Constrain routing to a specific cost tier
|
|
397
|
+
example:
|
|
398
|
+
query: Write a Python function to sort an array
|
|
399
|
+
responses:
|
|
400
|
+
"200":
|
|
401
|
+
description: Routing decision
|
|
402
|
+
content:
|
|
403
|
+
application/json:
|
|
404
|
+
schema:
|
|
405
|
+
type: object
|
|
406
|
+
properties:
|
|
407
|
+
primary_model:
|
|
408
|
+
type: string
|
|
409
|
+
description: Selected model identifier
|
|
410
|
+
example: groq/llama-3.3-70b-versatile
|
|
411
|
+
fallback_models:
|
|
412
|
+
type: array
|
|
413
|
+
items:
|
|
414
|
+
type: string
|
|
415
|
+
description: Alternative models in priority order
|
|
416
|
+
example:
|
|
417
|
+
- cerebras/llama-3.3-70b
|
|
418
|
+
- mistral/mistral-small
|
|
419
|
+
confidence:
|
|
420
|
+
type: number
|
|
421
|
+
description: Routing confidence score (0–1)
|
|
422
|
+
example: 0.82
|
|
423
|
+
reasoning:
|
|
424
|
+
type: string
|
|
425
|
+
description: Human-readable explanation of the routing decision
|
|
426
|
+
example: Selected Groq for code detected, fast tier
|
|
427
|
+
estimated_cost:
|
|
428
|
+
type: number
|
|
429
|
+
description: Estimated cost in USD
|
|
430
|
+
example: 0.00035
|
|
431
|
+
estimated_latency_ms:
|
|
432
|
+
type: integer
|
|
433
|
+
description: Estimated time to first token in ms
|
|
434
|
+
example: 800
|
|
435
|
+
features:
|
|
436
|
+
type: object
|
|
437
|
+
description: Query feature breakdown used for routing
|
|
438
|
+
properties:
|
|
439
|
+
complexity:
|
|
440
|
+
type: number
|
|
441
|
+
description: Query complexity score (0.0–1.0)
|
|
442
|
+
example: 0.35
|
|
443
|
+
has_code:
|
|
444
|
+
type: boolean
|
|
445
|
+
description: Code-related keywords detected
|
|
446
|
+
has_math:
|
|
447
|
+
type: boolean
|
|
448
|
+
description: Mathematical expression detected
|
|
449
|
+
is_multilingual:
|
|
450
|
+
type: boolean
|
|
451
|
+
description: Non-ASCII characters detected
|
|
452
|
+
is_translation:
|
|
453
|
+
type: boolean
|
|
454
|
+
description: Translation request detected
|
|
455
|
+
is_creative:
|
|
456
|
+
type: boolean
|
|
457
|
+
description: Creative writing request
|
|
458
|
+
requires_reasoning:
|
|
459
|
+
type: boolean
|
|
460
|
+
description: Analytical/reasoning verbs detected
|
|
461
|
+
is_security:
|
|
462
|
+
type: boolean
|
|
463
|
+
description: Security domain keywords
|
|
464
|
+
is_devops:
|
|
465
|
+
type: boolean
|
|
466
|
+
description: DevOps/infrastructure keywords
|
|
467
|
+
is_data:
|
|
468
|
+
type: boolean
|
|
469
|
+
description: Data/ML keywords
|
|
470
|
+
detected_domain:
|
|
471
|
+
type: string
|
|
472
|
+
description: Best matching domain
|
|
473
|
+
enum:
|
|
474
|
+
- legal
|
|
475
|
+
- medical
|
|
476
|
+
- finance
|
|
477
|
+
- security
|
|
478
|
+
- architecture
|
|
479
|
+
- ml_research
|
|
480
|
+
- devops
|
|
481
|
+
- data
|
|
482
|
+
example: ""
|
|
483
|
+
domain_score:
|
|
484
|
+
type: number
|
|
485
|
+
description: Domain match confidence (0.0–1.0)
|
|
486
|
+
tier:
|
|
487
|
+
type: string
|
|
488
|
+
enum:
|
|
489
|
+
- free
|
|
490
|
+
- cheap
|
|
491
|
+
- mid
|
|
492
|
+
- premium
|
|
493
|
+
description: Selected cost tier
|
|
494
|
+
example:
|
|
495
|
+
primary_model: groq/llama-3.3-70b-versatile
|
|
496
|
+
fallback_models:
|
|
497
|
+
- cerebras/llama-3.3-70b
|
|
498
|
+
- mistral/mistral-small
|
|
499
|
+
confidence: 0.82
|
|
500
|
+
reasoning: Selected Groq for code detected, fast tier
|
|
501
|
+
estimated_cost: 0.00035
|
|
502
|
+
estimated_latency_ms: 800
|
|
503
|
+
features:
|
|
504
|
+
complexity: 0.35
|
|
505
|
+
has_code: true
|
|
506
|
+
has_math: false
|
|
507
|
+
requires_reasoning: false
|
|
508
|
+
detected_domain: ""
|
|
509
|
+
tier: cheap
|
|
510
|
+
|
|
511
|
+
# ============================================================
|
|
512
|
+
# LIST MODELS
|
|
513
|
+
# ============================================================
|
|
514
|
+
/v1/models:
|
|
515
|
+
get:
|
|
516
|
+
summary: List available models
|
|
517
|
+
description: |
|
|
518
|
+
Returns all available models across all configured providers,
|
|
519
|
+
organized as an OpenAI-compatible model list.
|
|
520
|
+
operationId: listModels
|
|
521
|
+
tags:
|
|
522
|
+
- Models
|
|
523
|
+
responses:
|
|
524
|
+
"200":
|
|
525
|
+
description: List of available models
|
|
526
|
+
content:
|
|
527
|
+
application/json:
|
|
528
|
+
schema:
|
|
529
|
+
type: object
|
|
530
|
+
properties:
|
|
531
|
+
object:
|
|
532
|
+
type: string
|
|
533
|
+
default: list
|
|
534
|
+
data:
|
|
535
|
+
type: array
|
|
536
|
+
items:
|
|
537
|
+
type: object
|
|
538
|
+
properties:
|
|
539
|
+
id:
|
|
540
|
+
type: string
|
|
541
|
+
description: Model identifier (provider/model format)
|
|
542
|
+
example: groq/llama-3.3-70b-versatile
|
|
543
|
+
object:
|
|
544
|
+
type: string
|
|
545
|
+
default: model
|
|
546
|
+
owned_by:
|
|
547
|
+
type: string
|
|
548
|
+
description: Provider name
|
|
549
|
+
example: groq
|
|
550
|
+
example:
|
|
551
|
+
object: list
|
|
552
|
+
data:
|
|
553
|
+
- id: groq/llama-3.3-70b-versatile
|
|
554
|
+
object: model
|
|
555
|
+
owned_by: groq
|
|
556
|
+
- id: groq/llama-3.1-8b-instant
|
|
557
|
+
object: model
|
|
558
|
+
owned_by: groq
|
|
559
|
+
- id: cerebras/llama-3.3-70b
|
|
560
|
+
object: model
|
|
561
|
+
owned_by: cerebras
|
|
562
|
+
- id: openai/gpt-4o-mini
|
|
563
|
+
object: model
|
|
564
|
+
owned_by: openai
|
|
565
|
+
|
|
566
|
+
# ============================================================
|
|
567
|
+
# HEALTH
|
|
568
|
+
# ============================================================
|
|
569
|
+
/health:
|
|
570
|
+
get:
|
|
571
|
+
summary: Health check
|
|
572
|
+
description: |
|
|
573
|
+
Returns server health status, configured provider details,
|
|
574
|
+
cost summary, and recent request log.
|
|
575
|
+
operationId: healthCheck
|
|
576
|
+
tags:
|
|
577
|
+
- Monitoring
|
|
578
|
+
responses:
|
|
579
|
+
"200":
|
|
580
|
+
description: Service health information
|
|
581
|
+
content:
|
|
582
|
+
application/json:
|
|
583
|
+
schema:
|
|
584
|
+
type: object
|
|
585
|
+
properties:
|
|
586
|
+
status:
|
|
587
|
+
type: string
|
|
588
|
+
example: ok
|
|
589
|
+
version:
|
|
590
|
+
type: string
|
|
591
|
+
description: A3M Router version
|
|
592
|
+
example: 2.14.0
|
|
593
|
+
providers:
|
|
594
|
+
type: object
|
|
595
|
+
properties:
|
|
596
|
+
total:
|
|
597
|
+
type: integer
|
|
598
|
+
description: Total configured providers
|
|
599
|
+
healthy:
|
|
600
|
+
type: integer
|
|
601
|
+
description: Providers with API keys available
|
|
602
|
+
details:
|
|
603
|
+
type: object
|
|
604
|
+
description: Per-provider status map
|
|
605
|
+
additionalProperties:
|
|
606
|
+
type: object
|
|
607
|
+
properties:
|
|
608
|
+
name:
|
|
609
|
+
type: string
|
|
610
|
+
type:
|
|
611
|
+
type: string
|
|
612
|
+
enum:
|
|
613
|
+
- api
|
|
614
|
+
- cli
|
|
615
|
+
- local
|
|
616
|
+
models:
|
|
617
|
+
type: integer
|
|
618
|
+
available:
|
|
619
|
+
type: boolean
|
|
620
|
+
cost:
|
|
621
|
+
type: object
|
|
622
|
+
properties:
|
|
623
|
+
total:
|
|
624
|
+
type: number
|
|
625
|
+
description: Total cost tracked in USD
|
|
626
|
+
requests:
|
|
627
|
+
type: integer
|
|
628
|
+
description: Total requests tracked
|
|
629
|
+
uptime:
|
|
630
|
+
type: number
|
|
631
|
+
description: Server uptime in seconds
|
|
632
|
+
recentRequests:
|
|
633
|
+
type: array
|
|
634
|
+
description: Last 20 request logs
|
|
635
|
+
items:
|
|
636
|
+
type: object
|
|
637
|
+
properties:
|
|
638
|
+
id:
|
|
639
|
+
type: string
|
|
640
|
+
model:
|
|
641
|
+
type: string
|
|
642
|
+
resolvedProvider:
|
|
643
|
+
type: string
|
|
644
|
+
resolvedModel:
|
|
645
|
+
type: string
|
|
646
|
+
latencyMs:
|
|
647
|
+
type: integer
|
|
648
|
+
tokensIn:
|
|
649
|
+
type: integer
|
|
650
|
+
tokensOut:
|
|
651
|
+
type: integer
|
|
652
|
+
cost:
|
|
653
|
+
type: number
|
|
654
|
+
status:
|
|
655
|
+
type: string
|
|
656
|
+
enum:
|
|
657
|
+
- success
|
|
658
|
+
- error
|
|
659
|
+
error:
|
|
660
|
+
type: string
|
|
661
|
+
timestamp:
|
|
662
|
+
type: integer
|
|
663
|
+
example:
|
|
664
|
+
status: ok
|
|
665
|
+
version: 2.14.0
|
|
666
|
+
providers:
|
|
667
|
+
total: 12
|
|
668
|
+
healthy: 8
|
|
669
|
+
details:
|
|
670
|
+
groq:
|
|
671
|
+
name: Groq
|
|
672
|
+
type: api
|
|
673
|
+
models: 3
|
|
674
|
+
available: true
|
|
675
|
+
openai:
|
|
676
|
+
name: OpenAI
|
|
677
|
+
type: api
|
|
678
|
+
models: 2
|
|
679
|
+
available: false
|
|
680
|
+
cost:
|
|
681
|
+
total: 0.0042
|
|
682
|
+
requests: 127
|
|
683
|
+
uptime: 86400.5
|
|
684
|
+
recentRequests: []
|
|
685
|
+
|
|
686
|
+
# ============================================================
|
|
687
|
+
# DASHBOARD (HTML)
|
|
688
|
+
# ============================================================
|
|
689
|
+
/dashboard:
|
|
690
|
+
get:
|
|
691
|
+
summary: Interactive web dashboard
|
|
692
|
+
description: |
|
|
693
|
+
Returns the A3M Router dashboard HTML page — a full monitoring
|
|
694
|
+
UI with dark hacker aesthetic. Shows live provider status,
|
|
695
|
+
request logs, cost breakdown, and latency metrics. Auto-refreshes
|
|
696
|
+
every 5 seconds. The root path (GET /) also serves this page.
|
|
697
|
+
operationId: getDashboard
|
|
698
|
+
tags:
|
|
699
|
+
- Monitoring
|
|
700
|
+
responses:
|
|
701
|
+
"200":
|
|
702
|
+
description: Dashboard HTML page
|
|
703
|
+
content:
|
|
704
|
+
text/html:
|
|
705
|
+
schema:
|
|
706
|
+
type: string
|
|
707
|
+
description: Inline HTML/CSS/JS dashboard
|
|
708
|
+
|
|
709
|
+
# ============================================================
|
|
710
|
+
# DASHBOARD API: Stats
|
|
711
|
+
# ============================================================
|
|
712
|
+
/api/stats:
|
|
713
|
+
get:
|
|
714
|
+
summary: Dashboard statistics
|
|
715
|
+
description: |
|
|
716
|
+
Returns real-time aggregated statistics for the dashboard: total
|
|
717
|
+
requests, costs, latency averages, provider status, and recent
|
|
718
|
+
request history.
|
|
719
|
+
operationId: getDashboardStats
|
|
720
|
+
tags:
|
|
721
|
+
- Monitoring
|
|
722
|
+
responses:
|
|
723
|
+
"200":
|
|
724
|
+
description: Dashboard stats snapshot
|
|
725
|
+
content:
|
|
726
|
+
application/json:
|
|
727
|
+
schema:
|
|
728
|
+
type: object
|
|
729
|
+
properties:
|
|
730
|
+
totalRequestsToday:
|
|
731
|
+
type: integer
|
|
732
|
+
description: Total requests since midnight
|
|
733
|
+
totalCostToday:
|
|
734
|
+
type: number
|
|
735
|
+
description: Total cost since midnight in USD
|
|
736
|
+
avgLatency:
|
|
737
|
+
type: number
|
|
738
|
+
description: Average latency across all providers in ms
|
|
739
|
+
activeProviders:
|
|
740
|
+
type: integer
|
|
741
|
+
description: Number of providers with online status
|
|
742
|
+
totalProviders:
|
|
743
|
+
type: integer
|
|
744
|
+
description: Total configured providers
|
|
745
|
+
providers:
|
|
746
|
+
type: array
|
|
747
|
+
items:
|
|
748
|
+
type: object
|
|
749
|
+
properties:
|
|
750
|
+
id:
|
|
751
|
+
type: string
|
|
752
|
+
name:
|
|
753
|
+
type: string
|
|
754
|
+
status:
|
|
755
|
+
type: string
|
|
756
|
+
enum:
|
|
757
|
+
- online
|
|
758
|
+
- offline
|
|
759
|
+
requestsToday:
|
|
760
|
+
type: integer
|
|
761
|
+
costToday:
|
|
762
|
+
type: number
|
|
763
|
+
avgLatency:
|
|
764
|
+
type: number
|
|
765
|
+
lastError:
|
|
766
|
+
type: string
|
|
767
|
+
nullable: true
|
|
768
|
+
lastErrorTime:
|
|
769
|
+
type: integer
|
|
770
|
+
nullable: true
|
|
771
|
+
recentRequests:
|
|
772
|
+
type: array
|
|
773
|
+
items:
|
|
774
|
+
type: object
|
|
775
|
+
properties:
|
|
776
|
+
timestamp:
|
|
777
|
+
type: integer
|
|
778
|
+
query:
|
|
779
|
+
type: string
|
|
780
|
+
provider:
|
|
781
|
+
type: string
|
|
782
|
+
model:
|
|
783
|
+
type: string
|
|
784
|
+
latency:
|
|
785
|
+
type: integer
|
|
786
|
+
cost:
|
|
787
|
+
type: number
|
|
788
|
+
status:
|
|
789
|
+
type: string
|
|
790
|
+
enum:
|
|
791
|
+
- success
|
|
792
|
+
- error
|
|
793
|
+
error:
|
|
794
|
+
type: string
|
|
795
|
+
tokens:
|
|
796
|
+
type: object
|
|
797
|
+
properties:
|
|
798
|
+
input:
|
|
799
|
+
type: integer
|
|
800
|
+
output:
|
|
801
|
+
type: integer
|
|
802
|
+
costByProvider:
|
|
803
|
+
type: object
|
|
804
|
+
description: Per-provider cost breakdown
|
|
805
|
+
additionalProperties:
|
|
806
|
+
type: number
|
|
807
|
+
uptime:
|
|
808
|
+
type: number
|
|
809
|
+
description: Server uptime in ms
|
|
810
|
+
|
|
811
|
+
# ============================================================
|
|
812
|
+
# DASHBOARD API: Providers
|
|
813
|
+
# ============================================================
|
|
814
|
+
/api/providers:
|
|
815
|
+
get:
|
|
816
|
+
summary: Provider status list
|
|
817
|
+
description: |
|
|
818
|
+
Returns per-provider statistics for the dashboard: request counts,
|
|
819
|
+
costs, latency, and error status.
|
|
820
|
+
operationId: getDashboardProviders
|
|
821
|
+
tags:
|
|
822
|
+
- Monitoring
|
|
823
|
+
responses:
|
|
824
|
+
"200":
|
|
825
|
+
description: Provider stats array
|
|
826
|
+
content:
|
|
827
|
+
application/json:
|
|
828
|
+
schema:
|
|
829
|
+
type: array
|
|
830
|
+
items:
|
|
831
|
+
type: object
|
|
832
|
+
properties:
|
|
833
|
+
id:
|
|
834
|
+
type: string
|
|
835
|
+
name:
|
|
836
|
+
type: string
|
|
837
|
+
status:
|
|
838
|
+
type: string
|
|
839
|
+
enum:
|
|
840
|
+
- online
|
|
841
|
+
- offline
|
|
842
|
+
requestsToday:
|
|
843
|
+
type: integer
|
|
844
|
+
costToday:
|
|
845
|
+
type: number
|
|
846
|
+
avgLatency:
|
|
847
|
+
type: number
|
|
848
|
+
lastError:
|
|
849
|
+
type: string
|
|
850
|
+
nullable: true
|
|
851
|
+
lastErrorTime:
|
|
852
|
+
type: integer
|
|
853
|
+
nullable: true
|
|
854
|
+
|
|
855
|
+
# ============================================================
|
|
856
|
+
# DASHBOARD API: Requests
|
|
857
|
+
# ============================================================
|
|
858
|
+
/api/requests:
|
|
859
|
+
get:
|
|
860
|
+
summary: Recent request log
|
|
861
|
+
description: |
|
|
862
|
+
Returns the recent requests log for the dashboard.
|
|
863
|
+
operationId: getDashboardRequests
|
|
864
|
+
tags:
|
|
865
|
+
- Monitoring
|
|
866
|
+
responses:
|
|
867
|
+
"200":
|
|
868
|
+
description: Recent request entries
|
|
869
|
+
content:
|
|
870
|
+
application/json:
|
|
871
|
+
schema:
|
|
872
|
+
type: array
|
|
873
|
+
items:
|
|
874
|
+
type: object
|
|
875
|
+
properties:
|
|
876
|
+
timestamp:
|
|
877
|
+
type: integer
|
|
878
|
+
query:
|
|
879
|
+
type: string
|
|
880
|
+
provider:
|
|
881
|
+
type: string
|
|
882
|
+
model:
|
|
883
|
+
type: string
|
|
884
|
+
latency:
|
|
885
|
+
type: integer
|
|
886
|
+
cost:
|
|
887
|
+
type: number
|
|
888
|
+
status:
|
|
889
|
+
type: string
|
|
890
|
+
enum:
|
|
891
|
+
- success
|
|
892
|
+
- error
|
|
893
|
+
error:
|
|
894
|
+
type: string
|
|
895
|
+
tokens:
|
|
896
|
+
type: object
|
|
897
|
+
properties:
|
|
898
|
+
input:
|
|
899
|
+
type: integer
|
|
900
|
+
output:
|
|
901
|
+
type: integer
|
|
902
|
+
|
|
903
|
+
# ============================================================
|
|
904
|
+
# DASHBOARD API: Clear
|
|
905
|
+
# ============================================================
|
|
906
|
+
/api/clear:
|
|
907
|
+
post:
|
|
908
|
+
summary: Clear dashboard logs
|
|
909
|
+
description: |
|
|
910
|
+
Clears all dashboard statistics and recent request logs.
|
|
911
|
+
Resets per-provider request counts and cost totals.
|
|
912
|
+
operationId: clearDashboard
|
|
913
|
+
tags:
|
|
914
|
+
- Monitoring
|
|
915
|
+
responses:
|
|
916
|
+
"200":
|
|
917
|
+
description: Dashboard cleared
|
|
918
|
+
content:
|
|
919
|
+
application/json:
|
|
920
|
+
schema:
|
|
921
|
+
type: object
|
|
922
|
+
properties:
|
|
923
|
+
ok:
|
|
924
|
+
type: boolean
|
|
925
|
+
default: true
|
|
926
|
+
message:
|
|
927
|
+
type: string
|
|
928
|
+
example: Dashboard cleared
|
|
929
|
+
|
|
930
|
+
components:
|
|
931
|
+
schemas:
|
|
932
|
+
ErrorResponse:
|
|
933
|
+
type: object
|
|
934
|
+
description: Standard error response (OpenAI-compatible format)
|
|
935
|
+
properties:
|
|
936
|
+
error:
|
|
937
|
+
type: object
|
|
938
|
+
properties:
|
|
939
|
+
message:
|
|
940
|
+
type: string
|
|
941
|
+
description: Human-readable error description
|
|
942
|
+
type:
|
|
943
|
+
type: string
|
|
944
|
+
description: Error type identifier
|
|
945
|
+
enum:
|
|
946
|
+
- invalid_request_error
|
|
947
|
+
- not_found
|
|
948
|
+
- upstream_error
|
|
949
|
+
- server_error
|
|
950
|
+
code:
|
|
951
|
+
type: integer
|
|
952
|
+
description: HTTP status code
|
|
953
|
+
required:
|
|
954
|
+
- message
|
|
955
|
+
- type
|
|
956
|
+
- code
|
|
957
|
+
|
|
958
|
+
RoutingResult:
|
|
959
|
+
type: object
|
|
960
|
+
description: Result of a query routing decision
|
|
961
|
+
properties:
|
|
962
|
+
model:
|
|
963
|
+
type: string
|
|
964
|
+
description: Selected model identifier (provider/model format)
|
|
965
|
+
example: groq/llama-3.3-70b-versatile
|
|
966
|
+
tier:
|
|
967
|
+
type: string
|
|
968
|
+
enum:
|
|
969
|
+
- free
|
|
970
|
+
- cheap
|
|
971
|
+
- mid
|
|
972
|
+
- premium
|
|
973
|
+
description: Selected cost tier
|
|
974
|
+
cost:
|
|
975
|
+
type: number
|
|
976
|
+
description: Estimated cost in USD
|
|
977
|
+
example: 0.00035
|
|
978
|
+
complexity:
|
|
979
|
+
type: number
|
|
980
|
+
description: Query complexity score (0.0–1.0)
|
|
981
|
+
reasoning:
|
|
982
|
+
type: string
|
|
983
|
+
description: Human-readable explanation
|
|
984
|
+
fallbackModels:
|
|
985
|
+
type: array
|
|
986
|
+
items:
|
|
987
|
+
type: string
|
|
988
|
+
description: Alternative models in priority order
|
|
989
|
+
isFree:
|
|
990
|
+
type: boolean
|
|
991
|
+
description: Whether the selected model is free
|
|
992
|
+
isExpert:
|
|
993
|
+
type: boolean
|
|
994
|
+
description: Whether this is an expert-level query
|
|
995
|
+
|
|
996
|
+
QueryFeatures:
|
|
997
|
+
type: object
|
|
998
|
+
description: Query feature breakdown used for routing classification
|
|
999
|
+
properties:
|
|
1000
|
+
complexity:
|
|
1001
|
+
type: number
|
|
1002
|
+
description: Overall complexity score (0.0–1.0)
|
|
1003
|
+
length:
|
|
1004
|
+
type: integer
|
|
1005
|
+
description: Word count
|
|
1006
|
+
has_code:
|
|
1007
|
+
type: boolean
|
|
1008
|
+
description: Code-related keywords detected
|
|
1009
|
+
has_math:
|
|
1010
|
+
type: boolean
|
|
1011
|
+
description: Math-related keywords detected
|
|
1012
|
+
is_multilingual:
|
|
1013
|
+
type: boolean
|
|
1014
|
+
description: Non-ASCII characters detected
|
|
1015
|
+
is_translation:
|
|
1016
|
+
type: boolean
|
|
1017
|
+
description: Translation request detected
|
|
1018
|
+
is_creative:
|
|
1019
|
+
type: boolean
|
|
1020
|
+
description: Creative writing request
|
|
1021
|
+
requires_reasoning:
|
|
1022
|
+
type: boolean
|
|
1023
|
+
description: Analytical/reasoning verbs detected
|
|
1024
|
+
is_security:
|
|
1025
|
+
type: boolean
|
|
1026
|
+
description: Security domain keywords
|
|
1027
|
+
is_devops:
|
|
1028
|
+
type: boolean
|
|
1029
|
+
description: DevOps/infrastructure keywords
|
|
1030
|
+
is_data:
|
|
1031
|
+
type: boolean
|
|
1032
|
+
description: Data/ML keywords
|
|
1033
|
+
detected_domain:
|
|
1034
|
+
type: string
|
|
1035
|
+
description: Best matching domain
|
|
1036
|
+
enum:
|
|
1037
|
+
- legal
|
|
1038
|
+
- medical
|
|
1039
|
+
- finance
|
|
1040
|
+
- security
|
|
1041
|
+
- architecture
|
|
1042
|
+
- ml_research
|
|
1043
|
+
- devops
|
|
1044
|
+
- data
|
|
1045
|
+
domain_score:
|
|
1046
|
+
type: number
|
|
1047
|
+
description: Domain match confidence (0.0–1.0)
|
|
1048
|
+
|
|
1049
|
+
ChatCompletionRequest:
|
|
1050
|
+
type: object
|
|
1051
|
+
required:
|
|
1052
|
+
- messages
|
|
1053
|
+
properties:
|
|
1054
|
+
model:
|
|
1055
|
+
type: string
|
|
1056
|
+
default: auto
|
|
1057
|
+
messages:
|
|
1058
|
+
type: array
|
|
1059
|
+
items:
|
|
1060
|
+
$ref: "#/components/schemas/ChatMessage"
|
|
1061
|
+
temperature:
|
|
1062
|
+
type: number
|
|
1063
|
+
max_tokens:
|
|
1064
|
+
type: integer
|
|
1065
|
+
default: 1024
|
|
1066
|
+
stream:
|
|
1067
|
+
type: boolean
|
|
1068
|
+
default: false
|
|
1069
|
+
top_p:
|
|
1070
|
+
type: number
|
|
1071
|
+
frequency_penalty:
|
|
1072
|
+
type: number
|
|
1073
|
+
presence_penalty:
|
|
1074
|
+
type: number
|
|
1075
|
+
stop:
|
|
1076
|
+
oneOf:
|
|
1077
|
+
- type: string
|
|
1078
|
+
- type: array
|
|
1079
|
+
items:
|
|
1080
|
+
type: string
|
|
1081
|
+
|
|
1082
|
+
ChatMessage:
|
|
1083
|
+
type: object
|
|
1084
|
+
required:
|
|
1085
|
+
- role
|
|
1086
|
+
- content
|
|
1087
|
+
properties:
|
|
1088
|
+
role:
|
|
1089
|
+
type: string
|
|
1090
|
+
enum:
|
|
1091
|
+
- system
|
|
1092
|
+
- user
|
|
1093
|
+
- assistant
|
|
1094
|
+
- tool
|
|
1095
|
+
content:
|
|
1096
|
+
type: string
|
|
1097
|
+
|
|
1098
|
+
ChatCompletionResponse:
|
|
1099
|
+
type: object
|
|
1100
|
+
properties:
|
|
1101
|
+
id:
|
|
1102
|
+
type: string
|
|
1103
|
+
object:
|
|
1104
|
+
type: string
|
|
1105
|
+
default: chat.completion
|
|
1106
|
+
created:
|
|
1107
|
+
type: integer
|
|
1108
|
+
model:
|
|
1109
|
+
type: string
|
|
1110
|
+
choices:
|
|
1111
|
+
type: array
|
|
1112
|
+
items:
|
|
1113
|
+
type: object
|
|
1114
|
+
properties:
|
|
1115
|
+
index:
|
|
1116
|
+
type: integer
|
|
1117
|
+
message:
|
|
1118
|
+
type: object
|
|
1119
|
+
properties:
|
|
1120
|
+
role:
|
|
1121
|
+
type: string
|
|
1122
|
+
content:
|
|
1123
|
+
type: string
|
|
1124
|
+
finish_reason:
|
|
1125
|
+
type: string
|
|
1126
|
+
usage:
|
|
1127
|
+
type: object
|
|
1128
|
+
properties:
|
|
1129
|
+
prompt_tokens:
|
|
1130
|
+
type: integer
|
|
1131
|
+
completion_tokens:
|
|
1132
|
+
type: integer
|
|
1133
|
+
total_tokens:
|
|
1134
|
+
type: integer
|
|
1135
|
+
|
|
1136
|
+
StreamingChunk:
|
|
1137
|
+
type: object
|
|
1138
|
+
description: SSE streaming chunk (chat.completion.chunk format)
|
|
1139
|
+
properties:
|
|
1140
|
+
id:
|
|
1141
|
+
type: string
|
|
1142
|
+
object:
|
|
1143
|
+
type: string
|
|
1144
|
+
default: chat.completion.chunk
|
|
1145
|
+
created:
|
|
1146
|
+
type: integer
|
|
1147
|
+
model:
|
|
1148
|
+
type: string
|
|
1149
|
+
choices:
|
|
1150
|
+
type: array
|
|
1151
|
+
items:
|
|
1152
|
+
type: object
|
|
1153
|
+
properties:
|
|
1154
|
+
index:
|
|
1155
|
+
type: integer
|
|
1156
|
+
delta:
|
|
1157
|
+
type: object
|
|
1158
|
+
properties:
|
|
1159
|
+
content:
|
|
1160
|
+
type: string
|
|
1161
|
+
role:
|
|
1162
|
+
type: string
|
|
1163
|
+
finish_reason:
|
|
1164
|
+
type: string
|
|
1165
|
+
nullable: true
|
|
1166
|
+
|
|
1167
|
+
DashboardStats:
|
|
1168
|
+
type: object
|
|
1169
|
+
properties:
|
|
1170
|
+
totalRequestsToday:
|
|
1171
|
+
type: integer
|
|
1172
|
+
totalCostToday:
|
|
1173
|
+
type: number
|
|
1174
|
+
avgLatency:
|
|
1175
|
+
type: number
|
|
1176
|
+
activeProviders:
|
|
1177
|
+
type: integer
|
|
1178
|
+
totalProviders:
|
|
1179
|
+
type: integer
|
|
1180
|
+
providers:
|
|
1181
|
+
type: array
|
|
1182
|
+
items:
|
|
1183
|
+
$ref: "#/components/schemas/ProviderStat"
|
|
1184
|
+
recentRequests:
|
|
1185
|
+
type: array
|
|
1186
|
+
items:
|
|
1187
|
+
$ref: "#/components/schemas/RequestEntry"
|
|
1188
|
+
costByProvider:
|
|
1189
|
+
type: object
|
|
1190
|
+
additionalProperties:
|
|
1191
|
+
type: number
|
|
1192
|
+
uptime:
|
|
1193
|
+
type: number
|
|
1194
|
+
|
|
1195
|
+
ProviderStat:
|
|
1196
|
+
type: object
|
|
1197
|
+
properties:
|
|
1198
|
+
id:
|
|
1199
|
+
type: string
|
|
1200
|
+
name:
|
|
1201
|
+
type: string
|
|
1202
|
+
status:
|
|
1203
|
+
type: string
|
|
1204
|
+
enum:
|
|
1205
|
+
- online
|
|
1206
|
+
- offline
|
|
1207
|
+
requestsToday:
|
|
1208
|
+
type: integer
|
|
1209
|
+
costToday:
|
|
1210
|
+
type: number
|
|
1211
|
+
avgLatency:
|
|
1212
|
+
type: number
|
|
1213
|
+
lastError:
|
|
1214
|
+
type: string
|
|
1215
|
+
nullable: true
|
|
1216
|
+
lastErrorTime:
|
|
1217
|
+
type: integer
|
|
1218
|
+
nullable: true
|
|
1219
|
+
|
|
1220
|
+
RequestEntry:
|
|
1221
|
+
type: object
|
|
1222
|
+
properties:
|
|
1223
|
+
timestamp:
|
|
1224
|
+
type: integer
|
|
1225
|
+
query:
|
|
1226
|
+
type: string
|
|
1227
|
+
provider:
|
|
1228
|
+
type: string
|
|
1229
|
+
model:
|
|
1230
|
+
type: string
|
|
1231
|
+
latency:
|
|
1232
|
+
type: integer
|
|
1233
|
+
cost:
|
|
1234
|
+
type: number
|
|
1235
|
+
status:
|
|
1236
|
+
type: string
|
|
1237
|
+
enum:
|
|
1238
|
+
- success
|
|
1239
|
+
- error
|
|
1240
|
+
error:
|
|
1241
|
+
type: string
|
|
1242
|
+
tokens:
|
|
1243
|
+
type: object
|
|
1244
|
+
properties:
|
|
1245
|
+
input:
|
|
1246
|
+
type: integer
|
|
1247
|
+
output:
|
|
1248
|
+
type: integer
|
|
1249
|
+
|
|
1250
|
+
HealthResponse:
|
|
1251
|
+
type: object
|
|
1252
|
+
properties:
|
|
1253
|
+
status:
|
|
1254
|
+
type: string
|
|
1255
|
+
version:
|
|
1256
|
+
type: string
|
|
1257
|
+
providers:
|
|
1258
|
+
type: object
|
|
1259
|
+
properties:
|
|
1260
|
+
total:
|
|
1261
|
+
type: integer
|
|
1262
|
+
healthy:
|
|
1263
|
+
type: integer
|
|
1264
|
+
details:
|
|
1265
|
+
type: object
|
|
1266
|
+
additionalProperties:
|
|
1267
|
+
type: object
|
|
1268
|
+
properties:
|
|
1269
|
+
name:
|
|
1270
|
+
type: string
|
|
1271
|
+
type:
|
|
1272
|
+
type: string
|
|
1273
|
+
models:
|
|
1274
|
+
type: integer
|
|
1275
|
+
available:
|
|
1276
|
+
type: boolean
|
|
1277
|
+
cost:
|
|
1278
|
+
type: object
|
|
1279
|
+
properties:
|
|
1280
|
+
total:
|
|
1281
|
+
type: number
|
|
1282
|
+
requests:
|
|
1283
|
+
type: integer
|
|
1284
|
+
uptime:
|
|
1285
|
+
type: number
|
|
1286
|
+
recentRequests:
|
|
1287
|
+
type: array
|
|
1288
|
+
items:
|
|
1289
|
+
$ref: "#/components/schemas/RequestLogEntry"
|
|
1290
|
+
|
|
1291
|
+
RequestLogEntry:
|
|
1292
|
+
type: object
|
|
1293
|
+
properties:
|
|
1294
|
+
id:
|
|
1295
|
+
type: string
|
|
1296
|
+
model:
|
|
1297
|
+
type: string
|
|
1298
|
+
resolvedProvider:
|
|
1299
|
+
type: string
|
|
1300
|
+
resolvedModel:
|
|
1301
|
+
type: string
|
|
1302
|
+
latencyMs:
|
|
1303
|
+
type: integer
|
|
1304
|
+
tokensIn:
|
|
1305
|
+
type: integer
|
|
1306
|
+
tokensOut:
|
|
1307
|
+
type: integer
|
|
1308
|
+
cost:
|
|
1309
|
+
type: number
|
|
1310
|
+
status:
|
|
1311
|
+
type: string
|
|
1312
|
+
enum:
|
|
1313
|
+
- success
|
|
1314
|
+
- error
|
|
1315
|
+
error:
|
|
1316
|
+
type: string
|
|
1317
|
+
timestamp:
|
|
1318
|
+
type: integer
|