Agent Skillsdecolua/9router › 9router-chat

9router-chat

GitHub

通过9Router网关调用LLM,支持OpenAI和Anthropic格式。用于聊天、代码生成及文本摘要,具备流式传输与多提供商自动降级能力。

skills/9router-chat/SKILL.md decolua/9router

触发场景

用户希望进行对话或提问 需要生成代码片段 要求总结文本内容 执行自定义Prompt

安装

npx skills add decolua/9router --skill 9router-chat -g -y
更多选项

不安装直接使用

npx skills use decolua/9router@9router-chat

指定 Agent (Claude Code)

npx skills add decolua/9router --skill 9router-chat -a claude-code -g -y

安装 repo 全部 skill

npx skills add decolua/9router --all -g -y

预览 repo 内 skill

npx skills add decolua/9router --list

SKILL.md

Frontmatter
{
    "name": "9router-chat",
    "description": "Chat \/ code generation via 9Router using OpenAI \/v1\/chat\/completions or Anthropic \/v1\/messages format with streaming + auto-fallback combos. Use when the user wants to ask an LLM, generate code, summarize text, or run prompts through 9Router."
}

9Router — Chat

Requires NINEROUTER_URL (and NINEROUTER_KEY if auth enabled). See https://raw.githubusercontent.com/decolua/9router/refs/heads/master/skills/9router/SKILL.md for setup.

Endpoints

  • POST $NINEROUTER_URL/v1/chat/completions — OpenAI format
  • POST $NINEROUTER_URL/v1/messages — Anthropic format

Discover

curl $NINEROUTER_URL/v1/models | jq '.data[].id'
# Per-model metadata (contextWindow, params)
curl "$NINEROUTER_URL/v1/models/info?id=openai/gpt-4o"

Combos (e.g. vip, mycodex) auto-fallback through multiple providers.

OpenAI format

curl -X POST $NINEROUTER_URL/v1/chat/completions \
  -H "Authorization: Bearer $NINEROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-5","messages":[{"role":"user","content":"Hi"}],"stream":false}'

JS (OpenAI SDK):

import OpenAI from "openai";
const client = new OpenAI({ baseURL: `${process.env.NINEROUTER_URL}/v1`, apiKey: process.env.NINEROUTER_KEY });
const res = await client.chat.completions.create({
  model: "openai/gpt-5",
  messages: [{ role: "user", content: "Hi" }],
  stream: true,
});
for await (const chunk of res) process.stdout.write(chunk.choices[0]?.delta?.content || "");

Anthropic format

curl -X POST $NINEROUTER_URL/v1/messages \
  -H "Authorization: Bearer $NINEROUTER_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"cc/claude-opus-4-7","max_tokens":1024,"messages":[{"role":"user","content":"Hi"}]}'

Response shape

OpenAI (/v1/chat/completions):

{ "id": "chatcmpl-...", "object": "chat.completion", "model": "openai/gpt-5",
  "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello!" }, "finish_reason": "stop" }],
  "usage": { "prompt_tokens": 8, "completion_tokens": 2, "total_tokens": 10 } }

Streaming (stream:true) emits SSE: data: {choices:[{delta:{content:"..."}}]}\n\n ... data: [DONE]\n\n.

Anthropic (/v1/messages):

{ "id": "msg_...", "type": "message", "role": "assistant", "model": "cc/claude-opus-4-7",
  "content": [{ "type": "text", "text": "Hello!" }],
  "stop_reason": "end_turn", "usage": { "input_tokens": 8, "output_tokens": 2 } }

版本历史

  • 7f436e2 当前 2026-07-05 15:26

同 Skill 集合

skills/9router-embeddings/SKILL.md
skills/9router-image/SKILL.md
skills/9router-stt/SKILL.md
skills/9router-tts/SKILL.md
skills/9router-web-fetch/SKILL.md
skills/9router-web-search/SKILL.md
skills/9router/SKILL.md

元信息

文件数
0
版本
7f436e2
Hash
1c9db850
收录时间
2026-07-05 15:26

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-14 13:15
浙ICP备14020137号-1 $访客地图$