{
  "schemaVersion": "1.0",
  "item": {
    "slug": "semantic-model-router",
    "name": "semantic-model-router",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/rayray1218/semantic-model-router",
    "canonicalUrl": "https://clawhub.ai/rayray1218/semantic-model-router",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/semantic-model-router",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=semantic-model-router",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "scripts/model_router.py",
      "scripts/model_weights.py",
      "scripts/requirements.txt",
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/semantic-model-router"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/semantic-model-router",
    "agentPageUrl": "https://openagent3.xyz/skills/semantic-model-router/agent",
    "manifestUrl": "https://openagent3.xyz/skills/semantic-model-router/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/semantic-model-router/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Semantic Model Router",
        "body": "Smart LLM router that saves up to 99% on inference costs by routing each request to the cheapest model that can handle it. Powered by a pre-trained ML classifier and semantic embeddings — no external calls, no API keys needed."
      },
      {
        "title": "Install",
        "body": "openclaw plugins install @rayray1218/semantic-model-router"
      },
      {
        "title": "Quick Start",
        "body": "from scripts.model_router import ModelRouter\n\nrouter = ModelRouter()\nres = router.route(\"Design a distributed caching layer for a fintech platform.\")\nprint(res[\"report\"])\n# [ClawRouter] anthropic/claude-sonnet-4-6 (ELITE, ml, conf=0.97)\n#              Cost: $3.0/M | Baseline: $10.0/M | Saved: 70.0%"
      },
      {
        "title": "How Routing Works",
        "body": "Queries are classified into three tiers through a 3-stage pipeline:\n\nML Classifier (primary): A Logistic Regression model trained on 6,000+ labeled queries. Runs in <1ms from embedded weights in model_weights.py.\nSemantic Embeddings (fallback): Cosine similarity to tier intent vectors via sentence-transformers.\nKeyword Rules (last resort): Pattern matching with no dependencies.\n\nTierDefault ModelTypical WorkloadCost/1Mvs BaselineBASICdeepseek/deepseek-chatGreetings, simple Q&A, chit-chat$0.1499% savedBALANCEDopenai/gpt-4o-miniSummaries, translations, explanations$0.1599% savedELITEanthropic/claude-sonnet-4-6Complex coding, architecture, security$3.0070% saved"
      },
      {
        "title": "Anthropic",
        "body": "ModelInput /1MOutput /1Manthropic/claude-sonnet-4-6$3.00$15.00 ★ ELITE defaultanthropic/claude-opus-4-5$5.00$25.00anthropic/claude-haiku-4-5$0.80$4.00"
      },
      {
        "title": "OpenAI",
        "body": "ModelInput /1MOutput /1Mopenai/gpt-5$1.25$10.00openai/gpt-4o$2.50$10.00openai/gpt-4o-mini$0.15$0.60 ★ BALANCED defaultopenai/o3$2.00$8.00openai/o4-mini$1.10$4.40"
      },
      {
        "title": "Google",
        "body": "ModelInput /1MOutput /1Mgoogle/gemini-3.0-pro$1.25$10.00google/gemini-2.5-pro$1.25$10.00google/gemini-2.5-flash$0.30$2.50google/gemini-2.5-flash-lite$0.10$0.40"
      },
      {
        "title": "DeepSeek",
        "body": "ModelInput /1MOutput /1Mdeepseek/deepseek-chat (V3.2)$0.28$0.42 ★ BASIC defaultdeepseek/deepseek-reasoner (V3.2)$0.28$0.42"
      },
      {
        "title": "xAI (Grok)",
        "body": "ModelInput /1MOutput /1Mxai/grok-3$3.00$15.00xai/grok-3-mini$0.30$0.50\n\nPricing source: Official API docs of each provider, verified Feb 2026."
      },
      {
        "title": "Override Models at Runtime",
        "body": "# Use GPT-5.2 for ELITE, Gemini Flash Lite for BASIC\nrouter = ModelRouter(\n    elite_model=\"openai/gpt-5.2\",\n    balanced_model=\"google/gemini-2.5-flash\",\n    basic_model=\"google/gemini-2.5-flash-lite\",\n)\n\n# Swap a tier's model without recreating the router\nrouter.set_model(\"ELITE\", \"anthropic/claude-opus-4-5\")"
      },
      {
        "title": "List All Available Models (CLI)",
        "body": "python3 scripts/model_router.py --list-models"
      },
      {
        "title": "CLI Usage",
        "body": "# Route a single query\npython3 scripts/model_router.py \"Implement AES encryption from scratch\"\n\n# Override ELITE model\npython3 scripts/model_router.py --elite openai/gpt-5.2 \"Write a compiler\"\n\n# Run full smoke-test\npython3 scripts/model_router.py"
      },
      {
        "title": "Dynamic Keyword Expansion",
        "body": "router.add_keywords(\"ELITE\", [\"cryptographic proof\", \"zero-knowledge\"])"
      },
      {
        "title": "Example Output",
        "body": "Query                                              Predicted  Expected   ✓  Cost Info\n────────────────────────────────────────────────────────────────────────────────────\nHow are you doing today?                           BASIC      BASIC      ✓  $0.14/M  saved 98.6%\nSummarize this article in three bullet points.     BALANCED   BALANCED   ✓  $0.15/M  saved 98.5%\nImplement a thread-safe LRU cache in Python.       ELITE      ELITE      ✓  $3.0/M   saved 70.0%"
      },
      {
        "title": "Security & Privacy",
        "body": "Zero external calls: All classification runs locally.\nNo API keys: The router itself needs none.\nTransparent weights: All model parameters live in scripts/model_weights.py — fully auditable.\n\nSave costs, route smarter. Built for the OpenClaw community."
      }
    ],
    "body": "Semantic Model Router\n\nSmart LLM router that saves up to 99% on inference costs by routing each request to the cheapest model that can handle it. Powered by a pre-trained ML classifier and semantic embeddings — no external calls, no API keys needed.\n\nInstall\nopenclaw plugins install @rayray1218/semantic-model-router\n\nQuick Start\nfrom scripts.model_router import ModelRouter\n\nrouter = ModelRouter()\nres = router.route(\"Design a distributed caching layer for a fintech platform.\")\nprint(res[\"report\"])\n# [ClawRouter] anthropic/claude-sonnet-4-6 (ELITE, ml, conf=0.97)\n#              Cost: $3.0/M | Baseline: $10.0/M | Saved: 70.0%\n\nHow Routing Works\n\nQueries are classified into three tiers through a 3-stage pipeline:\n\nML Classifier (primary): A Logistic Regression model trained on 6,000+ labeled queries. Runs in <1ms from embedded weights in model_weights.py.\nSemantic Embeddings (fallback): Cosine similarity to tier intent vectors via sentence-transformers.\nKeyword Rules (last resort): Pattern matching with no dependencies.\nTier\tDefault Model\tTypical Workload\tCost/1M\tvs Baseline\nBASIC\tdeepseek/deepseek-chat\tGreetings, simple Q&A, chit-chat\t$0.14\t99% saved\nBALANCED\topenai/gpt-4o-mini\tSummaries, translations, explanations\t$0.15\t99% saved\nELITE\tanthropic/claude-sonnet-4-6\tComplex coding, architecture, security\t$3.00\t70% saved\nSupported Models (17 total, verified Feb 2026)\nAnthropic\nModel\tInput /1M\tOutput /1M\nanthropic/claude-sonnet-4-6\t$3.00\t$15.00 ★ ELITE default\nanthropic/claude-opus-4-5\t$5.00\t$25.00\nanthropic/claude-haiku-4-5\t$0.80\t$4.00\nOpenAI\nModel\tInput /1M\tOutput /1M\nopenai/gpt-5\t$1.25\t$10.00\nopenai/gpt-4o\t$2.50\t$10.00\nopenai/gpt-4o-mini\t$0.15\t$0.60 ★ BALANCED default\nopenai/o3\t$2.00\t$8.00\nopenai/o4-mini\t$1.10\t$4.40\nGoogle\nModel\tInput /1M\tOutput /1M\ngoogle/gemini-3.0-pro\t$1.25\t$10.00\ngoogle/gemini-2.5-pro\t$1.25\t$10.00\ngoogle/gemini-2.5-flash\t$0.30\t$2.50\ngoogle/gemini-2.5-flash-lite\t$0.10\t$0.40\nDeepSeek\nModel\tInput /1M\tOutput /1M\ndeepseek/deepseek-chat (V3.2)\t$0.28\t$0.42 ★ BASIC default\ndeepseek/deepseek-reasoner (V3.2)\t$0.28\t$0.42\nxAI (Grok)\nModel\tInput /1M\tOutput /1M\nxai/grok-3\t$3.00\t$15.00\nxai/grok-3-mini\t$0.30\t$0.50\n\nPricing source: Official API docs of each provider, verified Feb 2026.\n\nOverride Models at Runtime\n# Use GPT-5.2 for ELITE, Gemini Flash Lite for BASIC\nrouter = ModelRouter(\n    elite_model=\"openai/gpt-5.2\",\n    balanced_model=\"google/gemini-2.5-flash\",\n    basic_model=\"google/gemini-2.5-flash-lite\",\n)\n\n# Swap a tier's model without recreating the router\nrouter.set_model(\"ELITE\", \"anthropic/claude-opus-4-5\")\n\nList All Available Models (CLI)\npython3 scripts/model_router.py --list-models\n\nCLI Usage\n# Route a single query\npython3 scripts/model_router.py \"Implement AES encryption from scratch\"\n\n# Override ELITE model\npython3 scripts/model_router.py --elite openai/gpt-5.2 \"Write a compiler\"\n\n# Run full smoke-test\npython3 scripts/model_router.py\n\nDynamic Keyword Expansion\nrouter.add_keywords(\"ELITE\", [\"cryptographic proof\", \"zero-knowledge\"])\n\nExample Output\nQuery                                              Predicted  Expected   ✓  Cost Info\n────────────────────────────────────────────────────────────────────────────────────\nHow are you doing today?                           BASIC      BASIC      ✓  $0.14/M  saved 98.6%\nSummarize this article in three bullet points.     BALANCED   BALANCED   ✓  $0.15/M  saved 98.5%\nImplement a thread-safe LRU cache in Python.       ELITE      ELITE      ✓  $3.0/M   saved 70.0%\n\nSecurity & Privacy\nZero external calls: All classification runs locally.\nNo API keys: The router itself needs none.\nTransparent weights: All model parameters live in scripts/model_weights.py — fully auditable.\n\nSave costs, route smarter. Built for the OpenClaw community."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/rayray1218/semantic-model-router",
    "publisherUrl": "https://clawhub.ai/rayray1218/semantic-model-router",
    "owner": "rayray1218",
    "version": "1.0.3",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/semantic-model-router",
    "downloadUrl": "https://openagent3.xyz/downloads/semantic-model-router",
    "agentUrl": "https://openagent3.xyz/skills/semantic-model-router/agent",
    "manifestUrl": "https://openagent3.xyz/skills/semantic-model-router/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/semantic-model-router/agent.md"
  }
}