Use when user needs capabilities Claude lacks (image generation, real-time X/Twitter data) or explicitly requests external models ("blockrun", "use grok", "use gpt", "dall-e", "deepseek")
Add this skill
npx mdskills install sickn33/blockrunExtends agent with external model access and image generation via micropayment wallet
1---2name: blockrun3description: Use when user needs capabilities Claude lacks (image generation, real-time X/Twitter data) or explicitly requests external models ("blockrun", "use grok", "use gpt", "dall-e", "deepseek")4allowed-tools: Read, Bash(python:*), Bash(python3:*), Bash(pip:*), Bash(source:*)5---67# BlockRun89**BlockRun works with Claude Code and Google Antigravity.**1011You can't generate images. You have no real-time X/Twitter access. BlockRun gives you these capabilities.1213## Philosophy1415You have a wallet. When you need a capability you lack, you pay for it autonomously.1617| You Need | You Call | Pricing |18|----------|----------|---------|19| Image generation | DALL-E | $0.04/image |20| Real-time X data | Grok + Live Search | $0.025/source |21| Second opinion | GPT-5.2 | $1.75/M input, $14/M output |22| Cheaper processing | DeepSeek | $0.14/M input, $0.28/M output |2324**How it works:** BlockRun uses x402 micropayments to route your requests to OpenAI, xAI, Google, and other providers. No API keys needed - your wallet pays per token.2526## Budget Control (Optional)2728If the user specifies a budget (e.g., "use at most $1"), track spending and stop when budget is reached:2930```python31from blockrun_llm import setup_agent_wallet3233client = setup_agent_wallet()34budget = 1.0 # User's budget3536# Before each call, check if within budget37spending = client.get_spending()38if spending['total_usd'] >= budget:39 print(f"Budget reached: ${spending['total_usd']:.4f} spent")40 # Stop making calls41else:42 response = client.chat("openai/gpt-5.2", "Hello!")4344# At the end, report spending45spending = client.get_spending()46print(f"๐ฐ Total spent: ${spending['total_usd']:.4f} across {spending['calls']} calls")47```4849## When to Use5051| Trigger | Your Action |52|---------|-------------|53| User explicitly requests ("blockrun second opinion with GPT on...", "use grok to check...", "generate image with dall-e") | Execute via BlockRun |54| User needs something you can't do (images, live X data) | Suggest BlockRun, wait for confirmation |55| You can handle the task fine | Do it yourself, don't mention BlockRun |5657## Example User Prompts5859Users will say things like:6061| User Says | What You Do |62|-----------|-------------|63| "blockrun generate an image of a sunset" | Call DALL-E via ImageClient |64| "use grok to check what's trending on X" | Call Grok with `search=True` |65| "blockrun GPT review this code" | Call GPT-5.2 via LLMClient |66| "what's the latest news about AI agents?" | Suggest Grok (you lack real-time data) |67| "generate a logo for my startup" | Suggest DALL-E (you can't generate images) |68| "blockrun check my balance" | Show wallet balance via `get_balance()` |69| "blockrun deepseek summarize this file" | Call DeepSeek for cost savings |7071## Wallet & Balance7273Use `setup_agent_wallet()` to auto-create a wallet and get a client. This shows the QR code and welcome message on first use.7475**Initialize client (always start with this):**76```python77from blockrun_llm import setup_agent_wallet7879client = setup_agent_wallet() # Auto-creates wallet, shows QR if new80```8182**Check balance (when user asks "show balance", "check wallet", etc.):**83```python84balance = client.get_balance() # On-chain USDC balance85print(f"Balance: ${balance:.2f} USDC")86print(f"Wallet: {client.get_wallet_address()}")87```8889**Show QR code for funding:**90```python91from blockrun_llm import generate_wallet_qr_ascii, get_wallet_address9293# ASCII QR for terminal display94print(generate_wallet_qr_ascii(get_wallet_address()))95```9697## SDK Usage9899**Prerequisite:** Install the SDK with `pip install blockrun-llm`100101### Basic Chat102```python103from blockrun_llm import setup_agent_wallet104105client = setup_agent_wallet() # Auto-creates wallet if needed106response = client.chat("openai/gpt-5.2", "What is 2+2?")107print(response)108109# Check spending110spending = client.get_spending()111print(f"Spent ${spending['total_usd']:.4f}")112```113114### Real-time X/Twitter Search (xAI Live Search)115116**IMPORTANT:** For real-time X/Twitter data, you MUST enable Live Search with `search=True` or `search_parameters`.117118```python119from blockrun_llm import setup_agent_wallet120121client = setup_agent_wallet()122123# Simple: Enable live search with search=True124response = client.chat(125 "xai/grok-3",126 "What are the latest posts from @blockrunai on X?",127 search=True # Enables real-time X/Twitter search128)129print(response)130```131132### Advanced X Search with Filters133134```python135from blockrun_llm import setup_agent_wallet136137client = setup_agent_wallet()138139response = client.chat(140 "xai/grok-3",141 "Analyze @blockrunai's recent content and engagement",142 search_parameters={143 "mode": "on",144 "sources": [145 {146 "type": "x",147 "included_x_handles": ["blockrunai"],148 "post_favorite_count": 5149 }150 ],151 "max_search_results": 20,152 "return_citations": True153 }154)155print(response)156```157158### Image Generation159```python160from blockrun_llm import ImageClient161162client = ImageClient()163result = client.generate("A cute cat wearing a space helmet")164print(result.data[0].url)165```166167## xAI Live Search Reference168169Live Search is xAI's real-time data API. Cost: **$0.025 per source** (default 10 sources = ~$0.26).170171To reduce costs, set `max_search_results` to a lower value:172```python173# Only use 5 sources (~$0.13)174response = client.chat("xai/grok-3", "What's trending?",175 search_parameters={"mode": "on", "max_search_results": 5})176```177178### Search Parameters179180| Parameter | Type | Default | Description |181|-----------|------|---------|-------------|182| `mode` | string | "auto" | "off", "auto", or "on" |183| `sources` | array | web,news,x | Data sources to query |184| `return_citations` | bool | true | Include source URLs |185| `from_date` | string | - | Start date (YYYY-MM-DD) |186| `to_date` | string | - | End date (YYYY-MM-DD) |187| `max_search_results` | int | 10 | Max sources to return (customize to control cost) |188189### Source Types190191**X/Twitter Source:**192```python193{194 "type": "x",195 "included_x_handles": ["handle1", "handle2"], # Max 10196 "excluded_x_handles": ["spam_account"], # Max 10197 "post_favorite_count": 100, # Min likes threshold198 "post_view_count": 1000 # Min views threshold199}200```201202**Web Source:**203```python204{205 "type": "web",206 "country": "US", # ISO alpha-2 code207 "allowed_websites": ["example.com"], # Max 5208 "safe_search": True209}210```211212**News Source:**213```python214{215 "type": "news",216 "country": "US",217 "excluded_websites": ["tabloid.com"] # Max 5218}219```220221## Available Models222223| Model | Best For | Pricing |224|-------|----------|---------|225| `openai/gpt-5.2` | Second opinions, code review, general | $1.75/M in, $14/M out |226| `openai/gpt-5-mini` | Cost-optimized reasoning | $0.30/M in, $1.20/M out |227| `openai/o4-mini` | Latest efficient reasoning | $1.10/M in, $4.40/M out |228| `openai/o3` | Advanced reasoning, complex problems | $10/M in, $40/M out |229| `xai/grok-3` | Real-time X/Twitter data | $3/M + $0.025/source |230| `deepseek/deepseek-chat` | Simple tasks, bulk processing | $0.14/M in, $0.28/M out |231| `google/gemini-2.5-flash` | Very long documents, fast | $0.15/M in, $0.60/M out |232| `openai/dall-e-3` | Photorealistic images | $0.04/image |233| `google/nano-banana` | Fast, artistic images | $0.01/image |234235*M = million tokens. Actual cost depends on your prompt and response length.*236237## Cost Reference238239All LLM costs are per million tokens (M = 1,000,000 tokens).240241| Model | Input | Output |242|-------|-------|--------|243| GPT-5.2 | $1.75/M | $14.00/M |244| GPT-5-mini | $0.30/M | $1.20/M |245| Grok-3 (no search) | $3.00/M | $15.00/M |246| DeepSeek | $0.14/M | $0.28/M |247248| Fixed Cost Actions | |249|-------|--------|250| Grok Live Search | $0.025/source (default 10 = $0.25) |251| DALL-E image | $0.04/image |252| Nano Banana image | $0.01/image |253254**Typical costs:** A 500-word prompt (~750 tokens) to GPT-5.2 costs ~$0.001 input. A 1000-word response (~1500 tokens) costs ~$0.02 output.255256## Setup & Funding257258**Wallet location:** `$HOME/.blockrun/.session` (e.g., `/Users/username/.blockrun/.session`)259260**First-time setup:**2611. Wallet auto-creates when `setup_agent_wallet()` is called2622. Check wallet and balance:263```python264from blockrun_llm import setup_agent_wallet265client = setup_agent_wallet()266print(f"Wallet: {client.get_wallet_address()}")267print(f"Balance: ${client.get_balance():.2f} USDC")268```2693. Fund wallet with $1-5 USDC on Base network270271**Show QR code for funding (ASCII for terminal):**272```python273from blockrun_llm import generate_wallet_qr_ascii, get_wallet_address274print(generate_wallet_qr_ascii(get_wallet_address()))275```276277## Troubleshooting278279**"Grok says it has no real-time access"**280โ You forgot to enable Live Search. Add `search=True`:281```python282response = client.chat("xai/grok-3", "What's trending?", search=True)283```284285**Module not found**286โ Install the SDK: `pip install blockrun-llm`287288## Updates289290```bash291pip install --upgrade blockrun-llm292```293
Full transparency โ inspect the skill content before installing.