intelliscript-ai


Nameintelliscript-ai JSON
Version 2.1.0 PyPI version JSON
download
home_pagehttps://github.com/hongping-zh/intelliscript
SummaryWorld's first AI CLI tool with Google LangExtract integration for command generation and data analysis
upload_time2025-08-15 03:34:05
maintainerNone
docs_urlNone
authorIntelliScript Team
requires_python>=3.8
licenseNone
keywords ai cli command-line langextract data-extraction visualization automation llm openai ollama anthropic google-gemini data-analysis reports
VCS
bugtrack_url
requirements click requests pytest anthropic cryptography boto3 google-cloud-storage PyJWT secure-smtplib
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # IntelliScript CLI

<div align="center">

![IntelliScript CLI](https://img.shields.io/badge/IntelliScript-Enterprise%20AI%20Platform-blue?style=for-the-badge&logo=robot)
![Version](https://img.shields.io/badge/version-1.0.0-green?style=for-the-badge)
![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)
![Python](https://img.shields.io/badge/python-3.8%2B-blue?style=for-the-badge&logo=python)

![Build Status](https://github.com/hongping-zh/intelliscript/workflows/CI/badge.svg)
![PyPI version](https://badge.fury.io/py/intelliscript-cli.svg)
![Downloads](https://pepy.tech/badge/intelliscript-cli)
![GitHub Stars](https://img.shields.io/github/stars/hongping-zh/intelliscript?style=social)

**🚀 Enterprise-Grade AI Model Management Platform**

*Multi-model AI integration • Cost optimization • Enterprise security*

[🚀 Quick Start](#-5-minute-quick-start) • [📺 Live Demo](#-live-demonstrations) • [💡 Features](#-core-features) • [📦 Installation](#-installation) • [📚 Documentation](#-complete-documentation)

</div>

---

## 📺 **Live Demonstrations**

### 🎥 **Basic Usage Demo**
![IntelliScript Basic Demo](https://raw.githubusercontent.com/hongping-zh/intelliscript/main/docs/gifs/basic-usage-demo.gif)
*Basic AI query with automatic model selection and cost tracking*

### 🎥 **Multi-Model Cost Optimization**
![Cost Optimization Demo](https://raw.githubusercontent.com/hongping-zh/intelliscript/main/docs/gifs/cost-optimization-demo.gif)
*Intelligent routing between Claude, Gemini, and GPT-4 for optimal cost-performance*

### 🎥 **Enterprise Dashboard**
![Enterprise Dashboard Demo](https://raw.githubusercontent.com/hongping-zh/intelliscript/main/docs/gifs/dashboard-demo.gif)
*Real-time usage analytics and team management interface*

> **📝 Note**: GIF demonstrations show actual IntelliScript CLI in action. [Create your own demo](docs/CREATE_DEMO.md)

---

## 🚀 **5-Minute Quick Start**

### **Step 1: Installation**
```bash
# Clone the repository
git clone https://github.com/hongping-zh/intelliscript.git
cd intelliscript

# Install dependencies
pip install -r requirements.txt

# Optional: Install globally
pip install -e .
```

### **Step 2: Initialize Configuration**
```bash
# Initialize IntelliScript
intelligript init

# This creates:
# ~/.intelliscript/
# ├── config.json      # Main configuration
# ├── usage.log        # Usage statistics  
# ├── models/          # Model configurations
# └── cache/           # Response caching
```

### **Step 3: Configure AI Models**

<details>
<summary><strong>🤖 Claude Sonnet 4.0 Setup</strong></summary>

```bash
# Add Claude API key
intelligript config add-model claude-sonnet-4 \
  --api-key "your-anthropic-api-key" \
  --priority high \
  --use-cases "analysis,coding,reasoning"

# Test connection
intelligript test claude-sonnet-4
✅ Claude Sonnet 4.0: Connected successfully
💰 Rate: $15/1M tokens input, $75/1M tokens output
```
</details>

<details>
<summary><strong>🧠 Google Gemini 2.5 Pro Setup</strong></summary>

```bash
# Add Gemini API key
intelligript config add-model gemini-2.5-pro \
  --api-key "your-google-api-key" \
  --priority medium \
  --use-cases "multimodal,documents,translation"

# Enable multimodal features
intelligript config set gemini-2.5-pro --enable-vision true
✅ Gemini 2.5 Pro: Configured with vision support
```
</details>

<details>
<summary><strong>🔥 OpenAI GPT-4.1 Setup</strong></summary>

```bash
# Add OpenAI API key
intelligript config add-model gpt-4.1-turbo \
  --api-key "your-openai-api-key" \
  --priority low \
  --use-cases "creative,general,conversation"

# Set usage limits
intelligript config set gpt-4.1-turbo --daily-limit 100
✅ GPT-4.1 Turbo: Ready with usage limits
```
</details>

### **Step 4: Your First AI Query**
```bash
# Basic AI query with automatic model selection
intelligript ai "Explain machine learning in simple terms"

🤖 Selected Model: Gemini 2.5 Pro (best cost-performance for explanation)
💭 Processing your query...

📝 Response:
Machine learning is like teaching a computer to recognize patterns...
[detailed response]

💰 Cost: $0.0023 | ⚡ Response time: 1.2s | 🎯 Model: Gemini 2.5 Pro
✅ 67% cheaper than using GPT-4.1 for this query type
```

### **Step 5: View Your Analytics**
```bash
intelligript stats show

📊 IntelliScript Usage Statistics (Last 30 days)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💰 Total Cost: $45.67 (vs $67.23 without optimization: 32% saved)
📈 Total Queries: 1,247
⚡ Avg Response Time: 0.8s
🎯 Success Rate: 99.2%

Model Usage Distribution:
🧠 Gemini 2.5 Pro:    62% (774 queries) - $18.23
🤖 Claude Sonnet 4:   28% (349 queries) - $21.45
🔥 GPT-4.1 Turbo:     10% (124 queries) - $5.99
```

---

## 💡 **Core Features**

### 🎯 **Intelligent Model Routing**
```bash
# Automatic model selection based on query type
intelligript ai "Write a creative story" --auto-route
🔥 Selected: GPT-4.1 (best for creative tasks)

intelligript ai "Analyze this financial report" --auto-route  
🤖 Selected: Claude Sonnet 4 (best for analysis)

intelligript ai "Translate this document" --auto-route
🧠 Selected: Gemini 2.5 Pro (best cost-performance for translation)
```

### 💰 **Advanced Cost Optimization**
```bash
# Set budget controls
intelligript budget set --daily-limit 50.00 --alert-threshold 80%

# Cost-aware querying
intelligript ai "Complex analysis task" --max-cost 2.00
🎯 Optimizing for cost constraint...
✅ Using Gemini 2.5 Pro instead of Claude (Est. cost: $1.45)

# Batch processing with cost optimization
intelligript batch process queries.json --optimize-cost
💰 Processing 500 queries with intelligent routing...
✅ Estimated savings: 45% compared to single-model approach
```

### 📊 **Real-Time Analytics Dashboard**
```bash
# Launch web dashboard
intelligript dashboard --port 8080

🌐 Dashboard available at: http://localhost:8080
📈 Real-time metrics:
   • Live query monitoring
   • Cost breakdown by model
   • Performance analytics  
   • Team usage statistics
   • API health monitoring
```

### 🔒 **Enterprise Security**
```bash
# Enable enterprise security features
intelligript security enable --encryption aes-256 --audit-log

# Role-based access control
intelligript users add developer@company.com --role analyst --models "gemini,claude"
intelligript users add manager@company.com --role admin --full-access

# Compliance reporting
intelligript compliance report --format json --period monthly
```

---

## 📦 **Installation Options**

### **Option 1: PyPI Installation (Recommended)**
```bash
# Latest stable release
pip install intelliscript-cli

# With optional dependencies
pip install intelliscript-cli[enterprise,dashboard,security]

# Development version
pip install git+https://github.com/hongping-zh/intelliscript.git
```

### **Option 2: Docker Installation**
```bash
# Pull official image
docker pull hongping/intelliscript:latest

# Run with volume mount for config persistence
docker run -v ~/.intelliscript:/root/.intelliscript \
           -p 8080:8080 \
           hongping/intelliscript:latest
```

### **Option 3: Development Setup**
```bash
# Clone repository
git clone https://github.com/hongping-zh/intelliscript.git
cd intelliscript

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e .[dev]

# Run tests
pytest tests/ --cov=intelliscript
```

---

## 📚 **Complete Documentation**

### **🔧 Configuration Reference**

<details>
<summary><strong>Complete config.json example</strong></summary>

```json
{
  "models": {
    "claude-sonnet-4": {
      "api_key": "${ANTHROPIC_API_KEY}",
      "endpoint": "https://api.anthropic.com/v1/messages",
      "priority": "high",
      "rate_limits": {
        "requests_per_minute": 60,
        "tokens_per_minute": 40000
      },
      "cost_per_token": {
        "input": 0.000015,
        "output": 0.000075
      },
      "use_cases": ["analysis", "reasoning", "code_review"],
      "max_tokens": 4096
    },
    "gemini-2.5-pro": {
      "api_key": "${GOOGLE_API_KEY}",
      "endpoint": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro",
      "priority": "medium",
      "multimodal": true,
      "cost_per_token": {
        "input": 0.000001,
        "output": 0.000002
      },
      "use_cases": ["translation", "documents", "multimodal"],
      "max_tokens": 2048
    }
  },
  "routing": {
    "strategy": "cost_performance",
    "fallback_model": "gemini-2.5-pro",
    "use_case_mapping": {
      "creative": "gpt-4.1-turbo",
      "analysis": "claude-sonnet-4",
      "translation": "gemini-2.5-pro",
      "code": "claude-sonnet-4"
    }
  },
  "budget": {
    "daily_limit": 100.0,
    "monthly_limit": 2500.0,
    "alert_threshold": 0.8,
    "auto_pause_on_limit": true
  },
  "logging": {
    "level": "INFO",
    "file": "~/.intelliscript/usage.log",
    "remote_endpoint": "https://api.intelliscript.dev/usage",
    "include_content": false
  },
  "security": {
    "encryption": "aes-256",
    "audit_logging": true,
    "require_auth": false
  }
}
```
</details>

### **⚙️ Command Reference**

<details>
<summary><strong>All available commands</strong></summary>

#### **Configuration Commands**
```bash
# Initialize new configuration
intelligript init [--config-path PATH] [--interactive]

# Model management
intelligript config add-model MODEL_NAME --api-key KEY [OPTIONS]
intelligript config remove-model MODEL_NAME
intelligript config list-models
intelligript config test MODEL_NAME

# Settings management
intelligript config get KEY
intelligript config set KEY VALUE
intelligript config reset [--confirm]
```

#### **AI Query Commands**
```bash
# Basic AI queries
intelligript ai "PROMPT" [OPTIONS]
intelligript ask "PROMPT" [--model MODEL] [--max-tokens N]

# Advanced querying
intelligript ai "PROMPT" --auto-route --max-cost 5.00
intelligript ai --file input.txt --output result.txt
intelligript ai --interactive  # Start interactive session

# Batch processing
intelligript batch process FILE [--format json|csv] [--optimize-cost]
intelligript batch template create NAME  # Create batch template
```

#### **Analytics & Monitoring**
```bash
# Usage statistics
intelligript stats show [--period 7d|30d|90d]
intelligript stats export [--format json|csv] [--output FILE]
intelligript stats clear [--before DATE]

# Cost analysis
intelligript costs breakdown [--by-model] [--period PERIOD]
intelligript costs forecast [--days N]
intelligript costs compare --before DATE --after DATE

# Performance monitoring
intelligript performance show
intelligript health check [--models] [--endpoints]
```

#### **Enterprise Features**
```bash
# User management
intelligript users list
intelligript users add EMAIL --role ROLE [--models MODELS]
intelligript users remove EMAIL
intelligript users permissions EMAIL --grant PERMISSION

# Compliance & Security
intelligript compliance report [--format FORMAT] [--period PERIOD]
intelligript security scan [--fix]
intelligript audit log [--filter FILTER] [--export]

# Team management
intelligript teams create TEAM_NAME
intelligript teams add-member TEAM_NAME EMAIL
intelligript teams usage TEAM_NAME [--period PERIOD]
```

#### **System Commands**
```bash
# Dashboard
intelligript dashboard [--port PORT] [--host HOST] [--auth]

# Updates & Maintenance
intelligript update [--check-only]
intelligript cache clear [--model MODEL]
intelligript logs show [--tail N] [--follow]

# Import/Export
intelligript export config [--output FILE] [--encrypted]
intelligript import config FILE [--merge] [--decrypt]
```
</details>

### **📋 Advanced Usage Examples**

<details>
<summary><strong>Real-world usage scenarios</strong></summary>

#### **Scenario 1: Content Creation Workflow**
```bash
# Research phase - use cost-effective model
intelligript ai "Research latest trends in quantum computing" \
  --model gemini-2.5-pro \
  --output research.md

# Creative writing - use best creative model
intelligript ai "Write engaging blog post about quantum computing based on: $(cat research.md)" \
  --model gpt-4.1-turbo \
  --max-tokens 2000 \
  --output blog-draft.md

# Review and editing - use analysis model
intelligript ai "Review and suggest improvements for: $(cat blog-draft.md)" \
  --model claude-sonnet-4 \
  --output blog-reviewed.md

# Cost summary
intelligript costs breakdown --period today
```

#### **Scenario 2: Code Review Automation**
```bash
# Batch code review for multiple files
find ./src -name "*.py" | xargs -I {} \
  intelliscript ai "Review this Python code for bugs and improvements: $(cat {})" \
  --model claude-sonnet-4 \
  --output reviews/{}.review.md

# Security analysis
intelligript ai "Analyze security vulnerabilities in: $(cat main.py)" \
  --model claude-sonnet-4 \
  --tag security-review

# Performance optimization suggestions
intelligript ai "Suggest performance optimizations: $(cat algorithm.py)" \
  --auto-route \
  --max-cost 1.50
```

#### **Scenario 3: Enterprise Document Processing**
```bash
# Prepare batch processing template
intelligript batch template create document-analysis \
  --prompt "Analyze and summarize this document: {content}" \
  --model claude-sonnet-4 \
  --output-format json

# Process multiple documents
intelligript batch process documents.json \
  --template document-analysis \
  --optimize-cost \
  --parallel 5 \
  --output analysis-results.json

# Generate executive summary
intelligript ai "Create executive summary from: $(cat analysis-results.json)" \
  --model gpt-4.1-turbo \
  --output executive-summary.md
```

#### **Scenario 4: Multi-language Support**
```bash
# Translation with quality verification
intelligript ai "Translate to Spanish: $(cat document.txt)" \
  --model gemini-2.5-pro \
  --output document-es.txt

# Quality check translation
intelligript ai "Check translation quality between English and Spanish versions" \
  --model claude-sonnet-4 \
  --file document.txt,document-es.txt

# Batch translation for multiple languages
for lang in fr de it pt; do
  intelliscript ai "Translate to $lang: $(cat source.txt)" \
    --model gemini-2.5-pro \
    --output "translated-$lang.txt"
done
```
</details>

### **🎯 Best Practices**

<details>
<summary><strong>Optimization tips and recommendations</strong></summary>

#### **Cost Optimization**
- **Use auto-routing**: Let IntelliScript choose the most cost-effective model
- **Set budget limits**: Prevent unexpected costs with daily/monthly limits
- **Batch processing**: Process multiple queries together for better rates
- **Cache responses**: Avoid duplicate queries with built-in caching
- **Monitor usage**: Regular review of stats to identify optimization opportunities

#### **Performance Best Practices**
- **Use appropriate models**: Match model capabilities to task requirements
- **Optimize prompts**: Clear, specific prompts get better results faster
- **Parallel processing**: Use batch commands for multiple similar tasks
- **Configure timeouts**: Set reasonable limits to avoid hanging requests
- **Monitor health**: Regular health checks ensure optimal performance

#### **Security Guidelines**
- **Environment variables**: Store API keys securely, never in code
- **Enable encryption**: Use AES-256 for sensitive data protection
- **Audit logging**: Track all usage for compliance requirements
- **Role-based access**: Limit model access based on user roles
- **Regular updates**: Keep IntelliScript updated for security patches

#### **Enterprise Deployment**
- **Centralized config**: Use shared configuration for team consistency
- **Usage monitoring**: Track team usage and costs in real-time
- **Compliance reporting**: Generate regular compliance reports
- **Backup configs**: Regular backup of configurations and logs
- **High availability**: Deploy with redundancy for critical systems
</details>

---

## 🤝 **Contributing & Community**

### **🚀 Quick Contribution Guide**
```bash
# Fork and clone
git clone https://github.com/YOUR_USERNAME/intelliscript.git
cd intelliscript

# Create feature branch
git checkout -b feature/amazing-improvement

# Make your changes
# ... code, test, document ...

# Submit PR
git push origin feature/amazing-improvement
# Then create PR on GitHub
```

### **📞 Support & Community**
- 🐛 **Bug Reports**: [GitHub Issues](https://github.com/hongping-zh/intelliscript/issues)
- 💡 **Feature Requests**: [GitHub Discussions](https://github.com/hongping-zh/intelliscript/discussions)
- 💬 **Community Chat**: [Discord Server](https://discord.gg/intelliscript)
- 📚 **Documentation**: [Wiki](https://github.com/hongping-zh/intelliscript/wiki)
- 📧 **Enterprise Support**: enterprise@intelliscript.dev

---

<div align="center">

**⭐ Star this project if it helps you save costs and improve AI workflow efficiency! ⭐**

![GitHub Stars](https://img.shields.io/github/stars/hongping-zh/intelliscript?style=social)
![Twitter Follow](https://img.shields.io/twitter/follow/intelliscript?style=social)

**Made with ❤️ by the IntelliScript Team**

[⬆️ Back to Top](#intelliscript-cli)

</div>
     token = "YOUR_GEMINI_API_KEY"
     ```
2. **Generate License Key**
   ```bash
   python intelliscript_cli.py gen-license
   ```
3. **Call Gemini (no `run` subcommand!):**
   ```bash
   python intelliscript_cli.py gemini "What is quantum entanglement?"
   ```

---

## VSCode Extension Integration
- Install the IntelliScript VSCode extension
- Use the command palette: `IntelliScript: Ask Gemini (gemini-cli)`
- The extension will internally call IntelliScript CLI, ensuring unified license, API Key, and logging management

---

## Configuration
- **License Key**: Managed by CLI, stored in `~/.intelliscript/config.json`
- **Gemini API Key**: Set in `~/.config/gemini-cli.toml`
- **Remote License/Stats Server**: Optional, set via CLI commands

---

## Example Commands

- Show config:
  ```bash
  python intelliscript_cli.py show-config
  ```
- Set remote license server:
  ```bash
  python intelliscript_cli.py set-license-server http://your-server/api/check_license
  ```
- Use Gemini CLI with markdown output:
  ```bash
  python intelliscript_cli.py gemini --markdown "Explain quantum entanglement"
  ```

---

## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.

---

## License
MIT License. See [LICENSE](LICENSE) for details.

---

## Contact
For issues, feature requests, or support, please open a GitHub Issue or contact the maintainers via the repository.


## 项目简介
IntelliScript CLI 是一个轻量级命令行工具,支持 License Key 管理、统一配置、本地与远程使用统计、License 校验及自动续期、云端配置、命令同步,并作为 Gemini CLI 的包装器。

---

## 目录结构

```
IntelliScriptCLI/
├── intelliscript_cli.py
├── requirements.txt
├── README.md
```

---

## 依赖安装

```bash
pip install -r requirements.txt
```

requirements.txt 内容:
```
click
requests
```

---

## 功能与命令说明

### 1. License Key 管理
- 生成 License Key
  ```bash
  python intelliscript_cli.py gen-license
  ```
- 远程校验 License Key
  ```bash
  python intelliscript_cli.py check-license
  ```
- 自动续期(命令调用时自动检测本地 key 是否过期,若过期则从云端拉取新 key,详见代码实现)

### 2. 配置统一化
- 设置 Gemini API Key
  ```bash
  python intelliscript_cli.py set-gemini-key 你的APIKey
  ```
- 设置远程统计服务器
  ```bash
  python intelliscript_cli.py set-stats-server https://your-server/api/usage
  ```
- 设置 License 校验服务器
  ```bash
  python intelliscript_cli.py set-license-server https://your-server/api/check_license
  ```
- 查看当前配置
  ```bash
  python intelliscript_cli.py show-config
  ```
- 重置配置
  ```bash
  python intelliscript_cli.py reset-config
  ```

### 3. 使用统计
- 本地统计
  ```bash
  python intelliscript_cli.py usage-stats
  ```
- 远程统计
  - 每次命令调用自动向 stats_server 上报日志(失败不影响主流程)

### 4. Gemini CLI 包装
- 透传参数调用 Gemini CLI
  ```bash
  python intelliscript_cli.py gemini run "你的问题"
  ```

### 5. 本地/远程命令同步
- 支持将本地命令历史同步至云端(可扩展为定时/手动同步)
- 代码中 log_usage_remote 实现了每次命令调用的远程上报

### 6. License 自动续期
- 在每次关键命令调用时,自动检测本地 License 是否过期(如需可扩展为定时检测)
- 若过期则自动向 license_server 拉取新 key 并保存

### 7. 云端配置
- 通过 set-stats-server、set-license-server 动态配置云端地址
- 配置文件统一存储于 `~/.intelliscript/config.json`

---

## 配置文件与日志
- 配置文件:`~/.intelliscript/config.json`
- 使用日志:`~/.intelliscript/usage.log`

---

## 全部核心代码

```python
import os
import json
import uuid
import subprocess
import click
from datetime import datetime, timedelta
import requests

CONFIG_PATH = os.path.expanduser('~/.intelliscript/config.json')
USAGE_LOG = os.path.expanduser('~/.intelliscript/usage.log')

LICENSE_EXPIRE_DAYS = 30  # License 有效期(天)

def load_config():
    if not os.path.exists(CONFIG_PATH):
        return {}
    with open(CONFIG_PATH, 'r', encoding='utf-8') as f:
        return json.load(f)

def save_config(cfg):
    os.makedirs(os.path.dirname(CONFIG_PATH), exist_ok=True)
    with open(CONFIG_PATH, 'w', encoding='utf-8') as f:
        json.dump(cfg, f, indent=2)

def log_usage(command, args):
    os.makedirs(os.path.dirname(USAGE_LOG), exist_ok=True)
    with open(USAGE_LOG, 'a', encoding='utf-8') as f:
        log_entry = {
            'timestamp': datetime.now().isoformat(),
            'command': command,
            'args': args
        }
        f.write(json.dumps(log_entry, ensure_ascii=False) + '\n')
    log_usage_remote(command, args)

def log_usage_remote(command, args):
    cfg = load_config()
    stats_server = cfg.get('stats_server')
    if not stats_server:
        return
    try:
        requests.post(stats_server, json={
            'license_key': cfg.get('license_key'),
            'command': command,
            'args': args,
            'timestamp': datetime.now().isoformat()
        }, timeout=3)
    except Exception:
        pass  # 远程统计失败不影响主流程

def license_expired(cfg):
    # 检查本地 license 是否过期
    date_str = cfg.get('license_date')
    if not date_str:
        return True
    try:
        d0 = datetime.fromisoformat(date_str)
        return (datetime.now() - d0) > timedelta(days=LICENSE_EXPIRE_DAYS)
    except Exception:
        return True

def renew_license(cfg):
    # 自动向 license_server 拉取新 key
    server = cfg.get('license_server')
    if not server:
        click.echo("未配置 license_server,无法自动续期。")
        return False
    try:
        resp = requests.post(server, json={'renew': True, 'old_license': cfg.get('license_key')}, timeout=5)
        if resp.status_code == 200:
            data = resp.json()
            cfg['license_key'] = data.get('license_key')
            cfg['license_date'] = datetime.now().isoformat()
            save_config(cfg)
            click.echo("License 自动续期成功。")
            return True
        else:
            click.echo(f"自动续期失败: {resp.text}")
            return False
    except Exception as e:
        click.echo(f"自动续期异常: {e}")
        return False

@click.group()
def cli():
    pass

@cli.command()
def gen_license():
    """生成并保存 License Key"""
    cfg = load_config()
    if 'license_key' not in cfg or license_expired(cfg):
        cfg['license_key'] = str(uuid.uuid4()).replace('-', '')
        cfg['license_date'] = datetime.now().isoformat()
        save_config(cfg)
        click.echo(f"新 License Key: {cfg['license_key']}")
    else:
        click.echo(f"已存在 License Key: {cfg['license_key']}")

@cli.command()
@click.argument('key')
def set_gemini_key(key):
    """配置 Gemini API Key"""
    cfg = load_config()
    cfg['gemini_api_key'] = key
    save_config(cfg)
    click.echo("Gemini API Key 已保存")

@cli.command()
@click.argument('url')
def set_stats_server(url):
    """配置远程统计服务器地址"""
    cfg = load_config()
    cfg['stats_server'] = url
    save_config(cfg)
    click.echo(f"统计服务器已设置为: {url}")

@cli.command()
@click.argument('url')
def set_license_server(url):
    """配置License校验服务器地址"""
    cfg = load_config()
    cfg['license_server'] = url
    save_config(cfg)
    click.echo(f"License服务器已设置为: {url}")

@cli.command()
def show_config():
    """显示当前配置"""
    cfg = load_config()
    click.echo(json.dumps(cfg, indent=2, ensure_ascii=False))

@cli.command()
def reset_config():
    """重置本地配置"""
    if os.path.exists(CONFIG_PATH):
        os.remove(CONFIG_PATH)
        click.echo("配置已重置。")
    else:
        click.echo("配置文件不存在。")

@cli.command()
def usage_stats():
    """显示本地使用统计信息"""
    if not os.path.exists(USAGE_LOG):
        click.echo("无使用日志。")
        return
    with open(USAGE_LOG, 'r', encoding='utf-8') as f:
        lines = f.readlines()
    click.echo(f"共调用 {len(lines)} 次命令。")
    stats = {}
    for line in lines:
        try:
            entry = json.loads(line)
            cmd = entry.get('command')
            stats[cmd] = stats.get(cmd, 0) + 1
        except Exception:
            continue
    for cmd, count in stats.items():
        click.echo(f"  {cmd}: {count} 次")

@cli.command()
def check_license():
    """远程校验 License Key"""
    cfg = load_config()
    license_key = cfg.get('license_key')
    server = cfg.get('license_server')
    if not license_key or not server:
        click.echo("请先生成 License Key 并配置 license_server。")
        return
    # 自动续期逻辑
    if license_expired(cfg):
        click.echo("License 已过期,自动续期...")
        if not renew_license(cfg):
            click.echo("自动续期失败,无法校验。")
            return
    try:
        resp = requests.post(server, json={'license_key': license_key}, timeout=5)
        if resp.status_code == 200:
            click.echo(f"校验结果: {resp.json()}")
        else:
            click.echo(f"服务器返回异常: {resp.text}")
    except Exception as e:
        click.echo(f"远程校验失败: {e}")

@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True))
@click.pass_context
def gemini(ctx):
    """包装 Gemini CLI,自动注入配置与统计"""
    cfg = load_config()
    license_key = cfg.get('license_key')
    # 自动续期逻辑
    if not license_key or license_expired(cfg):
        click.echo("License 不存在或已过期,自动续期...")
        if not renew_license(cfg):
            click.echo("自动续期失败,无法继续执行命令。")
            return
    log_usage('gemini', ctx.args)
    env = os.environ.copy()
    if 'gemini_api_key' in cfg:
        env['GEMINI_API_KEY'] = cfg['gemini_api_key']
    try:
        subprocess.run(['gemini'] + ctx.args, env=env)
    except FileNotFoundError:
        click.echo("未检测到 gemini-cli,请先安装。")

if __name__ == '__main__':
    cli()
```

---

## 远程 License 校验/续期服务器(Flask 示例)

```python
from flask import Flask, request, jsonify
from datetime import datetime
app = Flask(__name__)

VALID_LICENSES = {"your_license_key1", "your_license_key2"}

@app.route('/api/check_license', methods=['POST'])
def check_license():
    data = request.json
    key = data.get('license_key')
    if key in VALID_LICENSES:
        return jsonify({'valid': True, 'expire': False})
    return jsonify({'valid': False, 'expire': True}), 403

@app.route('/api/check_license', methods=['POST'])
def renew_license():
    data = request.json
    if data.get('renew'):
        # 生成新 license key
        new_key = str(uuid.uuid4()).replace('-', '')
        VALID_LICENSES.add(new_key)
        return jsonify({'license_key': new_key, 'renewed': True, 'date': datetime.now().isoformat()})
    return jsonify({'msg': 'invalid request'}), 400

@app.route('/api/usage', methods=['POST'])
def usage():
    print(request.json)
    return jsonify({'msg': 'received'})
```

---

## 总结
- 支持 License Key 全生命周期管理(生成、校验、自动续期)
- 支持本地/远程配置与统计
- 支持命令同步与云端配置
- 所有代码已集成在 intelliscript_cli.py,便于二次开发

如需更多扩展或问题反馈,请随时联系开发者。

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hongping-zh/intelliscript",
    "name": "intelliscript-ai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ai, cli, command-line, langextract, data-extraction, visualization, automation, llm, openai, ollama, anthropic, google-gemini, data-analysis, reports",
    "author": "IntelliScript Team",
    "author_email": "IntelliScript Team <team@intelliscript.dev>",
    "download_url": "https://files.pythonhosted.org/packages/69/5a/4ee7a0a4ccedac9bfcfe29323198316180147d020815f9945d1ec71a1af1/intelliscript_ai-2.1.0.tar.gz",
    "platform": null,
    "description": "# IntelliScript CLI\r\n\r\n<div align=\"center\">\r\n\r\n![IntelliScript CLI](https://img.shields.io/badge/IntelliScript-Enterprise%20AI%20Platform-blue?style=for-the-badge&logo=robot)\r\n![Version](https://img.shields.io/badge/version-1.0.0-green?style=for-the-badge)\r\n![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)\r\n![Python](https://img.shields.io/badge/python-3.8%2B-blue?style=for-the-badge&logo=python)\r\n\r\n![Build Status](https://github.com/hongping-zh/intelliscript/workflows/CI/badge.svg)\r\n![PyPI version](https://badge.fury.io/py/intelliscript-cli.svg)\r\n![Downloads](https://pepy.tech/badge/intelliscript-cli)\r\n![GitHub Stars](https://img.shields.io/github/stars/hongping-zh/intelliscript?style=social)\r\n\r\n**\ud83d\ude80 Enterprise-Grade AI Model Management Platform**\r\n\r\n*Multi-model AI integration \u2022 Cost optimization \u2022 Enterprise security*\r\n\r\n[\ud83d\ude80 Quick Start](#-5-minute-quick-start) \u2022 [\ud83d\udcfa Live Demo](#-live-demonstrations) \u2022 [\ud83d\udca1 Features](#-core-features) \u2022 [\ud83d\udce6 Installation](#-installation) \u2022 [\ud83d\udcda Documentation](#-complete-documentation)\r\n\r\n</div>\r\n\r\n---\r\n\r\n## \ud83d\udcfa **Live Demonstrations**\r\n\r\n### \ud83c\udfa5 **Basic Usage Demo**\r\n![IntelliScript Basic Demo](https://raw.githubusercontent.com/hongping-zh/intelliscript/main/docs/gifs/basic-usage-demo.gif)\r\n*Basic AI query with automatic model selection and cost tracking*\r\n\r\n### \ud83c\udfa5 **Multi-Model Cost Optimization**\r\n![Cost Optimization Demo](https://raw.githubusercontent.com/hongping-zh/intelliscript/main/docs/gifs/cost-optimization-demo.gif)\r\n*Intelligent routing between Claude, Gemini, and GPT-4 for optimal cost-performance*\r\n\r\n### \ud83c\udfa5 **Enterprise Dashboard**\r\n![Enterprise Dashboard Demo](https://raw.githubusercontent.com/hongping-zh/intelliscript/main/docs/gifs/dashboard-demo.gif)\r\n*Real-time usage analytics and team management interface*\r\n\r\n> **\ud83d\udcdd Note**: GIF demonstrations show actual IntelliScript CLI in action. [Create your own demo](docs/CREATE_DEMO.md)\r\n\r\n---\r\n\r\n## \ud83d\ude80 **5-Minute Quick Start**\r\n\r\n### **Step 1: Installation**\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/hongping-zh/intelliscript.git\r\ncd intelliscript\r\n\r\n# Install dependencies\r\npip install -r requirements.txt\r\n\r\n# Optional: Install globally\r\npip install -e .\r\n```\r\n\r\n### **Step 2: Initialize Configuration**\r\n```bash\r\n# Initialize IntelliScript\r\nintelligript init\r\n\r\n# This creates:\r\n# ~/.intelliscript/\r\n# \u251c\u2500\u2500 config.json      # Main configuration\r\n# \u251c\u2500\u2500 usage.log        # Usage statistics  \r\n# \u251c\u2500\u2500 models/          # Model configurations\r\n# \u2514\u2500\u2500 cache/           # Response caching\r\n```\r\n\r\n### **Step 3: Configure AI Models**\r\n\r\n<details>\r\n<summary><strong>\ud83e\udd16 Claude Sonnet 4.0 Setup</strong></summary>\r\n\r\n```bash\r\n# Add Claude API key\r\nintelligript config add-model claude-sonnet-4 \\\r\n  --api-key \"your-anthropic-api-key\" \\\r\n  --priority high \\\r\n  --use-cases \"analysis,coding,reasoning\"\r\n\r\n# Test connection\r\nintelligript test claude-sonnet-4\r\n\u2705 Claude Sonnet 4.0: Connected successfully\r\n\ud83d\udcb0 Rate: $15/1M tokens input, $75/1M tokens output\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><strong>\ud83e\udde0 Google Gemini 2.5 Pro Setup</strong></summary>\r\n\r\n```bash\r\n# Add Gemini API key\r\nintelligript config add-model gemini-2.5-pro \\\r\n  --api-key \"your-google-api-key\" \\\r\n  --priority medium \\\r\n  --use-cases \"multimodal,documents,translation\"\r\n\r\n# Enable multimodal features\r\nintelligript config set gemini-2.5-pro --enable-vision true\r\n\u2705 Gemini 2.5 Pro: Configured with vision support\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><strong>\ud83d\udd25 OpenAI GPT-4.1 Setup</strong></summary>\r\n\r\n```bash\r\n# Add OpenAI API key\r\nintelligript config add-model gpt-4.1-turbo \\\r\n  --api-key \"your-openai-api-key\" \\\r\n  --priority low \\\r\n  --use-cases \"creative,general,conversation\"\r\n\r\n# Set usage limits\r\nintelligript config set gpt-4.1-turbo --daily-limit 100\r\n\u2705 GPT-4.1 Turbo: Ready with usage limits\r\n```\r\n</details>\r\n\r\n### **Step 4: Your First AI Query**\r\n```bash\r\n# Basic AI query with automatic model selection\r\nintelligript ai \"Explain machine learning in simple terms\"\r\n\r\n\ud83e\udd16 Selected Model: Gemini 2.5 Pro (best cost-performance for explanation)\r\n\ud83d\udcad Processing your query...\r\n\r\n\ud83d\udcdd Response:\r\nMachine learning is like teaching a computer to recognize patterns...\r\n[detailed response]\r\n\r\n\ud83d\udcb0 Cost: $0.0023 | \u26a1 Response time: 1.2s | \ud83c\udfaf Model: Gemini 2.5 Pro\r\n\u2705 67% cheaper than using GPT-4.1 for this query type\r\n```\r\n\r\n### **Step 5: View Your Analytics**\r\n```bash\r\nintelligript stats show\r\n\r\n\ud83d\udcca IntelliScript Usage Statistics (Last 30 days)\r\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n\ud83d\udcb0 Total Cost: $45.67 (vs $67.23 without optimization: 32% saved)\r\n\ud83d\udcc8 Total Queries: 1,247\r\n\u26a1 Avg Response Time: 0.8s\r\n\ud83c\udfaf Success Rate: 99.2%\r\n\r\nModel Usage Distribution:\r\n\ud83e\udde0 Gemini 2.5 Pro:    62% (774 queries) - $18.23\r\n\ud83e\udd16 Claude Sonnet 4:   28% (349 queries) - $21.45\r\n\ud83d\udd25 GPT-4.1 Turbo:     10% (124 queries) - $5.99\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udca1 **Core Features**\r\n\r\n### \ud83c\udfaf **Intelligent Model Routing**\r\n```bash\r\n# Automatic model selection based on query type\r\nintelligript ai \"Write a creative story\" --auto-route\r\n\ud83d\udd25 Selected: GPT-4.1 (best for creative tasks)\r\n\r\nintelligript ai \"Analyze this financial report\" --auto-route  \r\n\ud83e\udd16 Selected: Claude Sonnet 4 (best for analysis)\r\n\r\nintelligript ai \"Translate this document\" --auto-route\r\n\ud83e\udde0 Selected: Gemini 2.5 Pro (best cost-performance for translation)\r\n```\r\n\r\n### \ud83d\udcb0 **Advanced Cost Optimization**\r\n```bash\r\n# Set budget controls\r\nintelligript budget set --daily-limit 50.00 --alert-threshold 80%\r\n\r\n# Cost-aware querying\r\nintelligript ai \"Complex analysis task\" --max-cost 2.00\r\n\ud83c\udfaf Optimizing for cost constraint...\r\n\u2705 Using Gemini 2.5 Pro instead of Claude (Est. cost: $1.45)\r\n\r\n# Batch processing with cost optimization\r\nintelligript batch process queries.json --optimize-cost\r\n\ud83d\udcb0 Processing 500 queries with intelligent routing...\r\n\u2705 Estimated savings: 45% compared to single-model approach\r\n```\r\n\r\n### \ud83d\udcca **Real-Time Analytics Dashboard**\r\n```bash\r\n# Launch web dashboard\r\nintelligript dashboard --port 8080\r\n\r\n\ud83c\udf10 Dashboard available at: http://localhost:8080\r\n\ud83d\udcc8 Real-time metrics:\r\n   \u2022 Live query monitoring\r\n   \u2022 Cost breakdown by model\r\n   \u2022 Performance analytics  \r\n   \u2022 Team usage statistics\r\n   \u2022 API health monitoring\r\n```\r\n\r\n### \ud83d\udd12 **Enterprise Security**\r\n```bash\r\n# Enable enterprise security features\r\nintelligript security enable --encryption aes-256 --audit-log\r\n\r\n# Role-based access control\r\nintelligript users add developer@company.com --role analyst --models \"gemini,claude\"\r\nintelligript users add manager@company.com --role admin --full-access\r\n\r\n# Compliance reporting\r\nintelligript compliance report --format json --period monthly\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udce6 **Installation Options**\r\n\r\n### **Option 1: PyPI Installation (Recommended)**\r\n```bash\r\n# Latest stable release\r\npip install intelliscript-cli\r\n\r\n# With optional dependencies\r\npip install intelliscript-cli[enterprise,dashboard,security]\r\n\r\n# Development version\r\npip install git+https://github.com/hongping-zh/intelliscript.git\r\n```\r\n\r\n### **Option 2: Docker Installation**\r\n```bash\r\n# Pull official image\r\ndocker pull hongping/intelliscript:latest\r\n\r\n# Run with volume mount for config persistence\r\ndocker run -v ~/.intelliscript:/root/.intelliscript \\\r\n           -p 8080:8080 \\\r\n           hongping/intelliscript:latest\r\n```\r\n\r\n### **Option 3: Development Setup**\r\n```bash\r\n# Clone repository\r\ngit clone https://github.com/hongping-zh/intelliscript.git\r\ncd intelliscript\r\n\r\n# Create virtual environment\r\npython -m venv venv\r\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\r\n\r\n# Install in development mode\r\npip install -e .[dev]\r\n\r\n# Run tests\r\npytest tests/ --cov=intelliscript\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcda **Complete Documentation**\r\n\r\n### **\ud83d\udd27 Configuration Reference**\r\n\r\n<details>\r\n<summary><strong>Complete config.json example</strong></summary>\r\n\r\n```json\r\n{\r\n  \"models\": {\r\n    \"claude-sonnet-4\": {\r\n      \"api_key\": \"${ANTHROPIC_API_KEY}\",\r\n      \"endpoint\": \"https://api.anthropic.com/v1/messages\",\r\n      \"priority\": \"high\",\r\n      \"rate_limits\": {\r\n        \"requests_per_minute\": 60,\r\n        \"tokens_per_minute\": 40000\r\n      },\r\n      \"cost_per_token\": {\r\n        \"input\": 0.000015,\r\n        \"output\": 0.000075\r\n      },\r\n      \"use_cases\": [\"analysis\", \"reasoning\", \"code_review\"],\r\n      \"max_tokens\": 4096\r\n    },\r\n    \"gemini-2.5-pro\": {\r\n      \"api_key\": \"${GOOGLE_API_KEY}\",\r\n      \"endpoint\": \"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro\",\r\n      \"priority\": \"medium\",\r\n      \"multimodal\": true,\r\n      \"cost_per_token\": {\r\n        \"input\": 0.000001,\r\n        \"output\": 0.000002\r\n      },\r\n      \"use_cases\": [\"translation\", \"documents\", \"multimodal\"],\r\n      \"max_tokens\": 2048\r\n    }\r\n  },\r\n  \"routing\": {\r\n    \"strategy\": \"cost_performance\",\r\n    \"fallback_model\": \"gemini-2.5-pro\",\r\n    \"use_case_mapping\": {\r\n      \"creative\": \"gpt-4.1-turbo\",\r\n      \"analysis\": \"claude-sonnet-4\",\r\n      \"translation\": \"gemini-2.5-pro\",\r\n      \"code\": \"claude-sonnet-4\"\r\n    }\r\n  },\r\n  \"budget\": {\r\n    \"daily_limit\": 100.0,\r\n    \"monthly_limit\": 2500.0,\r\n    \"alert_threshold\": 0.8,\r\n    \"auto_pause_on_limit\": true\r\n  },\r\n  \"logging\": {\r\n    \"level\": \"INFO\",\r\n    \"file\": \"~/.intelliscript/usage.log\",\r\n    \"remote_endpoint\": \"https://api.intelliscript.dev/usage\",\r\n    \"include_content\": false\r\n  },\r\n  \"security\": {\r\n    \"encryption\": \"aes-256\",\r\n    \"audit_logging\": true,\r\n    \"require_auth\": false\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n### **\u2699\ufe0f Command Reference**\r\n\r\n<details>\r\n<summary><strong>All available commands</strong></summary>\r\n\r\n#### **Configuration Commands**\r\n```bash\r\n# Initialize new configuration\r\nintelligript init [--config-path PATH] [--interactive]\r\n\r\n# Model management\r\nintelligript config add-model MODEL_NAME --api-key KEY [OPTIONS]\r\nintelligript config remove-model MODEL_NAME\r\nintelligript config list-models\r\nintelligript config test MODEL_NAME\r\n\r\n# Settings management\r\nintelligript config get KEY\r\nintelligript config set KEY VALUE\r\nintelligript config reset [--confirm]\r\n```\r\n\r\n#### **AI Query Commands**\r\n```bash\r\n# Basic AI queries\r\nintelligript ai \"PROMPT\" [OPTIONS]\r\nintelligript ask \"PROMPT\" [--model MODEL] [--max-tokens N]\r\n\r\n# Advanced querying\r\nintelligript ai \"PROMPT\" --auto-route --max-cost 5.00\r\nintelligript ai --file input.txt --output result.txt\r\nintelligript ai --interactive  # Start interactive session\r\n\r\n# Batch processing\r\nintelligript batch process FILE [--format json|csv] [--optimize-cost]\r\nintelligript batch template create NAME  # Create batch template\r\n```\r\n\r\n#### **Analytics & Monitoring**\r\n```bash\r\n# Usage statistics\r\nintelligript stats show [--period 7d|30d|90d]\r\nintelligript stats export [--format json|csv] [--output FILE]\r\nintelligript stats clear [--before DATE]\r\n\r\n# Cost analysis\r\nintelligript costs breakdown [--by-model] [--period PERIOD]\r\nintelligript costs forecast [--days N]\r\nintelligript costs compare --before DATE --after DATE\r\n\r\n# Performance monitoring\r\nintelligript performance show\r\nintelligript health check [--models] [--endpoints]\r\n```\r\n\r\n#### **Enterprise Features**\r\n```bash\r\n# User management\r\nintelligript users list\r\nintelligript users add EMAIL --role ROLE [--models MODELS]\r\nintelligript users remove EMAIL\r\nintelligript users permissions EMAIL --grant PERMISSION\r\n\r\n# Compliance & Security\r\nintelligript compliance report [--format FORMAT] [--period PERIOD]\r\nintelligript security scan [--fix]\r\nintelligript audit log [--filter FILTER] [--export]\r\n\r\n# Team management\r\nintelligript teams create TEAM_NAME\r\nintelligript teams add-member TEAM_NAME EMAIL\r\nintelligript teams usage TEAM_NAME [--period PERIOD]\r\n```\r\n\r\n#### **System Commands**\r\n```bash\r\n# Dashboard\r\nintelligript dashboard [--port PORT] [--host HOST] [--auth]\r\n\r\n# Updates & Maintenance\r\nintelligript update [--check-only]\r\nintelligript cache clear [--model MODEL]\r\nintelligript logs show [--tail N] [--follow]\r\n\r\n# Import/Export\r\nintelligript export config [--output FILE] [--encrypted]\r\nintelligript import config FILE [--merge] [--decrypt]\r\n```\r\n</details>\r\n\r\n### **\ud83d\udccb Advanced Usage Examples**\r\n\r\n<details>\r\n<summary><strong>Real-world usage scenarios</strong></summary>\r\n\r\n#### **Scenario 1: Content Creation Workflow**\r\n```bash\r\n# Research phase - use cost-effective model\r\nintelligript ai \"Research latest trends in quantum computing\" \\\r\n  --model gemini-2.5-pro \\\r\n  --output research.md\r\n\r\n# Creative writing - use best creative model\r\nintelligript ai \"Write engaging blog post about quantum computing based on: $(cat research.md)\" \\\r\n  --model gpt-4.1-turbo \\\r\n  --max-tokens 2000 \\\r\n  --output blog-draft.md\r\n\r\n# Review and editing - use analysis model\r\nintelligript ai \"Review and suggest improvements for: $(cat blog-draft.md)\" \\\r\n  --model claude-sonnet-4 \\\r\n  --output blog-reviewed.md\r\n\r\n# Cost summary\r\nintelligript costs breakdown --period today\r\n```\r\n\r\n#### **Scenario 2: Code Review Automation**\r\n```bash\r\n# Batch code review for multiple files\r\nfind ./src -name \"*.py\" | xargs -I {} \\\r\n  intelliscript ai \"Review this Python code for bugs and improvements: $(cat {})\" \\\r\n  --model claude-sonnet-4 \\\r\n  --output reviews/{}.review.md\r\n\r\n# Security analysis\r\nintelligript ai \"Analyze security vulnerabilities in: $(cat main.py)\" \\\r\n  --model claude-sonnet-4 \\\r\n  --tag security-review\r\n\r\n# Performance optimization suggestions\r\nintelligript ai \"Suggest performance optimizations: $(cat algorithm.py)\" \\\r\n  --auto-route \\\r\n  --max-cost 1.50\r\n```\r\n\r\n#### **Scenario 3: Enterprise Document Processing**\r\n```bash\r\n# Prepare batch processing template\r\nintelligript batch template create document-analysis \\\r\n  --prompt \"Analyze and summarize this document: {content}\" \\\r\n  --model claude-sonnet-4 \\\r\n  --output-format json\r\n\r\n# Process multiple documents\r\nintelligript batch process documents.json \\\r\n  --template document-analysis \\\r\n  --optimize-cost \\\r\n  --parallel 5 \\\r\n  --output analysis-results.json\r\n\r\n# Generate executive summary\r\nintelligript ai \"Create executive summary from: $(cat analysis-results.json)\" \\\r\n  --model gpt-4.1-turbo \\\r\n  --output executive-summary.md\r\n```\r\n\r\n#### **Scenario 4: Multi-language Support**\r\n```bash\r\n# Translation with quality verification\r\nintelligript ai \"Translate to Spanish: $(cat document.txt)\" \\\r\n  --model gemini-2.5-pro \\\r\n  --output document-es.txt\r\n\r\n# Quality check translation\r\nintelligript ai \"Check translation quality between English and Spanish versions\" \\\r\n  --model claude-sonnet-4 \\\r\n  --file document.txt,document-es.txt\r\n\r\n# Batch translation for multiple languages\r\nfor lang in fr de it pt; do\r\n  intelliscript ai \"Translate to $lang: $(cat source.txt)\" \\\r\n    --model gemini-2.5-pro \\\r\n    --output \"translated-$lang.txt\"\r\ndone\r\n```\r\n</details>\r\n\r\n### **\ud83c\udfaf Best Practices**\r\n\r\n<details>\r\n<summary><strong>Optimization tips and recommendations</strong></summary>\r\n\r\n#### **Cost Optimization**\r\n- **Use auto-routing**: Let IntelliScript choose the most cost-effective model\r\n- **Set budget limits**: Prevent unexpected costs with daily/monthly limits\r\n- **Batch processing**: Process multiple queries together for better rates\r\n- **Cache responses**: Avoid duplicate queries with built-in caching\r\n- **Monitor usage**: Regular review of stats to identify optimization opportunities\r\n\r\n#### **Performance Best Practices**\r\n- **Use appropriate models**: Match model capabilities to task requirements\r\n- **Optimize prompts**: Clear, specific prompts get better results faster\r\n- **Parallel processing**: Use batch commands for multiple similar tasks\r\n- **Configure timeouts**: Set reasonable limits to avoid hanging requests\r\n- **Monitor health**: Regular health checks ensure optimal performance\r\n\r\n#### **Security Guidelines**\r\n- **Environment variables**: Store API keys securely, never in code\r\n- **Enable encryption**: Use AES-256 for sensitive data protection\r\n- **Audit logging**: Track all usage for compliance requirements\r\n- **Role-based access**: Limit model access based on user roles\r\n- **Regular updates**: Keep IntelliScript updated for security patches\r\n\r\n#### **Enterprise Deployment**\r\n- **Centralized config**: Use shared configuration for team consistency\r\n- **Usage monitoring**: Track team usage and costs in real-time\r\n- **Compliance reporting**: Generate regular compliance reports\r\n- **Backup configs**: Regular backup of configurations and logs\r\n- **High availability**: Deploy with redundancy for critical systems\r\n</details>\r\n\r\n---\r\n\r\n## \ud83e\udd1d **Contributing & Community**\r\n\r\n### **\ud83d\ude80 Quick Contribution Guide**\r\n```bash\r\n# Fork and clone\r\ngit clone https://github.com/YOUR_USERNAME/intelliscript.git\r\ncd intelliscript\r\n\r\n# Create feature branch\r\ngit checkout -b feature/amazing-improvement\r\n\r\n# Make your changes\r\n# ... code, test, document ...\r\n\r\n# Submit PR\r\ngit push origin feature/amazing-improvement\r\n# Then create PR on GitHub\r\n```\r\n\r\n### **\ud83d\udcde Support & Community**\r\n- \ud83d\udc1b **Bug Reports**: [GitHub Issues](https://github.com/hongping-zh/intelliscript/issues)\r\n- \ud83d\udca1 **Feature Requests**: [GitHub Discussions](https://github.com/hongping-zh/intelliscript/discussions)\r\n- \ud83d\udcac **Community Chat**: [Discord Server](https://discord.gg/intelliscript)\r\n- \ud83d\udcda **Documentation**: [Wiki](https://github.com/hongping-zh/intelliscript/wiki)\r\n- \ud83d\udce7 **Enterprise Support**: enterprise@intelliscript.dev\r\n\r\n---\r\n\r\n<div align=\"center\">\r\n\r\n**\u2b50 Star this project if it helps you save costs and improve AI workflow efficiency! \u2b50**\r\n\r\n![GitHub Stars](https://img.shields.io/github/stars/hongping-zh/intelliscript?style=social)\r\n![Twitter Follow](https://img.shields.io/twitter/follow/intelliscript?style=social)\r\n\r\n**Made with \u2764\ufe0f by the IntelliScript Team**\r\n\r\n[\u2b06\ufe0f Back to Top](#intelliscript-cli)\r\n\r\n</div>\r\n     token = \"YOUR_GEMINI_API_KEY\"\r\n     ```\r\n2. **Generate License Key**\r\n   ```bash\r\n   python intelliscript_cli.py gen-license\r\n   ```\r\n3. **Call Gemini (no `run` subcommand!):**\r\n   ```bash\r\n   python intelliscript_cli.py gemini \"What is quantum entanglement?\"\r\n   ```\r\n\r\n---\r\n\r\n## VSCode Extension Integration\r\n- Install the IntelliScript VSCode extension\r\n- Use the command palette: `IntelliScript: Ask Gemini (gemini-cli)`\r\n- The extension will internally call IntelliScript CLI, ensuring unified license, API Key, and logging management\r\n\r\n---\r\n\r\n## Configuration\r\n- **License Key**: Managed by CLI, stored in `~/.intelliscript/config.json`\r\n- **Gemini API Key**: Set in `~/.config/gemini-cli.toml`\r\n- **Remote License/Stats Server**: Optional, set via CLI commands\r\n\r\n---\r\n\r\n## Example Commands\r\n\r\n- Show config:\r\n  ```bash\r\n  python intelliscript_cli.py show-config\r\n  ```\r\n- Set remote license server:\r\n  ```bash\r\n  python intelliscript_cli.py set-license-server http://your-server/api/check_license\r\n  ```\r\n- Use Gemini CLI with markdown output:\r\n  ```bash\r\n  python intelliscript_cli.py gemini --markdown \"Explain quantum entanglement\"\r\n  ```\r\n\r\n---\r\n\r\n## Contributing\r\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.\r\n\r\n---\r\n\r\n## License\r\nMIT License. See [LICENSE](LICENSE) for details.\r\n\r\n---\r\n\r\n## Contact\r\nFor issues, feature requests, or support, please open a GitHub Issue or contact the maintainers via the repository.\r\n\r\n\r\n## \u9879\u76ee\u7b80\u4ecb\r\nIntelliScript CLI \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u652f\u6301 License Key \u7ba1\u7406\u3001\u7edf\u4e00\u914d\u7f6e\u3001\u672c\u5730\u4e0e\u8fdc\u7a0b\u4f7f\u7528\u7edf\u8ba1\u3001License \u6821\u9a8c\u53ca\u81ea\u52a8\u7eed\u671f\u3001\u4e91\u7aef\u914d\u7f6e\u3001\u547d\u4ee4\u540c\u6b65\uff0c\u5e76\u4f5c\u4e3a Gemini CLI \u7684\u5305\u88c5\u5668\u3002\r\n\r\n---\r\n\r\n## \u76ee\u5f55\u7ed3\u6784\r\n\r\n```\r\nIntelliScriptCLI/\r\n\u251c\u2500\u2500 intelliscript_cli.py\r\n\u251c\u2500\u2500 requirements.txt\r\n\u251c\u2500\u2500 README.md\r\n```\r\n\r\n---\r\n\r\n## \u4f9d\u8d56\u5b89\u88c5\r\n\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\nrequirements.txt \u5185\u5bb9\uff1a\r\n```\r\nclick\r\nrequests\r\n```\r\n\r\n---\r\n\r\n## \u529f\u80fd\u4e0e\u547d\u4ee4\u8bf4\u660e\r\n\r\n### 1. License Key \u7ba1\u7406\r\n- \u751f\u6210 License Key\r\n  ```bash\r\n  python intelliscript_cli.py gen-license\r\n  ```\r\n- \u8fdc\u7a0b\u6821\u9a8c License Key\r\n  ```bash\r\n  python intelliscript_cli.py check-license\r\n  ```\r\n- \u81ea\u52a8\u7eed\u671f\uff08\u547d\u4ee4\u8c03\u7528\u65f6\u81ea\u52a8\u68c0\u6d4b\u672c\u5730 key \u662f\u5426\u8fc7\u671f\uff0c\u82e5\u8fc7\u671f\u5219\u4ece\u4e91\u7aef\u62c9\u53d6\u65b0 key\uff0c\u8be6\u89c1\u4ee3\u7801\u5b9e\u73b0\uff09\r\n\r\n### 2. \u914d\u7f6e\u7edf\u4e00\u5316\r\n- \u8bbe\u7f6e Gemini API Key\r\n  ```bash\r\n  python intelliscript_cli.py set-gemini-key \u4f60\u7684APIKey\r\n  ```\r\n- \u8bbe\u7f6e\u8fdc\u7a0b\u7edf\u8ba1\u670d\u52a1\u5668\r\n  ```bash\r\n  python intelliscript_cli.py set-stats-server https://your-server/api/usage\r\n  ```\r\n- \u8bbe\u7f6e License \u6821\u9a8c\u670d\u52a1\u5668\r\n  ```bash\r\n  python intelliscript_cli.py set-license-server https://your-server/api/check_license\r\n  ```\r\n- \u67e5\u770b\u5f53\u524d\u914d\u7f6e\r\n  ```bash\r\n  python intelliscript_cli.py show-config\r\n  ```\r\n- \u91cd\u7f6e\u914d\u7f6e\r\n  ```bash\r\n  python intelliscript_cli.py reset-config\r\n  ```\r\n\r\n### 3. \u4f7f\u7528\u7edf\u8ba1\r\n- \u672c\u5730\u7edf\u8ba1\r\n  ```bash\r\n  python intelliscript_cli.py usage-stats\r\n  ```\r\n- \u8fdc\u7a0b\u7edf\u8ba1\r\n  - \u6bcf\u6b21\u547d\u4ee4\u8c03\u7528\u81ea\u52a8\u5411 stats_server \u4e0a\u62a5\u65e5\u5fd7\uff08\u5931\u8d25\u4e0d\u5f71\u54cd\u4e3b\u6d41\u7a0b\uff09\r\n\r\n### 4. Gemini CLI \u5305\u88c5\r\n- \u900f\u4f20\u53c2\u6570\u8c03\u7528 Gemini CLI\r\n  ```bash\r\n  python intelliscript_cli.py gemini run \"\u4f60\u7684\u95ee\u9898\"\r\n  ```\r\n\r\n### 5. \u672c\u5730/\u8fdc\u7a0b\u547d\u4ee4\u540c\u6b65\r\n- \u652f\u6301\u5c06\u672c\u5730\u547d\u4ee4\u5386\u53f2\u540c\u6b65\u81f3\u4e91\u7aef\uff08\u53ef\u6269\u5c55\u4e3a\u5b9a\u65f6/\u624b\u52a8\u540c\u6b65\uff09\r\n- \u4ee3\u7801\u4e2d log_usage_remote \u5b9e\u73b0\u4e86\u6bcf\u6b21\u547d\u4ee4\u8c03\u7528\u7684\u8fdc\u7a0b\u4e0a\u62a5\r\n\r\n### 6. License \u81ea\u52a8\u7eed\u671f\r\n- \u5728\u6bcf\u6b21\u5173\u952e\u547d\u4ee4\u8c03\u7528\u65f6\uff0c\u81ea\u52a8\u68c0\u6d4b\u672c\u5730 License \u662f\u5426\u8fc7\u671f\uff08\u5982\u9700\u53ef\u6269\u5c55\u4e3a\u5b9a\u65f6\u68c0\u6d4b\uff09\r\n- \u82e5\u8fc7\u671f\u5219\u81ea\u52a8\u5411 license_server \u62c9\u53d6\u65b0 key \u5e76\u4fdd\u5b58\r\n\r\n### 7. \u4e91\u7aef\u914d\u7f6e\r\n- \u901a\u8fc7 set-stats-server\u3001set-license-server \u52a8\u6001\u914d\u7f6e\u4e91\u7aef\u5730\u5740\r\n- \u914d\u7f6e\u6587\u4ef6\u7edf\u4e00\u5b58\u50a8\u4e8e `~/.intelliscript/config.json`\r\n\r\n---\r\n\r\n## \u914d\u7f6e\u6587\u4ef6\u4e0e\u65e5\u5fd7\r\n- \u914d\u7f6e\u6587\u4ef6\uff1a`~/.intelliscript/config.json`\r\n- \u4f7f\u7528\u65e5\u5fd7\uff1a`~/.intelliscript/usage.log`\r\n\r\n---\r\n\r\n## \u5168\u90e8\u6838\u5fc3\u4ee3\u7801\r\n\r\n```python\r\nimport os\r\nimport json\r\nimport uuid\r\nimport subprocess\r\nimport click\r\nfrom datetime import datetime, timedelta\r\nimport requests\r\n\r\nCONFIG_PATH = os.path.expanduser('~/.intelliscript/config.json')\r\nUSAGE_LOG = os.path.expanduser('~/.intelliscript/usage.log')\r\n\r\nLICENSE_EXPIRE_DAYS = 30  # License \u6709\u6548\u671f\uff08\u5929\uff09\r\n\r\ndef load_config():\r\n    if not os.path.exists(CONFIG_PATH):\r\n        return {}\r\n    with open(CONFIG_PATH, 'r', encoding='utf-8') as f:\r\n        return json.load(f)\r\n\r\ndef save_config(cfg):\r\n    os.makedirs(os.path.dirname(CONFIG_PATH), exist_ok=True)\r\n    with open(CONFIG_PATH, 'w', encoding='utf-8') as f:\r\n        json.dump(cfg, f, indent=2)\r\n\r\ndef log_usage(command, args):\r\n    os.makedirs(os.path.dirname(USAGE_LOG), exist_ok=True)\r\n    with open(USAGE_LOG, 'a', encoding='utf-8') as f:\r\n        log_entry = {\r\n            'timestamp': datetime.now().isoformat(),\r\n            'command': command,\r\n            'args': args\r\n        }\r\n        f.write(json.dumps(log_entry, ensure_ascii=False) + '\\n')\r\n    log_usage_remote(command, args)\r\n\r\ndef log_usage_remote(command, args):\r\n    cfg = load_config()\r\n    stats_server = cfg.get('stats_server')\r\n    if not stats_server:\r\n        return\r\n    try:\r\n        requests.post(stats_server, json={\r\n            'license_key': cfg.get('license_key'),\r\n            'command': command,\r\n            'args': args,\r\n            'timestamp': datetime.now().isoformat()\r\n        }, timeout=3)\r\n    except Exception:\r\n        pass  # \u8fdc\u7a0b\u7edf\u8ba1\u5931\u8d25\u4e0d\u5f71\u54cd\u4e3b\u6d41\u7a0b\r\n\r\ndef license_expired(cfg):\r\n    # \u68c0\u67e5\u672c\u5730 license \u662f\u5426\u8fc7\u671f\r\n    date_str = cfg.get('license_date')\r\n    if not date_str:\r\n        return True\r\n    try:\r\n        d0 = datetime.fromisoformat(date_str)\r\n        return (datetime.now() - d0) > timedelta(days=LICENSE_EXPIRE_DAYS)\r\n    except Exception:\r\n        return True\r\n\r\ndef renew_license(cfg):\r\n    # \u81ea\u52a8\u5411 license_server \u62c9\u53d6\u65b0 key\r\n    server = cfg.get('license_server')\r\n    if not server:\r\n        click.echo(\"\u672a\u914d\u7f6e license_server\uff0c\u65e0\u6cd5\u81ea\u52a8\u7eed\u671f\u3002\")\r\n        return False\r\n    try:\r\n        resp = requests.post(server, json={'renew': True, 'old_license': cfg.get('license_key')}, timeout=5)\r\n        if resp.status_code == 200:\r\n            data = resp.json()\r\n            cfg['license_key'] = data.get('license_key')\r\n            cfg['license_date'] = datetime.now().isoformat()\r\n            save_config(cfg)\r\n            click.echo(\"License \u81ea\u52a8\u7eed\u671f\u6210\u529f\u3002\")\r\n            return True\r\n        else:\r\n            click.echo(f\"\u81ea\u52a8\u7eed\u671f\u5931\u8d25: {resp.text}\")\r\n            return False\r\n    except Exception as e:\r\n        click.echo(f\"\u81ea\u52a8\u7eed\u671f\u5f02\u5e38: {e}\")\r\n        return False\r\n\r\n@click.group()\r\ndef cli():\r\n    pass\r\n\r\n@cli.command()\r\ndef gen_license():\r\n    \"\"\"\u751f\u6210\u5e76\u4fdd\u5b58 License Key\"\"\"\r\n    cfg = load_config()\r\n    if 'license_key' not in cfg or license_expired(cfg):\r\n        cfg['license_key'] = str(uuid.uuid4()).replace('-', '')\r\n        cfg['license_date'] = datetime.now().isoformat()\r\n        save_config(cfg)\r\n        click.echo(f\"\u65b0 License Key: {cfg['license_key']}\")\r\n    else:\r\n        click.echo(f\"\u5df2\u5b58\u5728 License Key: {cfg['license_key']}\")\r\n\r\n@cli.command()\r\n@click.argument('key')\r\ndef set_gemini_key(key):\r\n    \"\"\"\u914d\u7f6e Gemini API Key\"\"\"\r\n    cfg = load_config()\r\n    cfg['gemini_api_key'] = key\r\n    save_config(cfg)\r\n    click.echo(\"Gemini API Key \u5df2\u4fdd\u5b58\")\r\n\r\n@cli.command()\r\n@click.argument('url')\r\ndef set_stats_server(url):\r\n    \"\"\"\u914d\u7f6e\u8fdc\u7a0b\u7edf\u8ba1\u670d\u52a1\u5668\u5730\u5740\"\"\"\r\n    cfg = load_config()\r\n    cfg['stats_server'] = url\r\n    save_config(cfg)\r\n    click.echo(f\"\u7edf\u8ba1\u670d\u52a1\u5668\u5df2\u8bbe\u7f6e\u4e3a: {url}\")\r\n\r\n@cli.command()\r\n@click.argument('url')\r\ndef set_license_server(url):\r\n    \"\"\"\u914d\u7f6eLicense\u6821\u9a8c\u670d\u52a1\u5668\u5730\u5740\"\"\"\r\n    cfg = load_config()\r\n    cfg['license_server'] = url\r\n    save_config(cfg)\r\n    click.echo(f\"License\u670d\u52a1\u5668\u5df2\u8bbe\u7f6e\u4e3a: {url}\")\r\n\r\n@cli.command()\r\ndef show_config():\r\n    \"\"\"\u663e\u793a\u5f53\u524d\u914d\u7f6e\"\"\"\r\n    cfg = load_config()\r\n    click.echo(json.dumps(cfg, indent=2, ensure_ascii=False))\r\n\r\n@cli.command()\r\ndef reset_config():\r\n    \"\"\"\u91cd\u7f6e\u672c\u5730\u914d\u7f6e\"\"\"\r\n    if os.path.exists(CONFIG_PATH):\r\n        os.remove(CONFIG_PATH)\r\n        click.echo(\"\u914d\u7f6e\u5df2\u91cd\u7f6e\u3002\")\r\n    else:\r\n        click.echo(\"\u914d\u7f6e\u6587\u4ef6\u4e0d\u5b58\u5728\u3002\")\r\n\r\n@cli.command()\r\ndef usage_stats():\r\n    \"\"\"\u663e\u793a\u672c\u5730\u4f7f\u7528\u7edf\u8ba1\u4fe1\u606f\"\"\"\r\n    if not os.path.exists(USAGE_LOG):\r\n        click.echo(\"\u65e0\u4f7f\u7528\u65e5\u5fd7\u3002\")\r\n        return\r\n    with open(USAGE_LOG, 'r', encoding='utf-8') as f:\r\n        lines = f.readlines()\r\n    click.echo(f\"\u5171\u8c03\u7528 {len(lines)} \u6b21\u547d\u4ee4\u3002\")\r\n    stats = {}\r\n    for line in lines:\r\n        try:\r\n            entry = json.loads(line)\r\n            cmd = entry.get('command')\r\n            stats[cmd] = stats.get(cmd, 0) + 1\r\n        except Exception:\r\n            continue\r\n    for cmd, count in stats.items():\r\n        click.echo(f\"  {cmd}: {count} \u6b21\")\r\n\r\n@cli.command()\r\ndef check_license():\r\n    \"\"\"\u8fdc\u7a0b\u6821\u9a8c License Key\"\"\"\r\n    cfg = load_config()\r\n    license_key = cfg.get('license_key')\r\n    server = cfg.get('license_server')\r\n    if not license_key or not server:\r\n        click.echo(\"\u8bf7\u5148\u751f\u6210 License Key \u5e76\u914d\u7f6e license_server\u3002\")\r\n        return\r\n    # \u81ea\u52a8\u7eed\u671f\u903b\u8f91\r\n    if license_expired(cfg):\r\n        click.echo(\"License \u5df2\u8fc7\u671f\uff0c\u81ea\u52a8\u7eed\u671f...\")\r\n        if not renew_license(cfg):\r\n            click.echo(\"\u81ea\u52a8\u7eed\u671f\u5931\u8d25\uff0c\u65e0\u6cd5\u6821\u9a8c\u3002\")\r\n            return\r\n    try:\r\n        resp = requests.post(server, json={'license_key': license_key}, timeout=5)\r\n        if resp.status_code == 200:\r\n            click.echo(f\"\u6821\u9a8c\u7ed3\u679c: {resp.json()}\")\r\n        else:\r\n            click.echo(f\"\u670d\u52a1\u5668\u8fd4\u56de\u5f02\u5e38: {resp.text}\")\r\n    except Exception as e:\r\n        click.echo(f\"\u8fdc\u7a0b\u6821\u9a8c\u5931\u8d25: {e}\")\r\n\r\n@cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True))\r\n@click.pass_context\r\ndef gemini(ctx):\r\n    \"\"\"\u5305\u88c5 Gemini CLI\uff0c\u81ea\u52a8\u6ce8\u5165\u914d\u7f6e\u4e0e\u7edf\u8ba1\"\"\"\r\n    cfg = load_config()\r\n    license_key = cfg.get('license_key')\r\n    # \u81ea\u52a8\u7eed\u671f\u903b\u8f91\r\n    if not license_key or license_expired(cfg):\r\n        click.echo(\"License \u4e0d\u5b58\u5728\u6216\u5df2\u8fc7\u671f\uff0c\u81ea\u52a8\u7eed\u671f...\")\r\n        if not renew_license(cfg):\r\n            click.echo(\"\u81ea\u52a8\u7eed\u671f\u5931\u8d25\uff0c\u65e0\u6cd5\u7ee7\u7eed\u6267\u884c\u547d\u4ee4\u3002\")\r\n            return\r\n    log_usage('gemini', ctx.args)\r\n    env = os.environ.copy()\r\n    if 'gemini_api_key' in cfg:\r\n        env['GEMINI_API_KEY'] = cfg['gemini_api_key']\r\n    try:\r\n        subprocess.run(['gemini'] + ctx.args, env=env)\r\n    except FileNotFoundError:\r\n        click.echo(\"\u672a\u68c0\u6d4b\u5230 gemini-cli\uff0c\u8bf7\u5148\u5b89\u88c5\u3002\")\r\n\r\nif __name__ == '__main__':\r\n    cli()\r\n```\r\n\r\n---\r\n\r\n## \u8fdc\u7a0b License \u6821\u9a8c/\u7eed\u671f\u670d\u52a1\u5668\uff08Flask \u793a\u4f8b\uff09\r\n\r\n```python\r\nfrom flask import Flask, request, jsonify\r\nfrom datetime import datetime\r\napp = Flask(__name__)\r\n\r\nVALID_LICENSES = {\"your_license_key1\", \"your_license_key2\"}\r\n\r\n@app.route('/api/check_license', methods=['POST'])\r\ndef check_license():\r\n    data = request.json\r\n    key = data.get('license_key')\r\n    if key in VALID_LICENSES:\r\n        return jsonify({'valid': True, 'expire': False})\r\n    return jsonify({'valid': False, 'expire': True}), 403\r\n\r\n@app.route('/api/check_license', methods=['POST'])\r\ndef renew_license():\r\n    data = request.json\r\n    if data.get('renew'):\r\n        # \u751f\u6210\u65b0 license key\r\n        new_key = str(uuid.uuid4()).replace('-', '')\r\n        VALID_LICENSES.add(new_key)\r\n        return jsonify({'license_key': new_key, 'renewed': True, 'date': datetime.now().isoformat()})\r\n    return jsonify({'msg': 'invalid request'}), 400\r\n\r\n@app.route('/api/usage', methods=['POST'])\r\ndef usage():\r\n    print(request.json)\r\n    return jsonify({'msg': 'received'})\r\n```\r\n\r\n---\r\n\r\n## \u603b\u7ed3\r\n- \u652f\u6301 License Key \u5168\u751f\u547d\u5468\u671f\u7ba1\u7406\uff08\u751f\u6210\u3001\u6821\u9a8c\u3001\u81ea\u52a8\u7eed\u671f\uff09\r\n- \u652f\u6301\u672c\u5730/\u8fdc\u7a0b\u914d\u7f6e\u4e0e\u7edf\u8ba1\r\n- \u652f\u6301\u547d\u4ee4\u540c\u6b65\u4e0e\u4e91\u7aef\u914d\u7f6e\r\n- \u6240\u6709\u4ee3\u7801\u5df2\u96c6\u6210\u5728 intelliscript_cli.py\uff0c\u4fbf\u4e8e\u4e8c\u6b21\u5f00\u53d1\r\n\r\n\u5982\u9700\u66f4\u591a\u6269\u5c55\u6216\u95ee\u9898\u53cd\u9988\uff0c\u8bf7\u968f\u65f6\u8054\u7cfb\u5f00\u53d1\u8005\u3002\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "World's first AI CLI tool with Google LangExtract integration for command generation and data analysis",
    "version": "2.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/hongping-zh/intelliscript/issues",
        "Changelog": "https://github.com/hongping-zh/intelliscript/blob/main/CHANGELOG_v2.1.md",
        "Documentation": "https://github.com/hongping-zh/intelliscript/blob/main/README.md",
        "Feature Requests": "https://github.com/hongping-zh/intelliscript/discussions",
        "Homepage": "https://github.com/hongping-zh/intelliscript",
        "Repository": "https://github.com/hongping-zh/intelliscript.git"
    },
    "split_keywords": [
        "ai",
        " cli",
        " command-line",
        " langextract",
        " data-extraction",
        " visualization",
        " automation",
        " llm",
        " openai",
        " ollama",
        " anthropic",
        " google-gemini",
        " data-analysis",
        " reports"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1004f08691bde9ef8d195fd3ae86466c31a3509446a1aba861bebbc8422c4b82",
                "md5": "10d9f60b8088e32d4930ad6f2c9c0224",
                "sha256": "dab264346601d74b8d6be4d7cee997243e6943d4068c8c5e7a92f2dc40b471dd"
            },
            "downloads": -1,
            "filename": "intelliscript_ai-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "10d9f60b8088e32d4930ad6f2c9c0224",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20767,
            "upload_time": "2025-08-15T03:34:04",
            "upload_time_iso_8601": "2025-08-15T03:34:04.157039Z",
            "url": "https://files.pythonhosted.org/packages/10/04/f08691bde9ef8d195fd3ae86466c31a3509446a1aba861bebbc8422c4b82/intelliscript_ai-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "695a4ee7a0a4ccedac9bfcfe29323198316180147d020815f9945d1ec71a1af1",
                "md5": "7a6a58e58d0d50fc42c889c30ad20861",
                "sha256": "0293b18dbaac520add921aef3c1502f8d9b8fe5610b536b3daf8e474fdaacfa9"
            },
            "downloads": -1,
            "filename": "intelliscript_ai-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7a6a58e58d0d50fc42c889c30ad20861",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 64601,
            "upload_time": "2025-08-15T03:34:05",
            "upload_time_iso_8601": "2025-08-15T03:34:05.986354Z",
            "url": "https://files.pythonhosted.org/packages/69/5a/4ee7a0a4ccedac9bfcfe29323198316180147d020815f9945d1ec71a1af1/intelliscript_ai-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-15 03:34:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hongping-zh",
    "github_project": "intelliscript",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "click",
            "specs": [
                [
                    ">=",
                    "8.0.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.25.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "6.0.0"
                ]
            ]
        },
        {
            "name": "anthropic",
            "specs": [
                [
                    ">=",
                    "0.3.0"
                ]
            ]
        },
        {
            "name": "cryptography",
            "specs": [
                [
                    ">=",
                    "3.4.0"
                ]
            ]
        },
        {
            "name": "boto3",
            "specs": [
                [
                    ">=",
                    "1.18.0"
                ]
            ]
        },
        {
            "name": "google-cloud-storage",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "PyJWT",
            "specs": [
                [
                    ">=",
                    "2.3.0"
                ]
            ]
        },
        {
            "name": "secure-smtplib",
            "specs": [
                [
                    ">=",
                    "0.1.1"
                ]
            ]
        }
    ],
    "lcname": "intelliscript-ai"
}
        
Elapsed time: 1.03700s