156 lines
4.2 KiB
Markdown
156 lines
4.2 KiB
Markdown
---
|
|
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=<id> 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=<id> 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=<id> 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=<id> 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=<id> 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=<id> request={"kind":"press","key":"Enter"}
|
|
|
|
sleep 30 # Wait for search and response
|
|
```
|
|
|
|
Kimi has real-time web search and can access X content directly!
|