linkai-agent
npx skills add https://github.com/zhayujie/chatgpt-on-wechat --skill linkai-agent
Agent 安装分布
Skill 文档
LinkAI Agent Caller
Call LinkAI applications and workflows through API. Supports multiple apps/workflows configured in config.json.
The available apps are dynamically loaded from config.json at skill loading time.
Setup
This skill requires a LinkAI API key. If not configured:
- Get your API key from https://link-ai.tech/console/api-keys
- Set the key using:
env_config(action="set", key="LINKAI_API_KEY", value="your-key")
Configuration
- Copy
config.json.templatetoconfig.json - Configure your apps/workflows:
{
"apps": [
{
"app_code": "your_app_code",
"app_name": "App Name",
"app_description": "What this app does"
}
]
}
- The skill description will be automatically updated when the agent loads this skill
Usage
Important: Scripts are located relative to this skill’s base directory.
When you see this skill in <available_skills>, note the <base_dir> path.
CRITICAL: Always use bash command to execute the script:
# General pattern (MUST start with bash):
bash "<base_dir>/scripts/call.sh" "<app_code>" "<question>" [model] [stream] [timeout]
# DO NOT execute the script directly like this (WRONG):
# "<base_dir>/scripts/call.sh" ...
# Parameters:
# - app_code: LinkAI app or workflow code (required)
# - question: User question (required)
# - model: Override model (optional, uses app default if not specified)
# - stream: Enable streaming (true/false, default: false)
# - timeout: curl timeout in seconds (default: 120, recommended for video/image generation)
IMPORTANT – Timeout Configuration:
- The script has a default timeout of 120 seconds (suitable for most cases)
- For complex tasks (video generation, large workflows), pass a longer timeout as the 5th parameter
- The bash tool also needs sufficient timeout – set its
timeoutparameter accordingly - Example:
bash(command="bash <script> <app_code> <question> '' 'false' 180", timeout=200)
Examples
Call an app (uses default 60s timeout)
bash(command='bash "<base_dir>/scripts/call.sh" "G7z6vKwp" "What is AI?"', timeout=60)
Call an app with specific model
bash(command='bash "<base_dir>/scripts/call.sh" "G7z6vKwp" "Explain machine learning" "LinkAI-4.1"', timeout=60)
Call a workflow with custom timeout (video generation)
# Pass timeout as 5th parameter to script, and set bash timeout slightly longer
bash(command='bash "<base_dir>/scripts/call.sh" "workflow_code" "Generate a sunset video" "" "false" "180"', timeout=180)
bash "<base_dir>/scripts/call.sh" "workflow_code" "Analyze this data: ..."
Supported Models
You can specify any LinkAI supported model:
LinkAI-4.1– Latest GPT-4.1 model (1000K context)LinkAI-4.1-mini– GPT-4.1 mini (1000K context)LinkAI-4o– GPT-4o model (128K context)LinkAI-4o-mini– GPT-4o mini (128K context)deepseek-chat– DeepSeek-V3 (64K context)deepseek-reasoner– DeepSeek-R1 reasoning modelclaude-4-sonnet– Claude 4 Sonnet (200K context)gemini-2.5-pro– Gemini 2.5 Pro (1000K context)- And many more…
Full model list: https://link-ai.tech/console/models
Response Format
Success response:
{
"app_code": "G7z6vKwp",
"content": "AI stands for Artificial Intelligence...",
"usage": {
"prompt_tokens": 10,
"completion_tokens": 50,
"total_tokens": 60
}
}
Error response:
{
"error": "Error description",
"message": "Detailed error message"
}
Features
- â Multiple Apps: Configure and call multiple LinkAI apps/workflows
- â Dynamic Loading: Apps are loaded from config.json at runtime
- â Model Override: Optionally specify model per request
- â Streaming Support: Enable streaming output
- â Knowledge Base: Apps can use configured knowledge bases
- â Plugins: Apps can use enabled plugins (image recognition, web search, etc.)
- â Workflows: Execute complex multi-step workflows
Notes
- Each app/workflow maintains its own configuration (prompt, model, temperature, etc.)
- Apps can have knowledge bases attached for domain-specific Q&A
- Workflows execute from start node to end node and return final output
- Token usage and costs depend on the model used
- See LinkAI documentation for pricing: https://link-ai.tech/console/funds
- The skill description is automatically generated from config.json when loaded
Troubleshooting
“LINKAI_API_KEY environment variable is not set”
- Use env_config tool to set the API key
“app_code is required”
- Make sure you’re passing the app_code as the first parameter
“åºç¨ä¸å娔 (App not found)
- Check that the app_code is correct
- Ensure you have access to the app
“è´¦å·ç§¯åé¢åº¦ä¸è¶³” (Insufficient credits)
- Top up your LinkAI account credits