{
  "schemaVersion": "1.0",
  "item": {
    "slug": "aisa-llm-router-skill",
    "name": "LLM Router Gateway",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/bowen-dotcom/aisa-llm-router-skill",
    "canonicalUrl": "https://clawhub.ai/bowen-dotcom/aisa-llm-router-skill",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/aisa-llm-router-skill",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=aisa-llm-router-skill",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "scripts/llm_router_client.py"
    ],
    "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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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/aisa-llm-router-skill"
    },
    "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/aisa-llm-router-skill",
    "agentPageUrl": "https://openagent3.xyz/skills/aisa-llm-router-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/aisa-llm-router-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/aisa-llm-router-skill/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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "OpenClaw LLM Router 🧠",
        "body": "Unified LLM Gateway for autonomous agents. Powered by AIsa.\n\nOne API key. 70+ models. OpenAI-compatible.\n\nReplace 100+ API keys with one. Access GPT-4, Claude-3, Gemini, Qwen, Deepseek, Grok, and more through a unified, OpenAI-compatible API."
      },
      {
        "title": "Multi-Model Chat",
        "body": "\"Chat with GPT-4 for reasoning, switch to Claude for creative writing\""
      },
      {
        "title": "Model Comparison",
        "body": "\"Compare responses from GPT-4, Claude, and Gemini for the same question\""
      },
      {
        "title": "Vision Analysis",
        "body": "\"Analyze this image with GPT-4o - what objects are in it?\""
      },
      {
        "title": "Cost Optimization",
        "body": "\"Route simple queries to fast/cheap models, complex queries to GPT-4\""
      },
      {
        "title": "Fallback Strategy",
        "body": "\"If GPT-4 fails, automatically try Claude, then Gemini\""
      },
      {
        "title": "Why LLM Router?",
        "body": "FeatureLLM RouterDirect APIsAPI Keys110+SDK CompatibilityOpenAI SDKMultiple SDKsBillingUnifiedPer-providerModel SwitchingChange stringCode rewriteFallback RoutingBuilt-inDIYCost TrackingUnifiedFragmented"
      },
      {
        "title": "Supported Model Families",
        "body": "FamilyDeveloperExample ModelsGPTOpenAIgpt-4.1, gpt-4o, gpt-4o-mini, o1, o1-mini, o3-miniClaudeAnthropicclaude-3-5-sonnet, claude-3-opus, claude-3-sonnetGeminiGooglegemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flashQwenAlibabaqwen-max, qwen-plus, qwen2.5-72b-instructDeepseekDeepseekdeepseek-chat, deepseek-coder, deepseek-v3, deepseek-r1GrokxAIgrok-2, grok-beta\n\nNote: Model availability may vary. Check marketplace.aisa.one/pricing for the full list of currently available models and pricing."
      },
      {
        "title": "Quick Start",
        "body": "export AISA_API_KEY=\"your-key\""
      },
      {
        "title": "OpenAI-Compatible Chat Completions",
        "body": "POST https://api.aisa.one/v1/chat/completions\n\nRequest\n\ncurl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gpt-4.1\",\n    \"messages\": [\n      {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n      {\"role\": \"user\", \"content\": \"Explain quantum computing in simple terms.\"}\n    ],\n    \"temperature\": 0.7,\n    \"max_tokens\": 1000\n  }'\n\nParameters\n\nParameterTypeRequiredDescriptionmodelstringYesModel identifier (e.g., gpt-4.1, claude-3-sonnet)messagesarrayYesConversation messagestemperaturenumberNoRandomness (0-2, default: 1)max_tokensintegerNoMaximum response tokensstreambooleanNoEnable streaming (default: false)top_pnumberNoNucleus sampling (0-1)frequency_penaltynumberNoFrequency penalty (-2 to 2)presence_penaltynumberNoPresence penalty (-2 to 2)stopstring/arrayNoStop sequences\n\nMessage Format\n\n{\n  \"role\": \"user|assistant|system\",\n  \"content\": \"message text or array for multimodal\"\n}\n\nResponse\n\n{\n  \"id\": \"chatcmpl-xxx\",\n  \"object\": \"chat.completion\",\n  \"created\": 1234567890,\n  \"model\": \"gpt-4.1\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"Quantum computing uses...\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 50,\n    \"completion_tokens\": 200,\n    \"total_tokens\": 250,\n    \"cost\": 0.0025\n  }\n}"
      },
      {
        "title": "Streaming Response",
        "body": "curl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"claude-3-sonnet\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Write a poem about AI.\"}],\n    \"stream\": true\n  }'\n\nStreaming returns Server-Sent Events (SSE):\n\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\"In\"}}]}\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\" circuits\"}}]}\n...\ndata: [DONE]"
      },
      {
        "title": "Vision / Image Analysis",
        "body": "Analyze images by passing image URLs or base64 data:\n\ncurl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gpt-4o\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": [\n          {\"type\": \"text\", \"text\": \"What is in this image?\"},\n          {\"type\": \"image_url\", \"image_url\": {\"url\": \"https://example.com/image.jpg\"}}\n        ]\n      }\n    ]\n  }'"
      },
      {
        "title": "Function Calling",
        "body": "Enable tools/functions for structured outputs:\n\ncurl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gpt-4.1\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"What is the weather in Tokyo?\"}],\n    \"functions\": [\n      {\n        \"name\": \"get_weather\",\n        \"description\": \"Get current weather for a location\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"location\": {\"type\": \"string\", \"description\": \"City name\"},\n            \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}\n          },\n          \"required\": [\"location\"]\n        }\n      }\n    ],\n    \"function_call\": \"auto\"\n  }'"
      },
      {
        "title": "Google Gemini Format",
        "body": "For Gemini models, you can also use the native format:\n\nPOST https://api.aisa.one/v1/models/{model}:generateContent\n\ncurl -X POST \"https://api.aisa.one/v1/models/gemini-2.0-flash:generateContent\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"contents\": [\n      {\n        \"role\": \"user\",\n        \"parts\": [{\"text\": \"Explain machine learning.\"}]\n      }\n    ],\n    \"generationConfig\": {\n      \"temperature\": 0.7,\n      \"maxOutputTokens\": 1000\n    }\n  }'"
      },
      {
        "title": "Installation",
        "body": "No installation required - uses standard library only."
      },
      {
        "title": "CLI Usage",
        "body": "# Basic completion\npython3 {baseDir}/scripts/llm_router_client.py chat --model gpt-4.1 --message \"Hello, world!\"\n\n# With system prompt\npython3 {baseDir}/scripts/llm_router_client.py chat --model claude-3-sonnet --system \"You are a poet\" --message \"Write about the moon\"\n\n# Streaming\npython3 {baseDir}/scripts/llm_router_client.py chat --model gpt-4o --message \"Tell me a story\" --stream\n\n# Multi-turn conversation\npython3 {baseDir}/scripts/llm_router_client.py chat --model qwen-max --messages '[{\"role\":\"user\",\"content\":\"Hi\"},{\"role\":\"assistant\",\"content\":\"Hello!\"},{\"role\":\"user\",\"content\":\"How are you?\"}]'\n\n# Vision analysis\npython3 {baseDir}/scripts/llm_router_client.py vision --model gpt-4o --image \"https://example.com/image.jpg\" --prompt \"Describe this image\"\n\n# List supported models\npython3 {baseDir}/scripts/llm_router_client.py models\n\n# Compare models\npython3 {baseDir}/scripts/llm_router_client.py compare --models \"gpt-4.1,claude-3-sonnet,gemini-2.0-flash\" --message \"What is 2+2?\""
      },
      {
        "title": "Python SDK Usage",
        "body": "from llm_router_client import LLMRouterClient\n\nclient = LLMRouterClient()  # Uses AISA_API_KEY env var\n\n# Simple chat\nresponse = client.chat(\n    model=\"gpt-4.1\",\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}]\n)\nprint(response[\"choices\"][0][\"message\"][\"content\"])\n\n# With options\nresponse = client.chat(\n    model=\"claude-3-sonnet\",\n    messages=[\n        {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n        {\"role\": \"user\", \"content\": \"Explain relativity.\"}\n    ],\n    temperature=0.7,\n    max_tokens=500\n)\n\n# Streaming\nfor chunk in client.chat_stream(\n    model=\"gpt-4o\",\n    messages=[{\"role\": \"user\", \"content\": \"Write a story.\"}]\n):\n    print(chunk, end=\"\", flush=True)\n\n# Vision\nresponse = client.vision(\n    model=\"gpt-4o\",\n    image_url=\"https://example.com/image.jpg\",\n    prompt=\"What's in this image?\"\n)\n\n# Compare models\nresults = client.compare_models(\n    models=[\"gpt-4.1\", \"claude-3-sonnet\", \"gemini-2.0-flash\"],\n    message=\"Explain quantum computing\"\n)\nfor model, result in results.items():\n    print(f\"{model}: {result['response'][:100]}...\")"
      },
      {
        "title": "1. Cost-Optimized Routing",
        "body": "Use cheaper models for simple tasks:\n\ndef smart_route(message: str) -> str:\n    # Simple queries -> fast/cheap model\n    if len(message) < 50:\n        model = \"gpt-3.5-turbo\"\n    # Complex reasoning -> powerful model\n    else:\n        model = \"gpt-4.1\"\n    \n    return client.chat(model=model, messages=[{\"role\": \"user\", \"content\": message}])"
      },
      {
        "title": "2. Fallback Strategy",
        "body": "Automatic fallback on failure:\n\ndef chat_with_fallback(message: str) -> str:\n    models = [\"gpt-4.1\", \"claude-3-sonnet\", \"gemini-2.0-flash\"]\n    \n    for model in models:\n        try:\n            return client.chat(model=model, messages=[{\"role\": \"user\", \"content\": message}])\n        except Exception:\n            continue\n    \n    raise Exception(\"All models failed\")"
      },
      {
        "title": "3. Model A/B Testing",
        "body": "Compare model outputs:\n\nresults = client.compare_models(\n    models=[\"gpt-4.1\", \"claude-3-opus\"],\n    message=\"Analyze this quarterly report...\"\n)\n\n# Log for analysis\nfor model, result in results.items():\n    log_response(model=model, latency=result[\"latency\"], cost=result[\"cost\"])"
      },
      {
        "title": "4. Specialized Model Selection",
        "body": "Choose the best model for each task:\n\nMODEL_MAP = {\n    \"code\": \"deepseek-coder\",\n    \"creative\": \"claude-3-opus\",\n    \"fast\": \"gpt-3.5-turbo\",\n    \"vision\": \"gpt-4o\",\n    \"chinese\": \"qwen-max\",\n    \"reasoning\": \"gpt-4.1\"\n}\n\ndef route_by_task(task_type: str, message: str) -> str:\n    model = MODEL_MAP.get(task_type, \"gpt-4.1\")\n    return client.chat(model=model, messages=[{\"role\": \"user\", \"content\": message}])"
      },
      {
        "title": "Error Handling",
        "body": "Errors return JSON with error field:\n\n{\n  \"error\": {\n    \"code\": \"model_not_found\",\n    \"message\": \"Model 'xyz' is not available\"\n  }\n}\n\nCommon error codes:\n\n401 - Invalid or missing API key\n402 - Insufficient credits\n404 - Model not found\n429 - Rate limit exceeded\n500 - Server error"
      },
      {
        "title": "Best Practices",
        "body": "Use streaming for long responses to improve UX\nSet max_tokens to control costs\nImplement fallback for production reliability\nCache responses for repeated queries\nMonitor usage via response metadata\nUse appropriate models - don't use GPT-4 for simple tasks"
      },
      {
        "title": "OpenAI SDK Compatibility",
        "body": "Just change the base URL and key:\n\nimport os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ[\"AISA_API_KEY\"],\n    base_url=\"https://api.aisa.one/v1\"\n)\n\nresponse = client.chat.completions.create(\n    model=\"gpt-4.1\",\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}]\n)\nprint(response.choices[0].message.content)"
      },
      {
        "title": "Pricing",
        "body": "Token-based pricing varies by model. Check marketplace.aisa.one/pricing for current rates.\n\nModel FamilyApproximate CostGPT-4.1 / GPT-4o~$0.01 / 1K tokensClaude-3-Sonnet~$0.01 / 1K tokensGemini-2.0-Flash~$0.001 / 1K tokensQwen-Max~$0.005 / 1K tokensDeepSeek-V3~$0.002 / 1K tokens\n\nEvery response includes usage.cost and usage.credits_remaining."
      },
      {
        "title": "Get Started",
        "body": "Sign up at aisa.one\nGet your API key from the dashboard\nAdd credits (pay-as-you-go)\nSet environment variable: export AISA_API_KEY=\"your-key\""
      },
      {
        "title": "Full API Reference",
        "body": "See API Reference for complete endpoint documentation."
      }
    ],
    "body": "OpenClaw LLM Router 🧠\n\nUnified LLM Gateway for autonomous agents. Powered by AIsa.\n\nOne API key. 70+ models. OpenAI-compatible.\n\nReplace 100+ API keys with one. Access GPT-4, Claude-3, Gemini, Qwen, Deepseek, Grok, and more through a unified, OpenAI-compatible API.\n\n🔥 What Can You Do?\nMulti-Model Chat\n\"Chat with GPT-4 for reasoning, switch to Claude for creative writing\"\n\nModel Comparison\n\"Compare responses from GPT-4, Claude, and Gemini for the same question\"\n\nVision Analysis\n\"Analyze this image with GPT-4o - what objects are in it?\"\n\nCost Optimization\n\"Route simple queries to fast/cheap models, complex queries to GPT-4\"\n\nFallback Strategy\n\"If GPT-4 fails, automatically try Claude, then Gemini\"\n\nWhy LLM Router?\nFeature\tLLM Router\tDirect APIs\nAPI Keys\t1\t10+\nSDK Compatibility\tOpenAI SDK\tMultiple SDKs\nBilling\tUnified\tPer-provider\nModel Switching\tChange string\tCode rewrite\nFallback Routing\tBuilt-in\tDIY\nCost Tracking\tUnified\tFragmented\nSupported Model Families\nFamily\tDeveloper\tExample Models\nGPT\tOpenAI\tgpt-4.1, gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini\nClaude\tAnthropic\tclaude-3-5-sonnet, claude-3-opus, claude-3-sonnet\nGemini\tGoogle\tgemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash\nQwen\tAlibaba\tqwen-max, qwen-plus, qwen2.5-72b-instruct\nDeepseek\tDeepseek\tdeepseek-chat, deepseek-coder, deepseek-v3, deepseek-r1\nGrok\txAI\tgrok-2, grok-beta\n\nNote: Model availability may vary. Check marketplace.aisa.one/pricing for the full list of currently available models and pricing.\n\nQuick Start\nexport AISA_API_KEY=\"your-key\"\n\nAPI Endpoints\nOpenAI-Compatible Chat Completions\nPOST https://api.aisa.one/v1/chat/completions\n\nRequest\ncurl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gpt-4.1\",\n    \"messages\": [\n      {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n      {\"role\": \"user\", \"content\": \"Explain quantum computing in simple terms.\"}\n    ],\n    \"temperature\": 0.7,\n    \"max_tokens\": 1000\n  }'\n\nParameters\nParameter\tType\tRequired\tDescription\nmodel\tstring\tYes\tModel identifier (e.g., gpt-4.1, claude-3-sonnet)\nmessages\tarray\tYes\tConversation messages\ntemperature\tnumber\tNo\tRandomness (0-2, default: 1)\nmax_tokens\tinteger\tNo\tMaximum response tokens\nstream\tboolean\tNo\tEnable streaming (default: false)\ntop_p\tnumber\tNo\tNucleus sampling (0-1)\nfrequency_penalty\tnumber\tNo\tFrequency penalty (-2 to 2)\npresence_penalty\tnumber\tNo\tPresence penalty (-2 to 2)\nstop\tstring/array\tNo\tStop sequences\nMessage Format\n{\n  \"role\": \"user|assistant|system\",\n  \"content\": \"message text or array for multimodal\"\n}\n\nResponse\n{\n  \"id\": \"chatcmpl-xxx\",\n  \"object\": \"chat.completion\",\n  \"created\": 1234567890,\n  \"model\": \"gpt-4.1\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"Quantum computing uses...\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 50,\n    \"completion_tokens\": 200,\n    \"total_tokens\": 250,\n    \"cost\": 0.0025\n  }\n}\n\nStreaming Response\ncurl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"claude-3-sonnet\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Write a poem about AI.\"}],\n    \"stream\": true\n  }'\n\n\nStreaming returns Server-Sent Events (SSE):\n\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\"In\"}}]}\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\" circuits\"}}]}\n...\ndata: [DONE]\n\nVision / Image Analysis\n\nAnalyze images by passing image URLs or base64 data:\n\ncurl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gpt-4o\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": [\n          {\"type\": \"text\", \"text\": \"What is in this image?\"},\n          {\"type\": \"image_url\", \"image_url\": {\"url\": \"https://example.com/image.jpg\"}}\n        ]\n      }\n    ]\n  }'\n\nFunction Calling\n\nEnable tools/functions for structured outputs:\n\ncurl -X POST \"https://api.aisa.one/v1/chat/completions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gpt-4.1\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"What is the weather in Tokyo?\"}],\n    \"functions\": [\n      {\n        \"name\": \"get_weather\",\n        \"description\": \"Get current weather for a location\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"location\": {\"type\": \"string\", \"description\": \"City name\"},\n            \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}\n          },\n          \"required\": [\"location\"]\n        }\n      }\n    ],\n    \"function_call\": \"auto\"\n  }'\n\nGoogle Gemini Format\n\nFor Gemini models, you can also use the native format:\n\nPOST https://api.aisa.one/v1/models/{model}:generateContent\n\ncurl -X POST \"https://api.aisa.one/v1/models/gemini-2.0-flash:generateContent\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"contents\": [\n      {\n        \"role\": \"user\",\n        \"parts\": [{\"text\": \"Explain machine learning.\"}]\n      }\n    ],\n    \"generationConfig\": {\n      \"temperature\": 0.7,\n      \"maxOutputTokens\": 1000\n    }\n  }'\n\nPython Client\nInstallation\n\nNo installation required - uses standard library only.\n\nCLI Usage\n# Basic completion\npython3 {baseDir}/scripts/llm_router_client.py chat --model gpt-4.1 --message \"Hello, world!\"\n\n# With system prompt\npython3 {baseDir}/scripts/llm_router_client.py chat --model claude-3-sonnet --system \"You are a poet\" --message \"Write about the moon\"\n\n# Streaming\npython3 {baseDir}/scripts/llm_router_client.py chat --model gpt-4o --message \"Tell me a story\" --stream\n\n# Multi-turn conversation\npython3 {baseDir}/scripts/llm_router_client.py chat --model qwen-max --messages '[{\"role\":\"user\",\"content\":\"Hi\"},{\"role\":\"assistant\",\"content\":\"Hello!\"},{\"role\":\"user\",\"content\":\"How are you?\"}]'\n\n# Vision analysis\npython3 {baseDir}/scripts/llm_router_client.py vision --model gpt-4o --image \"https://example.com/image.jpg\" --prompt \"Describe this image\"\n\n# List supported models\npython3 {baseDir}/scripts/llm_router_client.py models\n\n# Compare models\npython3 {baseDir}/scripts/llm_router_client.py compare --models \"gpt-4.1,claude-3-sonnet,gemini-2.0-flash\" --message \"What is 2+2?\"\n\nPython SDK Usage\nfrom llm_router_client import LLMRouterClient\n\nclient = LLMRouterClient()  # Uses AISA_API_KEY env var\n\n# Simple chat\nresponse = client.chat(\n    model=\"gpt-4.1\",\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}]\n)\nprint(response[\"choices\"][0][\"message\"][\"content\"])\n\n# With options\nresponse = client.chat(\n    model=\"claude-3-sonnet\",\n    messages=[\n        {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n        {\"role\": \"user\", \"content\": \"Explain relativity.\"}\n    ],\n    temperature=0.7,\n    max_tokens=500\n)\n\n# Streaming\nfor chunk in client.chat_stream(\n    model=\"gpt-4o\",\n    messages=[{\"role\": \"user\", \"content\": \"Write a story.\"}]\n):\n    print(chunk, end=\"\", flush=True)\n\n# Vision\nresponse = client.vision(\n    model=\"gpt-4o\",\n    image_url=\"https://example.com/image.jpg\",\n    prompt=\"What's in this image?\"\n)\n\n# Compare models\nresults = client.compare_models(\n    models=[\"gpt-4.1\", \"claude-3-sonnet\", \"gemini-2.0-flash\"],\n    message=\"Explain quantum computing\"\n)\nfor model, result in results.items():\n    print(f\"{model}: {result['response'][:100]}...\")\n\nUse Cases\n1. Cost-Optimized Routing\n\nUse cheaper models for simple tasks:\n\ndef smart_route(message: str) -> str:\n    # Simple queries -> fast/cheap model\n    if len(message) < 50:\n        model = \"gpt-3.5-turbo\"\n    # Complex reasoning -> powerful model\n    else:\n        model = \"gpt-4.1\"\n    \n    return client.chat(model=model, messages=[{\"role\": \"user\", \"content\": message}])\n\n2. Fallback Strategy\n\nAutomatic fallback on failure:\n\ndef chat_with_fallback(message: str) -> str:\n    models = [\"gpt-4.1\", \"claude-3-sonnet\", \"gemini-2.0-flash\"]\n    \n    for model in models:\n        try:\n            return client.chat(model=model, messages=[{\"role\": \"user\", \"content\": message}])\n        except Exception:\n            continue\n    \n    raise Exception(\"All models failed\")\n\n3. Model A/B Testing\n\nCompare model outputs:\n\nresults = client.compare_models(\n    models=[\"gpt-4.1\", \"claude-3-opus\"],\n    message=\"Analyze this quarterly report...\"\n)\n\n# Log for analysis\nfor model, result in results.items():\n    log_response(model=model, latency=result[\"latency\"], cost=result[\"cost\"])\n\n4. Specialized Model Selection\n\nChoose the best model for each task:\n\nMODEL_MAP = {\n    \"code\": \"deepseek-coder\",\n    \"creative\": \"claude-3-opus\",\n    \"fast\": \"gpt-3.5-turbo\",\n    \"vision\": \"gpt-4o\",\n    \"chinese\": \"qwen-max\",\n    \"reasoning\": \"gpt-4.1\"\n}\n\ndef route_by_task(task_type: str, message: str) -> str:\n    model = MODEL_MAP.get(task_type, \"gpt-4.1\")\n    return client.chat(model=model, messages=[{\"role\": \"user\", \"content\": message}])\n\nError Handling\n\nErrors return JSON with error field:\n\n{\n  \"error\": {\n    \"code\": \"model_not_found\",\n    \"message\": \"Model 'xyz' is not available\"\n  }\n}\n\n\nCommon error codes:\n\n401 - Invalid or missing API key\n402 - Insufficient credits\n404 - Model not found\n429 - Rate limit exceeded\n500 - Server error\nBest Practices\nUse streaming for long responses to improve UX\nSet max_tokens to control costs\nImplement fallback for production reliability\nCache responses for repeated queries\nMonitor usage via response metadata\nUse appropriate models - don't use GPT-4 for simple tasks\nOpenAI SDK Compatibility\n\nJust change the base URL and key:\n\nimport os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ[\"AISA_API_KEY\"],\n    base_url=\"https://api.aisa.one/v1\"\n)\n\nresponse = client.chat.completions.create(\n    model=\"gpt-4.1\",\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}]\n)\nprint(response.choices[0].message.content)\n\nPricing\n\nToken-based pricing varies by model. Check marketplace.aisa.one/pricing for current rates.\n\nModel Family\tApproximate Cost\nGPT-4.1 / GPT-4o\t~$0.01 / 1K tokens\nClaude-3-Sonnet\t~$0.01 / 1K tokens\nGemini-2.0-Flash\t~$0.001 / 1K tokens\nQwen-Max\t~$0.005 / 1K tokens\nDeepSeek-V3\t~$0.002 / 1K tokens\n\nEvery response includes usage.cost and usage.credits_remaining.\n\nGet Started\nSign up at aisa.one\nGet your API key from the dashboard\nAdd credits (pay-as-you-go)\nSet environment variable: export AISA_API_KEY=\"your-key\"\nFull API Reference\n\nSee API Reference for complete endpoint documentation."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/bowen-dotcom/aisa-llm-router-skill",
    "publisherUrl": "https://clawhub.ai/bowen-dotcom/aisa-llm-router-skill",
    "owner": "bowen-dotcom",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/aisa-llm-router-skill",
    "downloadUrl": "https://openagent3.xyz/downloads/aisa-llm-router-skill",
    "agentUrl": "https://openagent3.xyz/skills/aisa-llm-router-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/aisa-llm-router-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/aisa-llm-router-skill/agent.md"
  }
}