Skill: cznorth/deepseek-ai-search (version 1.0.0)

--- name: ai-search version: 1.0.0 description: Search the web using AI models with built-in search capability. Use for live information, news, documentation, or research topics. metadata: { "openclaw": { "emoji": "🌐", "requires": { "bins": ["python3"], "env":["AI_SEARCH_API_KEY"]}, "primaryEnv":"AI_SEARCH_API_KEY" } } --- # AI Search Search the web via AI models with built-in search functionality. ## Prerequisites ### API Key Configuration This skill requires an **AI_SEARCH_API_KEY** to be configured. **Public API Key (free to use):** ``` [REDACTED_SECRET] ``` Set it in your environment: ```bash export AI_SEARCH_API_KEY="[REDACTED_SECRET]" export AI_SEARCH_BASE_URL="https://ai.ch66.top" ``` ## Usage ```bash python3 skills/ai-search/scripts/search.py '<JSON>' ``` ## Request Parameters | Param | Type | Required | Default | Description | |-------|------|----------|---------|-------------| | query | str | yes | - | Search query | | model | str | no | deepseek-expert-chat-search | Model to use for search | | verbose | bool | no | true | Show reasoning and stats | ## Available Search Models | Model | Description | Best For | |-------|-------------|----------| | deepseek-expert-chat-search | Expert chat with search (recommended) | General search, professional topics | | deepseek-expert-reasoner-search | Expert reasoner with search | Deep analysis, research | | deepseek-chat-search | Chat with search | Quick answers | | deepseek-reasoner-search | Reasoner with search | Complex reasoning queries | | deepseek-vision-chat-search | Vision chat with search | Image + text queries | | deepseek-vision-reasoner-search | Vision reasoner with search | Image analysis + search | ## Examples ```bash # Basic search python3 scripts/search.py '{"query":"2024巴黎奥运会金牌榜"}' # Quick search (concise output) python3 scripts/search.py '{"query":"今天天气","verbose":false}' # Use specific model python3 scripts/search.py '{"query":"最新AI技术发展","model":"deepseek-chat-search"}' # Image search (vision model) python3 scripts/search.py '{"query":"分析这张图片","model":"deepseek-vision-chat-search"}' ``` ## Response Format By default (`verbose: true`), the output includes: - **推理过程** (Reasoning): Model's thinking process - **搜索结果** (Search Result): Final answer - **使用统计** (Usage Stats): Token consumption With `verbose: false`, only the search result is shown. ## Current Status Fully functional.

path: README.md
content: # AI Search Skill

A Claude Code skill that enables web search using AI models with built-in search capability.

## Features

- Web search powered by DeepSeek AI models
- Multiple search models for different use cases
- Vision-capable models for image + text queries
- Reasoning transparency (see the model's thinking process)
- Free public API key available

## Installation

### Option 1: Clone to Claude Code skills directory

```bash
cd ~/.claude/skills/
git clone https://github.com/Cznorth/ai-search-skill.git ai-search
```

### Option 2: Manual installation

1. Create the skill directory:
```bash
mkdir -p ~/.claude/skills/ai-search/scripts
```

2. Download the files:
- `SKILL.md` → `~/.claude/skills/ai-search/SKILL.md`
- `scripts/search.py` → `~/.claude/skills/ai-search/scripts/search.py`

## Configuration

Set the environment variables:

```bash
export AI_SEARCH_API_KEY="your-api-key"
export AI_SEARCH_BASE_URL="https://ai.ch66.top"
```

Or add them to your `~/.claude/settings.json`:

```json
{
  "env": {
    "AI_SEARCH_API_KEY": "your-api-key",
    "AI_SEARCH_BASE_URL": "https://ai.ch66.top"
  }
}
```

### Public API Key

A free public API key is available for testing:
```
[REDACTED_SECRET]
```

> Note: The public key may have limited availability for search models. If you encounter "model_not_found" errors, the search model channels may be temporarily unavailable.

## Usage

### In Claude Code

Once installed, the skill is automatically available. You can invoke it using:

```bash
/ai-search
```

### Command Line

```bash
python3 ~/.claude/skills/ai-search/scripts/search.py '{"query":"your search query"}'
```

## Available Models

| Model | Description | Best For |
|-------|-------------|----------|
| `deepseek-expert-chat-search` | Expert chat with search (recommended) | General search, professional topics |
| `deepseek-expert-reasoner-search` | Expert reasoner with search | Deep analysis, research |
| `deepseek-chat-search` | Chat with search | Quick answers |
| `deepseek-reasoner-search` | Reasoner with search | Complex reasoning queries |
| `deepseek-vision-chat-search` | Vision chat with search | Image + text queries |
| `deepseek-vision-reasoner-search` | Vision reasoner with search | Image analysis + search |

## Parameters

| Param | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| query | str | yes | - | Search query |
| model | str | no | deepseek-expert-chat-search | Model to use |
| verbose | bool | no | true | Show reasoning and stats |

## Examples

```bash
# Basic search
python3 scripts/search.py '{"query":"2024巴黎奥运会金牌榜"}'

# Quick search (concise output)
python3 scripts/search.py '{"query":"今天新闻","verbose":false}'

# Use specific model
python3 scripts/search.py '{"query":"AI最新进展","model":"deepseek-chat-search"}'
```

## Response Format

With `verbose: true` (default):
```
=== 推理过程 ===
[Model's reasoning process]

=== 搜索结果 ===
[Final answer]

=== 使用统计 ===
提示词: X tokens
完成: Y tokens
总计: Z tokens
```

With `verbose: false`:
```
=== 搜索结果 ===
[Final answer only]
```

## Requirements

- Python 3.x
- `requests` library (`pip install requests`)

## License

MIT License

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


path: scripts/search.py
content: import sys
import json
import requests
import os
from typing import Dict, Optional

# Ensure stdout uses UTF-8 encoding
if sys.platform == 'win32':
    import io
    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')


def ai_search(query: str, model: str = "deepseek-expert-chat-search", stream: bool = False) -> dict:
    """Execute search using AI model with built-in search capability."""
    base_url = os.environ.get("AI_SEARCH_BASE_URL", "https://ai.ch66.top")
    [REDACTED_SECRET]"AI_SEARCH_API_KEY")

    if not api_key:
        raise ValueError("AI_SEARCH_API_KEY environment variable is not set")

    url = f"{base_url}/v1/chat/completions"
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {api_key}"
    }

    payload = {
        "model": model,
        "messages": [
            {"role": "system", "content": "你是一个具有联网搜索能力的AI助手，每次回答前请先搜索互联网获取最新信息。"},
            {"role": "user", "content": query}
        ],
        "stream": stream,
        "tools": [{"type": "web_search", "web_search": {"enabled": True}}],
        "search_enabled": True
    }

    response = requests.post(url, json=payload, headers=headers, timeout=90)
    response.raise_for_status()
    return response.json()


def format_result(result: dict, verbose: bool = True) -> str:
    """Format the search result for display."""
    if "choices" not in result or len(result["choices"]) == 0:
        return json.dumps(result, indent=2, ensure_ascii=False)

    output_parts = []

    # Extract the main response
    message = result["choices"][0].get("message", {})

    # Include reasoning content if available and verbose mode
    if verbose and "reasoning_content" in message:
        output_parts.append("=== 推理过程 ===")
        output_parts.append(message["reasoning_content"])
        output_parts.append("")

    # Include main content
    if "content" in message:
        output_parts.append("=== 搜索结果 ===")
        output_parts.append(message["content"])

    # Include usage info if verbose mode
    if verbose and "usage" in result:
        output_parts.append("")
        output_parts.append("=== 使用统计 ===")
        usage = result["usage"]
        output_parts.append(f"提示词: {usage.get('prompt_tokens', 0)} tokens")
        output_parts.append(f"完成: {usage.get('completion_tokens', 0)} tokens")
        output_parts.append(f"总计: {usage.get('total_tokens', 0)} tokens")

    return "\n".join(output_parts)


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python search.py '<JSON>'")
        print("\nParameters:")
        print("  query   - (required) Search query")
        print("  model   - (optional) Model name, default: deepseek-reasoner-search")
        print("  verbose - (optional) Show reasoning and stats, default: true")
        print("\nAvailable models:")
        print("  - deepseek-reasoner-search (recommended)")
        print("  - deepseek-chat-search")
        print("  - deepseek-expert-chat-search")
        print("  - deepseek-expert-reasoner-search")
        print("  - deepseek-vision-chat-search")
        print("  - deepseek-vision-reasoner-search")
        print("\nExample:")
        print('  python search.py \'{"query":"最新科技新闻"}\'')
        print('  python search.py \'{"query":"天气","model":"deepseek-chat-search","verbose":false}\'')
        sys.exit(1)

    query_str = sys.argv[1]
    parse_data = {}

    try:
        parse_data = json.loads(query_str)
    except json.JSONDecodeError as e:
        print(f"JSON parse error: {e}")
        sys.exit(1)

    if "query" not in parse_data:
        print("Error: 'query' field is required in request body.")
        sys.exit(1)

    query = parse_data["query"]
    model = parse_data.get("model", "deepseek-expert-chat-search")
    stream = parse_data.get("stream", False)
    verbose = parse_data.get("verbose", True)

    try:
        result = ai_search(query, model, stream)
        print(format_result(result, verbose))
    except requests.exceptions.RequestException as e:
        print(f"Request error: {str(e)}")
        sys.exit(1)
    except ValueError as e:
        print(f"Value error: {str(e)}")
        sys.exit(1)
    except Exception as e:
        print(f"Error: {str(e)}")
        sys.exit(1)


Security scan verdicts — ClawScan: suspicious | static analysis: suspicious | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)