blockrun
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBlockRun
BlockRun
BlockRun works with Claude Code and Google Antigravity.
You can't generate images. You have no real-time X/Twitter access. BlockRun gives you these capabilities.
BlockRun 可与 Claude Code 和 Google Antigravity 配合使用。
你无法生成图像,也无法获取实时X/Twitter数据,BlockRun可为你提供这些功能。
Philosophy
设计理念
You have a wallet. When you need a capability you lack, you pay for it autonomously.
| You Need | You Call | Pricing |
|---|---|---|
| Image generation | DALL-E | $0.04/image |
| Real-time X data | Grok + Live Search | $0.025/source |
| Second opinion | GPT-5.2 | $1.75/M input, $14/M output |
| Cheaper processing | DeepSeek | $0.14/M input, $0.28/M output |
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.
你拥有一个钱包,当你需要自身不具备的功能时,可以自主付费使用。
| 你需要的功能 | 调用的工具 | 定价 |
|---|---|---|
| 图像生成 | DALL-E | $0.04/张 |
| 实时X数据 | Grok + 实时搜索 | $0.025/数据源 |
| 二次意见 | GPT-5.2 | 输入$1.75/百万token,输出$14/百万token |
| 低成本处理 | DeepSeek | 输入$0.14/百万token,输出$0.28/百万token |
工作原理: BlockRun 使用x402微支付将你的请求路由到OpenAI、xAI、Google等服务商。无需API密钥,你的钱包按token计费。
Budget Control (Optional)
预算控制(可选)
If the user specifies a budget (e.g., "use at most $1"), track spending and stop when budget is reached:
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()
budget = 1.0 # User's budget如果用户指定了预算(例如“最多使用1美元”),请跟踪支出,达到预算后停止调用:
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()
budget = 1.0 # 用户设定的预算Before each call, check if within budget
每次调用前检查是否在预算内
spending = client.get_spending()
if spending['total_usd'] >= budget:
print(f"Budget reached: ${spending['total_usd']:.4f} spent")
# Stop making calls
else:
response = client.chat("openai/gpt-5.2", "Hello!")
spending = client.get_spending()
if spending['total_usd'] >= budget:
print(f"已达预算:已花费${spending['total_usd']:.4f}")
# 停止调用
else:
response = client.chat("openai/gpt-5.2", "Hello!")
At the end, report spending
最后报告支出情况
spending = client.get_spending()
print(f"💰 Total spent: ${spending['total_usd']:.4f} across {spending['calls']} calls")
undefinedspending = client.get_spending()
print(f"💰 总支出:${spending['total_usd']:.4f},共调用{spending['calls']}次")
undefinedWhen to Use
使用场景
| Trigger | Your Action |
|---|---|
| User explicitly requests ("blockrun second opinion with GPT on...", "use grok to check...", "generate image with dall-e") | Execute via BlockRun |
| User needs something you can't do (images, live X data) | Suggest BlockRun, wait for confirmation |
| You can handle the task fine | Do it yourself, don't mention BlockRun |
| 触发条件 | 你的操作 |
|---|---|
| 用户明确请求(如“blockrun用GPT给出二次意见...”、“用grok查询...”、“用dall-e生成图像”) | 通过BlockRun执行 |
| 用户需要你无法完成的任务(图像生成、实时X数据) | 建议使用BlockRun,等待用户确认 |
| 你可以独立完成任务 | 自行处理,无需提及BlockRun |
Example User Prompts
用户提示示例
Users will say things like:
| User Says | What You Do |
|---|---|
| "blockrun generate an image of a sunset" | Call DALL-E via ImageClient |
| "use grok to check what's trending on X" | Call Grok with |
| "blockrun GPT review this code" | Call GPT-5.2 via LLMClient |
| "what's the latest news about AI agents?" | Suggest Grok (you lack real-time data) |
| "generate a logo for my startup" | Suggest DALL-E (you can't generate images) |
| "blockrun check my balance" | Show wallet balance via |
| "blockrun deepseek summarize this file" | Call DeepSeek for cost savings |
用户可能会这样说:
| 用户提问 | 你的操作 |
|---|---|
| "blockrun生成一张日落的图片" | 通过ImageClient调用DALL-E |
| "用grok查看X上的热门内容" | 调用Grok并设置 |
| "blockrun用GPT审核这段代码" | 通过LLMClient调用GPT-5.2 |
| "关于AI Agent的最新消息是什么?" | 建议使用Grok(你没有实时数据) |
| "为我的创业公司生成一个logo" | 建议使用DALL-E(你无法生成图像) |
| "blockrun查看我的余额" | 通过 |
| "blockrun用deepseek总结这个文件" | 调用DeepSeek以节省成本 |
Wallet & Balance
钱包与余额
Use to auto-create a wallet and get a client. This shows the QR code and welcome message on first use.
setup_agent_wallet()Initialize client (always start with this):
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet() # Auto-creates wallet, shows QR if newCheck balance (when user asks "show balance", "check wallet", etc.):
python
balance = client.get_balance() # On-chain USDC balance
print(f"Balance: ${balance:.2f} USDC")
print(f"Wallet: {client.get_wallet_address()}")Show QR code for funding:
python
from blockrun_llm import generate_wallet_qr_ascii, get_wallet_address使用自动创建钱包并获取客户端。首次使用时会显示二维码和欢迎信息。
setup_agent_wallet()初始化客户端(务必从这一步开始):
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet() # 自动创建钱包,若为新钱包则显示二维码查询余额(当用户询问“显示余额”、“检查钱包”等):
python
balance = client.get_balance() # 链上USDC余额
print(f"余额:${balance:.2f} USDC")
print(f"钱包地址:{client.get_wallet_address()}")显示充值二维码:
python
from blockrun_llm import generate_wallet_qr_ascii, get_wallet_addressASCII QR for terminal display
终端显示ASCII格式的二维码
print(generate_wallet_qr_ascii(get_wallet_address()))
undefinedprint(generate_wallet_qr_ascii(get_wallet_address()))
undefinedSDK Usage
SDK使用方法
Prerequisite: Install the SDK with
pip install blockrun-llm前置条件: 使用安装SDK
pip install blockrun-llmBasic Chat
基础对话
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet() # Auto-creates wallet if needed
response = client.chat("openai/gpt-5.2", "What is 2+2?")
print(response)python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet() # 若需要则自动创建钱包
response = client.chat("openai/gpt-5.2", "2+2等于多少?")
print(response)Check spending
查询支出
spending = client.get_spending()
print(f"Spent ${spending['total_usd']:.4f}")
undefinedspending = client.get_spending()
print(f"已花费${spending['total_usd']:.4f}")
undefinedReal-time X/Twitter Search (xAI Live Search)
实时X/Twitter搜索(xAI实时数据API)
IMPORTANT: For real-time X/Twitter data, you MUST enable Live Search with or .
search=Truesearch_parameterspython
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()重要提示: 要获取实时X/Twitter数据,必须通过或启用实时搜索。
search=Truesearch_parameterspython
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()Simple: Enable live search with search=True
简单用法:设置search=True启用实时搜索
response = client.chat(
"xai/grok-3",
"What are the latest posts from @blockrunai on X?",
search=True # Enables real-time X/Twitter search
)
print(response)
undefinedresponse = client.chat(
"xai/grok-3",
"X上@blockrunai的最新帖子是什么?",
search=True # 启用实时X/Twitter搜索
)
print(response)
undefinedAdvanced X Search with Filters
带筛选条件的高级X搜索
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()
response = client.chat(
"xai/grok-3",
"Analyze @blockrunai's recent content and engagement",
search_parameters={
"mode": "on",
"sources": [
{
"type": "x",
"included_x_handles": ["blockrunai"],
"post_favorite_count": 5
}
],
"max_search_results": 20,
"return_citations": True
}
)
print(response)python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()
response = client.chat(
"xai/grok-3",
"分析@blockrunai近期的内容和互动情况",
search_parameters={
"mode": "on",
"sources": [
{
"type": "x",
"included_x_handles": ["blockrunai"],
"post_favorite_count": 5
}
],
"max_search_results": 20,
"return_citations": True
}
)
print(response)Image Generation
图像生成
python
from blockrun_llm import ImageClient
client = ImageClient()
result = client.generate("A cute cat wearing a space helmet")
print(result.data[0].url)python
from blockrun_llm import ImageClient
client = ImageClient()
result = client.generate("一只戴着太空头盔的可爱猫咪")
print(result.data[0].url)xAI Live Search Reference
xAI实时搜索参考
Live Search is xAI's real-time data API. Cost: $0.025 per source (default 10 sources = ~$0.26).
To reduce costs, set to a lower value:
max_search_resultspython
undefined实时搜索是xAI的实时数据API,定价为每个数据源$0.025(默认10个数据源≈$0.26)。
如需降低成本,可将设置为更小的值:
max_search_resultspython
undefinedOnly use 5 sources (~$0.13)
仅使用5个数据源(≈$0.13)
response = client.chat("xai/grok-3", "What's trending?",
search_parameters={"mode": "on", "max_search_results": 5})
undefinedresponse = client.chat("xai/grok-3", "当前热门内容是什么?",
search_parameters={"mode": "on", "max_search_results": 5})
undefinedSearch Parameters
搜索参数
| Parameter | Type | Default | Description |
|---|---|---|---|
| string | "auto" | "off", "auto", or "on" |
| array | web,news,x | Data sources to query |
| bool | true | Include source URLs |
| string | - | Start date (YYYY-MM-DD) |
| string | - | End date (YYYY-MM-DD) |
| int | 10 | Max sources to return (customize to control cost) |
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 字符串 | "auto" | 可选值:"off"、"auto"、"on" |
| 数组 | web,news,x | 要查询的数据源 |
| 布尔值 | true | 是否包含源URL |
| 字符串 | - | 开始日期(格式:YYYY-MM-DD) |
| 字符串 | - | 结束日期(格式:YYYY-MM-DD) |
| 整数 | 10 | 返回的最大数据源数量(可自定义以控制成本) |
Source Types
数据源类型
X/Twitter Source:
python
{
"type": "x",
"included_x_handles": ["handle1", "handle2"], # Max 10
"excluded_x_handles": ["spam_account"], # Max 10
"post_favorite_count": 100, # Min likes threshold
"post_view_count": 1000 # Min views threshold
}Web Source:
python
{
"type": "web",
"country": "US", # ISO alpha-2 code
"allowed_websites": ["example.com"], # Max 5
"safe_search": True
}News Source:
python
{
"type": "news",
"country": "US",
"excluded_websites": ["tabloid.com"] # Max 5
}X/Twitter数据源:
python
{
"type": "x",
"included_x_handles": ["handle1", "handle2"], # 最多10个
"excluded_x_handles": ["spam_account"], # 最多10个
"post_favorite_count": 100, # 最低点赞数阈值
"post_view_count": 1000 # 最低浏览量阈值
}网页数据源:
python
{
"type": "web",
"country": "US", # ISO alpha-2国家代码
"allowed_websites": ["example.com"], # 最多5个
"safe_search": True
}新闻数据源:
python
{
"type": "news",
"country": "US",
"excluded_websites": ["tabloid.com"] # 最多5个
}Available Models
可用模型
| Model | Best For | Pricing |
|---|---|---|
| Second opinions, code review, general | $1.75/M in, $14/M out |
| Cost-optimized reasoning | $0.30/M in, $1.20/M out |
| Latest efficient reasoning | $1.10/M in, $4.40/M out |
| Advanced reasoning, complex problems | $10/M in, $40/M out |
| Real-time X/Twitter data | $3/M + $0.025/source |
| Simple tasks, bulk processing | $0.14/M in, $0.28/M out |
| Very long documents, fast | $0.15/M in, $0.60/M out |
| Photorealistic images | $0.04/image |
| Fast, artistic images | $0.01/image |
M = million tokens. Actual cost depends on your prompt and response length.
| 模型 | 适用场景 | 定价 |
|---|---|---|
| 二次意见、代码审核、通用场景 | 输入$1.75/百万token,输出$14/百万token |
| 成本优化型推理 | 输入$0.30/百万token,输出$1.20/百万token |
| 最新高效推理模型 | 输入$1.10/百万token,输出$4.40/百万token |
| 高级推理、复杂问题 | 输入$10/百万token,输出$40/百万token |
| 实时X/Twitter数据 | $3/百万token + $0.025/数据源 |
| 简单任务、批量处理 | 输入$0.14/百万token,输出$0.28/百万token |
| 超长文档处理、快速响应 | 输入$0.15/百万token,输出$0.60/百万token |
| 写实风格图像生成 | $0.04/张 |
| 快速生成艺术风格图像 | $0.01/张 |
M = 百万token。实际成本取决于你的提示词和响应长度。
Cost Reference
成本参考
All LLM costs are per million tokens (M = 1,000,000 tokens).
| Model | Input | Output |
|---|---|---|
| GPT-5.2 | $1.75/M | $14.00/M |
| GPT-5-mini | $0.30/M | $1.20/M |
| Grok-3 (no search) | $3.00/M | $15.00/M |
| DeepSeek | $0.14/M | $0.28/M |
| Fixed Cost Actions | |
|---|---|
| Grok Live Search | $0.025/source (default 10 = $0.25) |
| DALL-E image | $0.04/image |
| Nano Banana image | $0.01/image |
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.
所有大模型成本以百万token为单位(M = 1,000,000 token)。
| 模型 | 输入成本 | 输出成本 |
|---|---|---|
| GPT-5.2 | $1.75/M | $14.00/M |
| GPT-5-mini | $0.30/M | $1.20/M |
| Grok-3(无搜索) | $3.00/M | $15.00/M |
| DeepSeek | $0.14/M | $0.28/M |
| 固定成本操作 | 定价 |
|---|---|
| Grok实时搜索 | $0.025/数据源(默认10个=$0.25) |
| DALL-E图像生成 | $0.04/张 |
| Nano Banana图像生成 | $0.01/张 |
典型成本: 给GPT-5.2发送500词提示词(约750token),输入成本约$0.001;1000词响应(约1500token),输出成本约$0.02。
Setup & Funding
设置与充值
Wallet location: (e.g., )
$HOME/.blockrun/.session/Users/username/.blockrun/.sessionFirst-time setup:
- Wallet auto-creates when is called
setup_agent_wallet() - Check wallet and balance:
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()
print(f"Wallet: {client.get_wallet_address()}")
print(f"Balance: ${client.get_balance():.2f} USDC")- Fund wallet with $1-5 USDC on Base network
Show QR code for funding (ASCII for terminal):
python
from blockrun_llm import generate_wallet_qr_ascii, get_wallet_address
print(generate_wallet_qr_ascii(get_wallet_address()))钱包位置: (例如)
$HOME/.blockrun/.session/Users/username/.blockrun/.session首次设置:
- 调用时自动创建钱包
setup_agent_wallet() - 查看钱包和余额:
python
from blockrun_llm import setup_agent_wallet
client = setup_agent_wallet()
print(f"钱包地址:{client.get_wallet_address()}")
print(f"余额:${client.get_balance():.2f} USDC")- 在Base网络给钱包充值1-5 USDC
显示充值二维码(终端显示ASCII格式):
python
from blockrun_llm import generate_wallet_qr_ascii, get_wallet_address
print(generate_wallet_qr_ascii(get_wallet_address()))Troubleshooting
故障排除
"Grok says it has no real-time access"
→ You forgot to enable Live Search. Add :
search=Truepython
response = client.chat("xai/grok-3", "What's trending?", search=True)Module not found
→ Install the SDK:
pip install blockrun-llm“Grok提示无实时访问权限”
→ 你忘记启用实时搜索,添加:
search=Truepython
response = client.chat("xai/grok-3", "当前热门内容是什么?", search=True)“模块未找到”
→ 安装SDK:
pip install blockrun-llmUpdates
更新SDK
bash
pip install --upgrade blockrun-llmbash
pip install --upgrade blockrun-llm