[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6N13M2F0ZP1V1F3JD5BMF9T":3,"skill-same:01M6N13M2F0ZP1V1F3JD5BMF9T":99},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":48,"linkOnly":49,"markdownContent":50,"markdownBody":51,"frontMatter":52,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":6,"ownerHtmlUrl":66,"ownerBlogUrl":6,"ownerDescription":67,"updatedAt":68,"install":69,"resources":82},"01M6N13M2F0ZP1V1F3JD5BMF9T","llm-router",null,"Unified LLM Gateway - One API for 70+ AI models. Route to GPT, Claude, Gemini, Qwen, Deepseek, Grok and more with a single API key.","Kernel8901\u002Fai-agent-skills-classification","Kernel8901","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F72647553?v=4","01M6KV388J2H5PNC8D8P940BJD","01M6KV38CS5B3AY63RKZB410YM",7,"MIT","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fopenclaw-aisa-affordable-llm-model-tokens\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"llm router","router","for","openclaw","more","with","ai models","deepseek","route","models","grok","llm gateway","curl","python3","api","Qwen","https","gateway","gpt","gemini","2026-11-10 10:12:30",false,"---\nname: llm-router\ndescription: \"Unified LLM Gateway - One API for 70+ AI models. Route to GPT, Claude, Gemini, Qwen, Deepseek, Grok and more with a single API key.\"\nhomepage: https:\u002F\u002Fopenclaw.ai\nmetadata: {\"openclaw\":{\"emoji\":\"?\",\"requires\":{\"bins\":[\"curl\",\"python3\"],\"env\":[\"AISA_API_KEY\"]},\"primaryEnv\":\"AISA_API_KEY\"}}\n---\n\n# OpenClaw LLM Router ?\n\n**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.\n\n## ? What Can You Do?\n\n### Multi-Model Chat\n```\n\"Chat with GPT-4 for reasoning, switch to Claude for creative writing\"\n```\n\n### Model Comparison\n```\n\"Compare responses from GPT-4, Claude, and Gemini for the same question\"\n```\n\n### Vision Analysis\n```\n\"Analyze this image with GPT-4o - what objects are in it?\"\n```\n\n### Cost Optimization\n```\n\"Route simple queries to fast\u002Fcheap models, complex queries to GPT-4\"\n```\n\n### Fallback Strategy\n```\n\"If GPT-4 fails, automatically try Claude, then Gemini\"\n```\n\n## Why LLM Router?\n\n| Feature | LLM Router | Direct APIs |\n|---------|------------|-------------|\n| API Keys | 1 | 10+ |\n| SDK Compatibility | OpenAI SDK | Multiple SDKs |\n| Billing | Unified | Per-provider |\n| Model Switching | Change string | Code rewrite |\n| Fallback Routing | Built-in | DIY |\n| Cost Tracking | Unified | Fragmented |\n\n## Supported Model Families\n\n| Family | Developer | Example Models |\n|--------|-----------|----------------|\n| GPT | OpenAI | gpt-4.1, gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini |\n| Claude | Anthropic | claude-3-5-sonnet, claude-3-opus, claude-3-sonnet |\n| Gemini | Google | gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash |\n| Qwen | Alibaba | qwen-max, qwen-plus, qwen2.5-72b-instruct |\n| Deepseek | Deepseek | deepseek-chat, deepseek-coder, deepseek-v3, deepseek-r1 |\n| Grok | xAI | grok-2, grok-beta |\n\n> **Note**: Model availability may vary. Check [marketplace.aisa.one\u002Fpricing](https:\u002F\u002Fmarketplace.aisa.one\u002Fpricing) for the full list of currently available models and pricing.\n\n## Quick Start\n\n```bash\nexport AISA_API_KEY=\"your-key\"\n```\n\n## API Endpoints\n\n### OpenAI-Compatible Chat Completions\n\n```\nPOST https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\n```\n\n#### Request\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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```\n\n#### Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `model` | string | Yes | Model identifier (e.g., `gpt-4.1`, `claude-3-sonnet`) |\n| `messages` | array | Yes | Conversation messages |\n| `temperature` | number | No | Randomness (0-2, default: 1) |\n| `max_tokens` | integer | No | Maximum response tokens |\n| `stream` | boolean | No | Enable streaming (default: false) |\n| `top_p` | number | No | Nucleus sampling (0-1) |\n| `frequency_penalty` | number | No | Frequency penalty (-2 to 2) |\n| `presence_penalty` | number | No | Presence penalty (-2 to 2) |\n| `stop` | string\u002Farray | No | Stop sequences |\n\n#### Message Format\n\n```json\n{\n  \"role\": \"user|assistant|system\",\n  \"content\": \"message text or array for multimodal\"\n}\n```\n\n#### Response\n\n```json\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```\n\n### Streaming Response\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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\n```\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\"In\"}}]}\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\" circuits\"}}]}\n...\ndata: [DONE]\n```\n\n### Vision \u002F Image Analysis\n\nAnalyze images by passing image URLs or base64 data:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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:\u002F\u002Fexample.com\u002Fimage.jpg\"}}\n        ]\n      }\n    ]\n  }'\n```\n\n### Function Calling\n\nEnable tools\u002Ffunctions for structured outputs:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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```\n\n### Google Gemini Format\n\nFor Gemini models, you can also use the native format:\n\n```\nPOST https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fmodels\u002F{model}:generateContent\n```\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fmodels\u002Fgemini-2.0-flash:generateContent\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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```\n\n## Python Client\n\n### Installation\n\nNo installation required - uses standard library only.\n\n### CLI Usage\n\n```bash\n# Basic completion\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py chat --model gpt-4.1 --message \"Hello, world!\"\n\n# With system prompt\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py chat --model claude-3-sonnet --system \"You are a poet\" --message \"Write about the moon\"\n\n# Streaming\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py chat --model gpt-4o --message \"Tell me a story\" --stream\n\n# Multi-turn conversation\npython3 {baseDir}\u002Fscripts\u002Fllm_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}\u002Fscripts\u002Fllm_router_client.py vision --model gpt-4o --image \"https:\u002F\u002Fexample.com\u002Fimage.jpg\" --prompt \"Describe this image\"\n\n# List supported models\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py models\n\n# Compare models\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py compare --models \"gpt-4.1,claude-3-sonnet,gemini-2.0-flash\" --message \"What is 2+2?\"\n```\n\n### Python SDK Usage\n\n```python\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:\u002F\u002Fexample.com\u002Fimage.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```\n\n## Use Cases\n\n### 1. Cost-Optimized Routing\n\nUse cheaper models for simple tasks:\n\n```python\ndef smart_route(message: str) -> str:\n    # Simple queries -> fast\u002Fcheap model\n    if len(message) \u003C 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```\n\n### 2. Fallback Strategy\n\nAutomatic fallback on failure:\n\n```python\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```\n\n### 3. Model A\u002FB Testing\n\nCompare model outputs:\n\n```python\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```\n\n### 4. Specialized Model Selection\n\nChoose the best model for each task:\n\n```python\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```\n\n## Error Handling\n\nErrors return JSON with `error` field:\n\n```json\n{\n  \"error\": {\n    \"code\": \"model_not_found\",\n    \"message\": \"Model 'xyz' is not available\"\n  }\n}\n```\n\nCommon error codes:\n- `401` - Invalid or missing API key\n- `402` - Insufficient credits\n- `404` - Model not found\n- `429` - Rate limit exceeded\n- `500` - Server error\n\n## Best Practices\n\n1. **Use streaming** for long responses to improve UX\n2. **Set max_tokens** to control costs\n3. **Implement fallback** for production reliability\n4. **Cache responses** for repeated queries\n5. **Monitor usage** via response metadata\n6. **Use appropriate models** - don't use GPT-4 for simple tasks\n\n## OpenAI SDK Compatibility\n\nJust change the base URL and key:\n\n```python\nimport os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ[\"AISA_API_KEY\"],\n    base_url=\"https:\u002F\u002Fapi.aisa.one\u002Fv1\"\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```\n\n## Pricing\n\nToken-based pricing varies by model. Check [marketplace.aisa.one\u002Fpricing](https:\u002F\u002Fmarketplace.aisa.one\u002Fpricing) for current rates.\n\n| Model Family | Approximate Cost |\n|--------------|------------------|\n| GPT-4.1 \u002F GPT-4o | ~$0.01 \u002F 1K tokens |\n| Claude-3-Sonnet | ~$0.01 \u002F 1K tokens |\n| Gemini-2.0-Flash | ~$0.001 \u002F 1K tokens |\n| Qwen-Max | ~$0.005 \u002F 1K tokens |\n| DeepSeek-V3 | ~$0.002 \u002F 1K tokens |\n\nEvery response includes `usage.cost` and `usage.credits_remaining`.\n\n## Get Started\n\n1. Sign up at [aisa.one](https:\u002F\u002Faisa.one)\n2. Get your API key from the dashboard\n3. Add credits (pay-as-you-go)\n4. Set environment variable: `export AISA_API_KEY=\"your-key\"`\n\n## Full API Reference\n\nSee [API Reference](https:\u002F\u002Faisa.mintlify.app\u002Fapi-reference\u002Fintroduction) for complete endpoint documentation.\n","# OpenClaw LLM Router ?\n\n**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.\n\n## ? What Can You Do?\n\n### Multi-Model Chat\n```\n\"Chat with GPT-4 for reasoning, switch to Claude for creative writing\"\n```\n\n### Model Comparison\n```\n\"Compare responses from GPT-4, Claude, and Gemini for the same question\"\n```\n\n### Vision Analysis\n```\n\"Analyze this image with GPT-4o - what objects are in it?\"\n```\n\n### Cost Optimization\n```\n\"Route simple queries to fast\u002Fcheap models, complex queries to GPT-4\"\n```\n\n### Fallback Strategy\n```\n\"If GPT-4 fails, automatically try Claude, then Gemini\"\n```\n\n## Why LLM Router?\n\n| Feature | LLM Router | Direct APIs |\n|---------|------------|-------------|\n| API Keys | 1 | 10+ |\n| SDK Compatibility | OpenAI SDK | Multiple SDKs |\n| Billing | Unified | Per-provider |\n| Model Switching | Change string | Code rewrite |\n| Fallback Routing | Built-in | DIY |\n| Cost Tracking | Unified | Fragmented |\n\n## Supported Model Families\n\n| Family | Developer | Example Models |\n|--------|-----------|----------------|\n| GPT | OpenAI | gpt-4.1, gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini |\n| Claude | Anthropic | claude-3-5-sonnet, claude-3-opus, claude-3-sonnet |\n| Gemini | Google | gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash |\n| Qwen | Alibaba | qwen-max, qwen-plus, qwen2.5-72b-instruct |\n| Deepseek | Deepseek | deepseek-chat, deepseek-coder, deepseek-v3, deepseek-r1 |\n| Grok | xAI | grok-2, grok-beta |\n\n> **Note**: Model availability may vary. Check [marketplace.aisa.one\u002Fpricing](https:\u002F\u002Fmarketplace.aisa.one\u002Fpricing) for the full list of currently available models and pricing.\n\n## Quick Start\n\n```bash\nexport AISA_API_KEY=\"your-key\"\n```\n\n## API Endpoints\n\n### OpenAI-Compatible Chat Completions\n\n```\nPOST https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\n```\n\n#### Request\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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```\n\n#### Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `model` | string | Yes | Model identifier (e.g., `gpt-4.1`, `claude-3-sonnet`) |\n| `messages` | array | Yes | Conversation messages |\n| `temperature` | number | No | Randomness (0-2, default: 1) |\n| `max_tokens` | integer | No | Maximum response tokens |\n| `stream` | boolean | No | Enable streaming (default: false) |\n| `top_p` | number | No | Nucleus sampling (0-1) |\n| `frequency_penalty` | number | No | Frequency penalty (-2 to 2) |\n| `presence_penalty` | number | No | Presence penalty (-2 to 2) |\n| `stop` | string\u002Farray | No | Stop sequences |\n\n#### Message Format\n\n```json\n{\n  \"role\": \"user|assistant|system\",\n  \"content\": \"message text or array for multimodal\"\n}\n```\n\n#### Response\n\n```json\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```\n\n### Streaming Response\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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\n```\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\"In\"}}]}\ndata: {\"id\":\"chatcmpl-xxx\",\"choices\":[{\"delta\":{\"content\":\" circuits\"}}]}\n...\ndata: [DONE]\n```\n\n### Vision \u002F Image Analysis\n\nAnalyze images by passing image URLs or base64 data:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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:\u002F\u002Fexample.com\u002Fimage.jpg\"}}\n        ]\n      }\n    ]\n  }'\n```\n\n### Function Calling\n\nEnable tools\u002Ffunctions for structured outputs:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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```\n\n### Google Gemini Format\n\nFor Gemini models, you can also use the native format:\n\n```\nPOST https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fmodels\u002F{model}:generateContent\n```\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.aisa.one\u002Fv1\u002Fmodels\u002Fgemini-2.0-flash:generateContent\" \\\n  -H \"Authorization: Bearer $AISA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\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```\n\n## Python Client\n\n### Installation\n\nNo installation required - uses standard library only.\n\n### CLI Usage\n\n```bash\n# Basic completion\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py chat --model gpt-4.1 --message \"Hello, world!\"\n\n# With system prompt\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py chat --model claude-3-sonnet --system \"You are a poet\" --message \"Write about the moon\"\n\n# Streaming\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py chat --model gpt-4o --message \"Tell me a story\" --stream\n\n# Multi-turn conversation\npython3 {baseDir}\u002Fscripts\u002Fllm_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}\u002Fscripts\u002Fllm_router_client.py vision --model gpt-4o --image \"https:\u002F\u002Fexample.com\u002Fimage.jpg\" --prompt \"Describe this image\"\n\n# List supported models\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py models\n\n# Compare models\npython3 {baseDir}\u002Fscripts\u002Fllm_router_client.py compare --models \"gpt-4.1,claude-3-sonnet,gemini-2.0-flash\" --message \"What is 2+2?\"\n```\n\n### Python SDK Usage\n\n```python\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:\u002F\u002Fexample.com\u002Fimage.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```\n\n## Use Cases\n\n### 1. Cost-Optimized Routing\n\nUse cheaper models for simple tasks:\n\n```python\ndef smart_route(message: str) -> str:\n    # Simple queries -> fast\u002Fcheap model\n    if len(message) \u003C 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```\n\n### 2. Fallback Strategy\n\nAutomatic fallback on failure:\n\n```python\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```\n\n### 3. Model A\u002FB Testing\n\nCompare model outputs:\n\n```python\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```\n\n### 4. Specialized Model Selection\n\nChoose the best model for each task:\n\n```python\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```\n\n## Error Handling\n\nErrors return JSON with `error` field:\n\n```json\n{\n  \"error\": {\n    \"code\": \"model_not_found\",\n    \"message\": \"Model 'xyz' is not available\"\n  }\n}\n```\n\nCommon error codes:\n- `401` - Invalid or missing API key\n- `402` - Insufficient credits\n- `404` - Model not found\n- `429` - Rate limit exceeded\n- `500` - Server error\n\n## Best Practices\n\n1. **Use streaming** for long responses to improve UX\n2. **Set max_tokens** to control costs\n3. **Implement fallback** for production reliability\n4. **Cache responses** for repeated queries\n5. **Monitor usage** via response metadata\n6. **Use appropriate models** - don't use GPT-4 for simple tasks\n\n## OpenAI SDK Compatibility\n\nJust change the base URL and key:\n\n```python\nimport os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ[\"AISA_API_KEY\"],\n    base_url=\"https:\u002F\u002Fapi.aisa.one\u002Fv1\"\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```\n\n## Pricing\n\nToken-based pricing varies by model. Check [marketplace.aisa.one\u002Fpricing](https:\u002F\u002Fmarketplace.aisa.one\u002Fpricing) for current rates.\n\n| Model Family | Approximate Cost |\n|--------------|------------------|\n| GPT-4.1 \u002F GPT-4o | ~$0.01 \u002F 1K tokens |\n| Claude-3-Sonnet | ~$0.01 \u002F 1K tokens |\n| Gemini-2.0-Flash | ~$0.001 \u002F 1K tokens |\n| Qwen-Max | ~$0.005 \u002F 1K tokens |\n| DeepSeek-V3 | ~$0.002 \u002F 1K tokens |\n\nEvery response includes `usage.cost` and `usage.credits_remaining`.\n\n## Get Started\n\n1. Sign up at [aisa.one](https:\u002F\u002Faisa.one)\n2. Get your API key from the dashboard\n3. Add credits (pay-as-you-go)\n4. Set environment variable: `export AISA_API_KEY=\"your-key\"`\n\n## Full API Reference\n\nSee [API Reference](https:\u002F\u002Faisa.mintlify.app\u002Fapi-reference\u002Fintroduction) for complete endpoint documentation.\n",{"name":5,"homepage":53,"metadata":54,"description":7},"https:\u002F\u002Fopenclaw.ai",{"openclaw":55},{"emoji":56,"requires":57,"primaryEnv":59},"?",{"env":58,"bins":60},[59],"AISA_API_KEY",[40,41],"main","f4cb2d49f7667e79ef7804f50396d5aaffdf1f56","人工智能与大型语言模型\u002Fopenclaw-aisa-affordable-llm-model-tokens",1,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification","https:\u002F\u002Fgithub.com\u002FKernel8901","a little little little dobe in life but science geek","2026-04-05 16:43:56",{"source":8,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add Kernel8901\u002Fai-agent-skills-classification --skill llm-router",{"tool":75,"command":76},"bunx","bunx skills add Kernel8901\u002Fai-agent-skills-classification --skill llm-router",{"tool":78,"command":79},"pnpm","pnpm dlx skills add Kernel8901\u002Fai-agent-skills-classification --skill llm-router","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fopenclaw-aisa-affordable-llm-model-tokens\u002FSKILL.md",true,[83,89,93],{"path":84,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"_meta.json","REFERENCE","参考文档",412,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fopenclaw-aisa-affordable-llm-model-tokens\u002F_meta.json",{"path":90,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":91,"sourceHtmlUrl":92},"README.md",1757,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fopenclaw-aisa-affordable-llm-model-tokens\u002FREADME.md",{"path":94,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":97,"sourceHtmlUrl":98},"scripts\u002Fllm_router_client.py","SCRIPT","脚本",13753,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fopenclaw-aisa-affordable-llm-model-tokens\u002Fscripts\u002Fllm_router_client.py",[100,124,151,162,172,199],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":48},"01M6Q5R6WZ06RRB9RQTW54B34B","zyfai","Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit\u002Fwithdraw anytime.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzyfai-sdk\u002FSKILL.md",[],[102,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123],"safe","ethereum","defi","Optimization","user","use","Wallet","base","deposit","withdraw","yield","arbitrum","non-custodial","passive","defi yield","earn","yield optimization",{"skillNo":125,"name":126,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":134,"publishedAt":48},"01M6Q5R337B5JSNER4P4YS03TN","zerion-api","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api\u002FSKILL.md",[129,130,133],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":131,"categoryName":132,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},[42,135,136,137,138,139,140,109,141,113,142,143,144,145,146,147,148,149,150],"zerion api","zerion","MCP","mcp server","server","blockchain","transactions","crypto wallet","crypto","evm","solana","query","across","positions","token","prices",{"skillNo":152,"name":153,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":159,"publishedAt":48},"01M6Q5QZFYTDAZMZ27BN5VZXAR","zerion-api-skill","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-skill\u002FSKILL.md",[156,157,158],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":131,"categoryName":132,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},[42,160,161,135,136,137,138,139,140,109,141,113,143,144,145,146,147,148,149,150],"api skill","zerion api skill",{"skillNo":163,"name":164,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":170,"publishedAt":48},"01M6Q5QW17QW98RA3FE45E4RD8","zerion-api-mcp","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-mcp\u002FSKILL.md",[167,168,169],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":131,"categoryName":132,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},[137,42,171,135,136,138,139,109,141,113,142,143,144,145,146,147,148,149,150],"zerion api mcp",{"skillNo":173,"name":174,"nameZh":6,"description":175,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":176,"categories":177,"keywords":181,"publishedAt":48},"01M6Q5QQYZB7A501BDEQWKGSJT","yahoo-finance-forex","Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR\u002FUSD, GBP\u002FUSD, USD\u002FJPY, etc.). Analyzes sentiment and provides trading context.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-forex\u002FSKILL.md",[178],{"categoryNo":179,"categoryName":180,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000040","财务",[182,183,184,185,186,187,44,188,189,41,190,191,192,193,194,195,196,197,198,30],"finance","yahoo finance","forex","yahoo","yahoo finance forex","github","sentiment","real-time","install","Market","usd","news","time","currency","gbp","pip","market data",{"skillNo":200,"name":201,"nameZh":6,"description":202,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":203,"categories":204,"keywords":206,"publishedAt":48},"01M6Q5QM6VS84WZVM7BKXXPF32","yahoo-finance","This skill should be used when the user asks to \"get stock prices\", \"check stock quotes\", \"look up earnings\", \"get financial data\", \"find trending stocks\", or needs stock market data from Yahoo Finance.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-cli\u002FSKILL.md",[205],{"categoryNo":179,"categoryName":180,"taxonomyType":25,"taxonomyTypeDesc":26},[182,183,185,207,208,209,210,211,212,191,213,214,215,216,217,218,219,220,150,198],"cli","homebrew","find","check","brew","up","local","get","stock","link","trending","sf","quotes","ln"]