diff --git a/.claude/skills/higress-clawdbot-integration/SKILL.md b/.claude/skills/higress-openclaw-integration/SKILL.md similarity index 85% rename from .claude/skills/higress-clawdbot-integration/SKILL.md rename to .claude/skills/higress-openclaw-integration/SKILL.md index e92aac60d..5ac0bab30 100644 --- a/.claude/skills/higress-clawdbot-integration/SKILL.md +++ b/.claude/skills/higress-openclaw-integration/SKILL.md @@ -1,11 +1,11 @@ --- -name: higress-clawdbot-integration -description: "Deploy and configure Higress AI Gateway for Clawdbot/OpenClaw integration. Use when: (1) User wants to deploy Higress AI Gateway, (2) User wants to configure Clawdbot/OpenClaw to use Higress as a model provider, (3) User mentions 'higress', 'ai gateway', 'model gateway', 'AI网关', (4) User wants to set up model routing or auto-routing, (5) User needs to manage LLM provider API keys, (6) User wants to track token usage and conversation history." +name: higress-openclaw-integration +description: "Deploy and configure Higress AI Gateway for OpenClaw integration. Use when: (1) User wants to deploy Higress AI Gateway, (2) User wants to configure OpenClaw to use Higress as a model provider, (3) User mentions 'higress', 'ai gateway', 'model gateway', 'AI网关', (4) User wants to set up model routing or auto-routing, (5) User needs to manage LLM provider API keys." --- # Higress AI Gateway Integration -Deploy and configure Higress AI Gateway for Clawdbot/OpenClaw integration with one-click deployment, model provider configuration, auto-routing, and session monitoring. +Deploy and configure Higress AI Gateway for OpenClaw integration with one-click deployment, model provider configuration, and auto-routing. ## Prerequisites @@ -112,28 +112,17 @@ After script completion: http://localhost:8001 ``` -### Step 5: Configure Clawdbot/OpenClaw Plugin +### Step 5: Configure OpenClaw Plugin -If user wants to use Higress with Clawdbot/OpenClaw, install appropriate plugin: +If user wants to use Higress with OpenClaw, install the plugin: #### Automatic Installation -Detect runtime and install correct plugin version: - ```bash -# Detect which runtime is installed -if command -v clawdbot &> /dev/null; then - RUNTIME="clawdbot" - RUNTIME_DIR="$HOME/.clawdbot" - PLUGIN_SRC="scripts/plugin-clawdbot" -elif command -v openclaw &> /dev/null; then - RUNTIME="openclaw" - RUNTIME_DIR="$HOME/.openclaw" - PLUGIN_SRC="scripts/plugin" -else - echo "Error: Neither clawdbot nor openclaw is installed" - exit 1 -fi +# Install plugin for OpenClaw +RUNTIME="openclaw" +RUNTIME_DIR="$HOME/.openclaw" +PLUGIN_SRC="scripts/plugin" # Install plugin PLUGIN_DEST="$RUNTIME_DIR/extensions/higress-ai-gateway" @@ -155,6 +144,8 @@ The plugin will guide you through an interactive setup for: 3. API Key (optional for local deployments) 4. Model list (auto-detected or manually specified) 5. Auto-routing default model (if using `higress/auto`) +4. Model list (auto-detected or manually specified) +5. Auto-routing default model (if using `higress/auto`) ### Step 6: Manage API Keys (optional) @@ -269,16 +260,11 @@ Gateway access logs are available at: $DATA_FOLDER/logs/access.log ``` -These logs can be used with **agent-session-monitor** skill for token tracking and conversation analysis. - ## Related Skills -- **higress-auto-router**: Configure automatic model routing using CLI commands +- **higress-auto-router**: Configure automatic model routing using CLI commands See: [higress-auto-router](../higress-auto-router/SKILL.md) -- **agent-session-monitor**: Monitor and track token usage across sessions - See: [agent-session-monitor](../agent-session-monitor/SKILL.md) - ## Examples ### Example 1: Basic Deployment with Dashscope @@ -315,15 +301,14 @@ curl 'http://localhost:8080/v1/chat/completions' \ -d '{"model": "qwen-turbo", "messages": [{"role": "user", "content": "Hello!"}]}' ``` -### Example 2: Full Integration with Clawdbot +### Example 2: Full Integration with OpenClaw -**User:** 完整配置Higress和Clawdbot的集成 +**User:** 完整配置Higress和OpenClaw的集成 **Steps:** 1. Deploy Higress AI Gateway (auto-detects timezone) -2. Install and configure Clawdbot plugin +2. Install and configure OpenClaw plugin 3. Enable auto-routing -4. Set up session monitoring **Response:** @@ -339,16 +324,13 @@ Selected plugin registry: higress-registry.cn-hangzhou.cr.aliyuncs.com - 容器镜像: Hangzhou (自动选择) - 插件镜像: Hangzhou (自动选择) -2. Clawdbot 插件配置: - Plugin installed at: /root/.clawdbot/extensions/higress-ai-gateway - Run: clawdbot models auth login --provider higress +2. OpenClaw 插件配置: + Plugin installed at: /root/.openclaw/extensions/higress-ai-gateway + Run: openclaw models auth login --provider higress 3. 自动路由: 已启用,使用 model="higress/auto" -4. 会话监控: - 日志路径: ./higress/logs/access.log - 需要我帮你配置自动路由规则吗? ``` diff --git a/.claude/skills/higress-clawdbot-integration/references/TROUBLESHOOTING.md b/.claude/skills/higress-openclaw-integration/references/TROUBLESHOOTING.md similarity index 100% rename from .claude/skills/higress-clawdbot-integration/references/TROUBLESHOOTING.md rename to .claude/skills/higress-openclaw-integration/references/TROUBLESHOOTING.md diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/README.md b/.claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/README.md similarity index 90% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/README.md rename to .claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/README.md index 1e0c873c1..f96077d09 100644 --- a/.claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/README.md +++ b/.claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/README.md @@ -19,7 +19,7 @@ This is a TypeScript-based provider plugin that enables Clawdbot to use Higress ## Installation -This plugin is automatically installed when you use the `higress-clawdbot-integration` skill. See the parent SKILL.md for complete installation instructions. +This plugin is automatically installed when you use the `higress-openclaw-integration` skill. See parent SKILL.md for complete installation instructions. ### Manual Installation @@ -64,9 +64,8 @@ clawdbot chat --model higress/auto "深入思考 这个问题应该怎么解决? ## Related Resources -- **Parent Skill**: [higress-clawdbot-integration](../SKILL.md) +- **Parent Skill**: [higress-openclaw-integration](../SKILL.md) - **Auto-routing Configuration**: [higress-auto-router](../../higress-auto-router/SKILL.md) -- **Session Monitoring**: [agent-session-monitor](../../agent-session-monitor/SKILL.md) - **Higress AI Gateway**: https://github.com/higress-group/higress-standalone ## Compatibility diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/clawdbot.plugin.json b/.claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/clawdbot.plugin.json similarity index 100% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/clawdbot.plugin.json rename to .claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/clawdbot.plugin.json diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/index.ts b/.claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/index.ts similarity index 85% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/index.ts rename to .claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/index.ts index f8b5a802b..bde146c33 100644 --- a/.claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/index.ts +++ b/.claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/index.ts @@ -2,32 +2,47 @@ import { emptyPluginConfigSchema } from "clawdbot/plugin-sdk"; const DEFAULT_GATEWAY_URL = "http://localhost:8080"; const DEFAULT_CONSOLE_URL = "http://localhost:8001"; + +// Model-specific context window and max tokens configurations +const MODEL_CONFIG: Record = { + "gpt-5.3-codex": { contextWindow: 400_000, maxTokens: 128_000 }, + "gpt-5-mini": { contextWindow: 400_000, maxTokens: 128_000 }, + "gpt-5-nano": { contextWindow: 400_000, maxTokens: 128_000 }, + "claude-opus-4.6": { contextWindow: 1_000_000, maxTokens: 128_000 }, + "claude-sonnet-4.5": { contextWindow: 1_000_000, maxTokens: 64_000 }, + "claude-haiku-4.5": { contextWindow: 200_000, maxTokens: 64_000 }, + "qwen3-coder-plus": { contextWindow: 1_000_000, maxTokens: 64_000 }, + "deepseek-chat": { contextWindow: 256_000, maxTokens: 128_000 }, + "deepseek-reasoner": { contextWindow: 256_000, maxTokens: 128_000 }, + "kimi-k2.5": { contextWindow: 256_000, maxTokens: 128_000 }, + "glm-5": { contextWindow: 200_000, maxTokens: 128_000 }, + "MiniMax-M2.1": { contextWindow: 196_000, maxTokens: 196_000 }, +}; + +// Default values for unknown models const DEFAULT_CONTEXT_WINDOW = 128_000; -const DEFAULT_MAX_TOKENS = 8192; +const DEFAULT_MAX_TOKENS = 8_192; // Common models that Higress AI Gateway typically supports const DEFAULT_MODEL_IDS = [ // Auto-routing special model "higress/auto", // OpenAI models - "gpt-5.2", + "gpt-5.3-codex", "gpt-5-mini", "gpt-5-nano", // Anthropic models - "claude-opus-4.5", + "claude-opus-4.6", "claude-sonnet-4.5", "claude-haiku-4.5", // Qwen models - "qwen3-turbo", - "qwen3-plus", - "qwen3-max", - "qwen3-coder-480b-a35b-instruct", + "qwen3-coder-plus", // DeepSeek models "deepseek-chat", "deepseek-reasoner", // Other common models "kimi-k2.5", - "glm-4.7", + "glm-5", "MiniMax-M2.1", ] as const; @@ -60,15 +75,17 @@ function parseModelIds(input: string): string[] { function buildModelDefinition(modelId: string) { const isAutoModel = modelId === "higress/auto"; + const config = MODEL_CONFIG[modelId] || { contextWindow: DEFAULT_CONTEXT_WINDOW, maxTokens: DEFAULT_MAX_TOKENS }; + return { id: modelId, name: isAutoModel ? "Higress Auto Router" : modelId, api: "openai-completions", - reasoning: false, + reasoning: true, input: ["text", "image"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, - contextWindow: DEFAULT_CONTEXT_WINDOW, - maxTokens: DEFAULT_MAX_TOKENS, + contextWindow: config.contextWindow, + maxTokens: config.maxTokens, }; } @@ -184,13 +201,13 @@ const higressPlugin = { const modelIds = parseModelIds(modelInput); const hasAutoModel = modelIds.includes("higress/auto"); - + // FIX: Avoid double prefix - if modelId already starts with provider, don't add prefix again - const defaultModelId = hasAutoModel - ? "higress/auto" + const defaultModelId = hasAutoModel + ? "higress/auto" : (modelIds[0] ?? "qwen-turbo"); - const defaultModelRef = defaultModelId.startsWith("higress/") - ? defaultModelId + const defaultModelRef = defaultModelId.startsWith("higress/") + ? defaultModelId : `higress/${defaultModelId}`; // Step 7: Configure default model for auto-routing @@ -231,8 +248,8 @@ const higressPlugin = { models: Object.fromEntries( modelIds.map((modelId) => { // FIX: Avoid double prefix - only add provider prefix if not already present - const modelRef = modelId.startsWith("higress/") - ? modelId + const modelRef = modelId.startsWith("higress/") + ? modelId : `higress/${modelId}`; return [modelRef, {}]; }), @@ -261,17 +278,12 @@ const higressPlugin = { `Gateway endpoint: ${gatewayUrl}/v1/chat/completions`, `Console: ${consoleUrl}`, "", - "🎯 Recommended Skills (install via Clawdbot conversation):", + "🎯 Recommended Skills (install via OpenClaw conversation):", "", "1. Auto-Routing Skill:", " Configure automatic model routing based on message content", " https://github.com/alibaba/higress/tree/main/.claude/skills/higress-auto-router", ' Say: "Install higress-auto-router skill"', - "", - "2. Agent Session Monitor Skill:", - " Track token usage and monitor conversation history", - " https://github.com/alibaba/higress/tree/main/.claude/skills/agent-session-monitor", - ' Say: "Install agent-session-monitor skill"', ], }; }, diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/package.json b/.claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/package.json similarity index 100% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin-clawdbot/package.json rename to .claude/skills/higress-openclaw-integration/scripts/plugin-clawdbot/package.json diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin/README.md b/.claude/skills/higress-openclaw-integration/scripts/plugin/README.md similarity index 64% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin/README.md rename to .claude/skills/higress-openclaw-integration/scripts/plugin/README.md index 3c05277dd..239c3ec2f 100644 --- a/.claude/skills/higress-clawdbot-integration/scripts/plugin/README.md +++ b/.claude/skills/higress-openclaw-integration/scripts/plugin/README.md @@ -1,10 +1,10 @@ # Higress AI Gateway Plugin -OpenClaw/Clawdbot model provider plugin for Higress AI Gateway with auto-routing support. +OpenClaw model provider plugin for Higress AI Gateway with auto-routing support. ## What is this? -This is a TypeScript-based provider plugin that enables Clawdbot and OpenClaw to use Higress AI Gateway as a model provider. It provides: +This is a TypeScript-based provider plugin that enables OpenClaw to use Higress AI Gateway as a model provider. It provides: - **Auto-routing support**: Use `higress/auto` to intelligently route requests based on message content - **Dynamic model discovery**: Auto-detect available models from Higress Console @@ -19,30 +19,18 @@ This is a TypeScript-based provider plugin that enables Clawdbot and OpenClaw to ## Installation -This plugin is automatically installed when you use the `higress-clawdbot-integration` skill. See the parent SKILL.md for complete installation instructions. +This plugin is automatically installed when you use the `higress-openclaw-integration` skill. See parent SKILL.md for complete installation instructions. ### Manual Installation If you need to install manually: ```bash -# Detect runtime -if command -v clawdbot &> /dev/null; then - RUNTIME_DIR="$HOME/.clawdbot" -elif command -v openclaw &> /dev/null; then - RUNTIME_DIR="$HOME/.openclaw" -else - echo "Error: Neither clawdbot nor openclaw is installed" - exit 1 -fi - # Copy plugin files -mkdir -p "$RUNTIME_DIR/extensions/higress-ai-gateway" -cp -r ./* "$RUNTIME_DIR/extensions/higress-ai-gateway/" +mkdir -p "$HOME/.openclaw/extensions/higress-ai-gateway" +cp -r ./* "$HOME/.openclaw/extensions/higress-ai-gateway/" # Configure provider -clawdbot models auth login --provider higress -# or openclaw models auth login --provider higress ``` @@ -51,7 +39,7 @@ openclaw models auth login --provider higress After installation, configure Higress as a model provider: ```bash -clawdbot models auth login --provider higress +openclaw models auth login --provider higress ``` The plugin will prompt for: @@ -67,7 +55,7 @@ To use auto-routing, include `higress/auto` in your model list during configurat ```bash # Use auto-routing -clawdbot chat --model higress/auto "深入思考 这个问题应该怎么解决?" +openclaw chat --model higress/auto "深入思考 这个问题应该怎么解决?" # The gateway will automatically route to the appropriate model based on: # - Message content triggers (configured via higress-auto-router skill) @@ -76,15 +64,13 @@ clawdbot chat --model higress/auto "深入思考 这个问题应该怎么解决? ## Related Resources -- **Parent Skill**: [higress-clawdbot-integration](../SKILL.md) +- **Parent Skill**: [higress-openclaw-integration](../SKILL.md) - **Auto-routing Configuration**: [higress-auto-router](../../higress-auto-router/SKILL.md) -- **Session Monitoring**: [agent-session-monitor](../../agent-session-monitor/SKILL.md) - **Higress AI Gateway**: https://github.com/higress-group/higress-standalone ## Compatibility - **OpenClaw**: v2.0.0+ -- **Clawdbot**: v2.0.0+ - **Higress AI Gateway**: All versions ## License diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin/index.ts b/.claude/skills/higress-openclaw-integration/scripts/plugin/index.ts similarity index 85% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin/index.ts rename to .claude/skills/higress-openclaw-integration/scripts/plugin/index.ts index caf91b2ec..69db821b3 100644 --- a/.claude/skills/higress-clawdbot-integration/scripts/plugin/index.ts +++ b/.claude/skills/higress-openclaw-integration/scripts/plugin/index.ts @@ -2,32 +2,47 @@ import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; const DEFAULT_GATEWAY_URL = "http://localhost:8080"; const DEFAULT_CONSOLE_URL = "http://localhost:8001"; + +// Model-specific context window and max tokens configurations +const MODEL_CONFIG: Record = { + "gpt-5.3-codex": { contextWindow: 400_000, maxTokens: 128_000 }, + "gpt-5-mini": { contextWindow: 400_000, maxTokens: 128_000 }, + "gpt-5-nano": { contextWindow: 400_000, maxTokens: 128_000 }, + "claude-opus-4.6": { contextWindow: 1_000_000, maxTokens: 128_000 }, + "claude-sonnet-4.5": { contextWindow: 1_000_000, maxTokens: 64_000 }, + "claude-haiku-4.5": { contextWindow: 200_000, maxTokens: 64_000 }, + "qwen3-coder-plus": { contextWindow: 1_000_000, maxTokens: 64_000 }, + "deepseek-chat": { contextWindow: 256_000, maxTokens: 128_000 }, + "deepseek-reasoner": { contextWindow: 256_000, maxTokens: 128_000 }, + "kimi-k2.5": { contextWindow: 256_000, maxTokens: 128_000 }, + "glm-5": { contextWindow: 200_000, maxTokens: 128_000 }, + "MiniMax-M2.1": { contextWindow: 196_000, maxTokens: 196_000 }, +}; + +// Default values for unknown models const DEFAULT_CONTEXT_WINDOW = 128_000; -const DEFAULT_MAX_TOKENS = 8192; +const DEFAULT_MAX_TOKENS = 8_192; // Common models that Higress AI Gateway typically supports const DEFAULT_MODEL_IDS = [ // Auto-routing special model "higress/auto", // OpenAI models - "gpt-5.2", + "gpt-5.3-codex", "gpt-5-mini", "gpt-5-nano", // Anthropic models - "claude-opus-4.5", + "claude-opus-4.6", "claude-sonnet-4.5", "claude-haiku-4.5", // Qwen models - "qwen3-turbo", - "qwen3-plus", - "qwen3-max", - "qwen3-coder-480b-a35b-instruct", + "qwen3-coder-plus", // DeepSeek models "deepseek-chat", "deepseek-reasoner", // Other common models "kimi-k2.5", - "glm-4.7", + "glm-5", "MiniMax-M2.1", ] as const; @@ -60,15 +75,17 @@ function parseModelIds(input: string): string[] { function buildModelDefinition(modelId: string) { const isAutoModel = modelId === "higress/auto"; + const config = MODEL_CONFIG[modelId] || { contextWindow: DEFAULT_CONTEXT_WINDOW, maxTokens: DEFAULT_MAX_TOKENS }; + return { id: modelId, name: isAutoModel ? "Higress Auto Router" : modelId, api: "openai-completions", - reasoning: false, + reasoning: true, input: ["text", "image"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, - contextWindow: DEFAULT_CONTEXT_WINDOW, - maxTokens: DEFAULT_MAX_TOKENS, + contextWindow: config.contextWindow, + maxTokens: config.maxTokens, }; } @@ -184,13 +201,13 @@ const higressPlugin = { const modelIds = parseModelIds(modelInput); const hasAutoModel = modelIds.includes("higress/auto"); - + // FIX: Avoid double prefix - if modelId already starts with provider, don't add prefix again - const defaultModelId = hasAutoModel - ? "higress/auto" + const defaultModelId = hasAutoModel + ? "higress/auto" : (modelIds[0] ?? "qwen-turbo"); - const defaultModelRef = defaultModelId.startsWith("higress/") - ? defaultModelId + const defaultModelRef = defaultModelId.startsWith("higress/") + ? defaultModelId : `higress/${defaultModelId}`; // Step 7: Configure default model for auto-routing @@ -231,8 +248,8 @@ const higressPlugin = { models: Object.fromEntries( modelIds.map((modelId) => { // FIX: Avoid double prefix - only add provider prefix if not already present - const modelRef = modelId.startsWith("higress/") - ? modelId + const modelRef = modelId.startsWith("higress/") + ? modelId : `higress/${modelId}`; return [modelRef, {}]; }), @@ -261,17 +278,12 @@ const higressPlugin = { `Gateway endpoint: ${gatewayUrl}/v1/chat/completions`, `Console: ${consoleUrl}`, "", - "🎯 Recommended Skills (install via Clawdbot conversation):", + "🎯 Recommended Skills (install via OpenClaw conversation):", "", "1. Auto-Routing Skill:", " Configure automatic model routing based on message content", " https://github.com/alibaba/higress/tree/main/.claude/skills/higress-auto-router", ' Say: "Install higress-auto-router skill"', - "", - "2. Agent Session Monitor Skill:", - " Track token usage and monitor conversation history", - " https://github.com/alibaba/higress/tree/main/.claude/skills/agent-session-monitor", - ' Say: "Install agent-session-monitor skill"', ], }; }, diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin/openclaw.plugin.json b/.claude/skills/higress-openclaw-integration/scripts/plugin/openclaw.plugin.json similarity index 100% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin/openclaw.plugin.json rename to .claude/skills/higress-openclaw-integration/scripts/plugin/openclaw.plugin.json diff --git a/.claude/skills/higress-clawdbot-integration/scripts/plugin/package.json b/.claude/skills/higress-openclaw-integration/scripts/plugin/package.json similarity index 100% rename from .claude/skills/higress-clawdbot-integration/scripts/plugin/package.json rename to .claude/skills/higress-openclaw-integration/scripts/plugin/package.json