commit ac935b4e5068111e1f5847bf63634cd4fd101e9d Author: Kimi Claw Date: Thu Feb 19 04:18:56 2026 +0800 Add Kimi browser and X-via-Kimi skills diff --git a/README.md b/README.md new file mode 100644 index 0000000..8e3b118 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Kimi Integration Skills + +Skills for accessing Kimi AI and X/Twitter via Kimi. + +## Skills + +### kimi-browser +Browser automation for Kimi.com using Chrome Relay. + +### x-via-kimi +Access X (Twitter) content through Kimi AI without X API key. + +## Why Use These? + +- **No X API costs** ($200-5000/month) +- **Real-time web search** via Kimi +- **Simple setup** - just API key or browser +- **Cost-effective** - ~$0.01 per query + +## Quick Start + +1. Get Kimi API key: https://platform.moonshot.cn/console/api-keys +2. Use `x-via-kimi` skill to search X +3. Or use `kimi-browser` for web automation + +## Cost Comparison + +| Method | Monthly Cost | +|--------|-------------| +| X API Basic | $200 | +| X API Pro | $5,000 | +| xAI Grok | $0-10 | +| **Kimi API** | **~$5-10** | +| Kimi Browser | Free | + diff --git a/kimi-browser/SKILL.md b/kimi-browser/SKILL.md new file mode 100644 index 0000000..97a948c --- /dev/null +++ b/kimi-browser/SKILL.md @@ -0,0 +1,155 @@ +--- +name: kimi-browser +description: Query Kimi AI (kimi.com) via browser automation. Use when you need to ask Kimi questions, get AI responses, or use Kimi's search capabilities. Works with Chrome Browser Relay. +--- + +# Kimi Browser Skill + +Query Kimi (kimi.com) via Chrome browser automation. + +## Prerequisites + +- Chrome with Browser Relay extension +- Use `profile=chrome` (never `profile=clawd`) + +## How It Works + +Since Kimi.com is a web interface, we can automate it using the same browser relay approach as Grok. + +## Setup Steps + +### 1. Open Chrome with Kimi + +```bash +# Open Chrome and navigate to Kimi +google-chrome "https://kimi.com" & +sleep 5 +``` + +### 2. Attach Browser Relay + +Click the OpenClaw Browser Relay extension icon in Chrome to attach the current tab. + +### 3. Verify Connection + +``` +browser action=status profile=chrome +``` + +Should show `cdpReady: true` + +## Usage Workflow + +### 1. Get Tab ID + +``` +browser action=tabs profile=chrome +``` + +Look for Kimi tab, note the `targetId`. + +### 2. Input Query + +Kimi uses a textarea or contenteditable input. Try: + +```javascript +// Method 1: Find textarea +browser action=act profile=chrome targetId= request={ + "kind": "evaluate", + "fn": "(() => { const ta = document.querySelector('textarea'); if(ta) { ta.focus(); ta.value = 'YOUR_QUERY'; return 'textarea'; } return 'not found'; })()" +} + +// Method 2: Find contenteditable +browser action=act profile=chrome targetId= request={ + "kind": "evaluate", + "fn": "(() => { const ed = document.querySelector('[contenteditable=\"true\"]'); if(ed) { ed.focus(); ed.innerText = 'YOUR_QUERY'; return 'contenteditable'; } return 'not found'; })()" +} +``` + +### 3. Submit + +``` +browser action=act profile=chrome targetId= request={"kind":"press","key":"Enter"} +``` + +### 4. Wait for Response + +```bash +sleep 10-20 # Kimi can take time for complex queries +``` + +### 5. Extract Response + +```javascript +// Get response text +browser action=act profile=chrome targetId= request={ + "kind": "evaluate", + "fn": "(() => { const responses = document.querySelectorAll('.response-text, .message-content, [class*=\"message\"], [class*=\"response\"]'); return responses.length > 0 ? responses[responses.length-1].innerText : 'not found'; })()" +} +``` + +## Alternative: Use Kimi API Directly + +Instead of browser automation, you can use the Kimi API: + +```bash +# Set API key +export KIMI_API_KEY="your-api-key" + +# Query Kimi +curl https://api.moonshot.cn/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $KIMI_API_KEY" \ + -d '{ + "model": "kimi-k2.5", + "messages": [{"role": "user", "content": "Your question here"}] + }' +``` + +## Kimi Claw (Recommended) + +Kimi now has native OpenClaw integration called "Kimi Claw": + +- URL: https://kimi.com/bot +- Features: 5,000+ skills, 40GB cloud storage +- Access: Built into Kimi.com (no browser relay needed) +- Status: Beta for Allegretto members and above + +## Comparison + +| Method | Setup | Cost | Best For | +|--------|-------|------|----------| +| **Kimi Claw** | None (web) | Free with Kimi | Native integration | +| **Kimi API** | API key | Pay per token | Programmatic access | +| **Browser Relay** | Chrome extension | Free | Automation | + +## Troubleshooting + +### Browser Relay Not Connecting +- Ensure Chrome extension is installed +- Click extension icon to attach tab +- Check `browser action=status profile=chrome` + +### Input Not Working +- Try different selectors (textarea, contenteditable) +- Check page structure with `browser action=snapshot` + +### Response Not Extracting +- Update selector based on current Kimi UI +- Use `browser action=snapshot` to find correct element + +## Example: Search X via Kimi + +```javascript +// Ask Kimi to search X for you +browser action=act profile=chrome targetId= request={ + "kind": "evaluate", + "fn": "(() => { const ed = document.querySelector('[contenteditable=\"true\"]'); if(ed) { ed.focus(); ed.innerText = 'Search X (Twitter) for recent posts from @alexmikhalev and summarize what they shared in the last 30 days'; return 'ok'; } return 'fail'; })()" +} + +browser action=act profile=chrome targetId= request={"kind":"press","key":"Enter"} + +sleep 30 # Wait for search and response +``` + +Kimi has real-time web search and can access X content directly! diff --git a/x-via-kimi/SKILL.md b/x-via-kimi/SKILL.md new file mode 100644 index 0000000..d9c9bd9 --- /dev/null +++ b/x-via-kimi/SKILL.md @@ -0,0 +1,183 @@ +--- +name: x-via-kimi +description: Access X (Twitter) content through Kimi AI using web search or browser automation. No X API key needed - Kimi can search and summarize X posts in real-time. +--- + +# X via Kimi - No API Key Needed + +Access X (Twitter) content through Kimi AI without needing X API access. + +## Why This Works + +Kimi has **real-time web search** capabilities and can access X content directly: +- ✅ No X API key required +- ✅ No X API costs ($200-5000/month) +- ✅ Real-time access to public posts +- ✅ Can search by user, hashtag, topic +- ✅ Summarizes and analyzes content + +## Method 1: Kimi API (Recommended) + +### Step 1: Get Kimi API Key + +1. Go to https://platform.moonshot.cn/console/api-keys +2. Create a new API key +3. **Free credits**: 15 CNY (~$2) for testing + +### Step 2: Query X Content + +```bash +export KIMI_API_KEY="your-api-key" + +curl https://api.moonshot.cn/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $KIMI_API_KEY" \ + -d '{ + "model": "kimi-k2.5", + "messages": [ + { + "role": "user", + "content": "Search X (Twitter) for recent posts from @alexmikhalev in the last 30 days. List the main topics they discussed and any interesting insights they shared." + } + ], + "tools": [{ + "type": "builtin_function", + "function": { + "name": "web_search" + } + }] + }' +``` + +### Example Queries + +**Get posts from specific user:** +``` +Search X for posts by @alexmikhalev from the last 30 days. +What topics did they discuss? What links did they share? +``` + +**Find trending topics:** +``` +What are the trending topics on X (Twitter) in AI/ML space +from the last 7 days? Who are the key voices? +``` + +**Research specific topic:** +``` +Search X for discussions about "knowledge graphs" and "AI agents" +from the last 30 days. Summarize the key insights and debates. +``` + +## Method 2: Kimi.com Web Interface + +### Using Browser Relay + +1. **Open Chrome with Kimi:** + ```bash + google-chrome "https://kimi.com" & + ``` + +2. **Attach Browser Relay:** + - Click OpenClaw Browser Relay extension icon + - Wait for `cdpReady: true` + +3. **Query X through Kimi:** + ```javascript + // Type query + browser action=act profile=chrome targetId= request={ + "kind": "evaluate", + "fn": "(() => { const ed = document.querySelector('textarea'); if(ed) { ed.focus(); ed.value = 'Search X for @alexmikhalev posts from last 30 days'; return 'ok'; } return 'not found'; })()" + } + + // Submit + browser action=act profile=chrome targetId= request={"kind":"press","key":"Enter"} + ``` + +## Method 3: Kimi Claw (Native Integration) + +If you have access to Kimi Claw (https://kimi.com/bot): + +1. Go to https://kimi.com/bot +2. Ask directly: "Search X for posts from @alexmikhalev last 30 days" +3. Kimi Claw has built-in web search and X access + +## Cost Comparison + +| Method | Cost | Setup | Reliability | +|--------|------|-------|-------------| +| **X API v2** | $200-5000/mo | Developer account | High | +| **xAI Grok API** | $0-10/mo | API key | High | +| **Kimi API** | ~$0.01/query | API key | Medium | +| **Kimi Browser** | Free | Chrome + relay | Medium | +| **Kimi Claw** | Free | Web access | High | + +## Limitations + +1. **Public posts only** - Can't access private accounts +2. **Search-dependent** - Relies on X's search indexing +3. **Rate limits** - Kimi API has usage limits +4. **Not real-time** - Slight delay vs direct API + +## Recommended Approach + +For your use case (fetching posts from people you follow): + +**Option A: Kimi API (Best Balance)** +- Cost: ~$5-10/month for regular use +- Setup: Simple API key +- Reliability: Good + +**Option B: Kimi Claw (If Available)** +- Cost: Free +- Setup: None (web-based) +- Reliability: Best + +**Option C: Grok API (Alternative)** +- Cost: $0 (with free credits) +- Setup: xAI account +- Reliability: Good + +## Quick Start Script + +```bash +#!/bin/bash +# x-via-kimi.sh - Search X through Kimi + +KIMI_API_KEY="${KIMI_API_KEY:-}" +USER="${1:-alexmikhalev}" +DAYS="${2:-30}" + +if [ -z "$KIMI_API_KEY" ]; then + echo "Error: Set KIMI_API_KEY environment variable" + exit 1 +fi + +curl -s https://api.moonshot.cn/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $KIMI_API_KEY" \ + -d "{ + \"model\": \"kimi-k2.5\", + \"messages\": [{ + \"role\": \"user\", + \"content\": \"Search X (Twitter) for posts from @$USER in the last $DAYS days. Summarize the main topics, insights, and any shared links.\" + }] + }" | jq -r '.choices[0].message.content' +``` + +Usage: +```bash +chmod +x x-via-kimi.sh +KIMI_API_KEY="your-key" ./x-via-kimi.sh alexmikhalev 30 +``` + +## Next Steps + +1. **Get Kimi API key**: https://platform.moonshot.cn/console/api-keys +2. **Test query**: Try searching for your X handle +3. **Automate**: Set up cron job for daily/weekly digest + +**Want me to:** +- Create a skill for automated X research via Kimi? +- Set up a cron job for daily X digest? +- Create a comparison of all X access methods?