API转换
- 作者仓库星标 0
- 作者更新于 实时读取
- 作者仓库 skills-registry
- 领域
- 数据
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @tomevault-io · 未声明 license
- Token 消耗评级
- 中等消耗
- 接入复杂程度
- 需手动接入
- 是否需要外部 API Key
- 需要 · Vendor-specific
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: brian-api
description: Brian API — natural language to executable Web3 transactions. Convert text intents into swap, br…
category: 数据
runtime: 无特殊运行时
---
# brian-api 输出预览
## PART A: 任务判断
- 适用问题:表格、CSV、数据集、指标或分析流程。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“What You Probably Got Wrong / Setup / Get an API Key”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于表格、CSV、数据集、指标或分析流程,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“What You Probably Got Wrong / Setup / Get an API Key”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、会按任务需要访问外部网络、需要准备 Vendor-specific API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/agent`、`/transaction`、`/api` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“What You Probably Got Wrong / Setup / Get an API Key”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: brian-api
description: Brian API — natural language to executable Web3 transactions. Convert text intents into swap, br…
category: 数据
source: tomevault-io/skills-registry
---
# brian-api
## 什么时候使用
- 把数据处理方向的常用动作沉淀成 Agent 可调用的技能 适合处理表格、CSV、指标、数据集、分析和可视化报告,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步…
- 面向表格、CSV、数据集、指标或分析流程,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「What You Probably Got Wrong / Setup / Get an API Key」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "brian-api" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> What You Probably Got Wrong / Setup / Get an API Key
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 需要准备 Vendor-specific API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Brian API
Brian API converts natural language prompts into executable Web3 transactions. Send a text intent like "swap 10 USDC for ETH on Base" and receive ready-to-sign transaction calldata, complete with approval steps and routing through the best available DEX/bridge solvers. Supports swap, bridge, transfer, deposit, withdraw, borrow, and repay actions across Ethereum, Arbitrum, Base, Optimism, Polygon, and 10+ other EVM chains.
Three core endpoints: /agent/transaction returns executable calldata from a prompt, /agent/knowledge answers DeFi protocol questions with source citations, and /agent/smart-contracts generates Solidity code from descriptions. The TypeScript SDK (@brian-ai/sdk) wraps all endpoints, and the LangChain toolkit (@brian-ai/langchain) lets you plug Brian into autonomous agents.
Official docs: https://docs.brianknows.org/
What You Probably Got Wrong
LLMs have stale training data. These are the most common mistakes.
- "Brian executes transactions" -- Brian returns transaction calldata. Your application must sign and broadcast. The API never holds private keys and never submits transactions on your behalf.
- "One API call = one transaction" -- A single prompt can return multiple steps. A swap requiring token approval returns an
approvetransaction as step 0 and the swap as step 1. You must execute all steps in order. - "Brian picks the chain from the token name" -- If the chain is ambiguous (USDC exists on 10+ chains), Brian cannot guess. Either include the chain in your prompt ("swap USDC on Base") or pass
chainIdin the request body. Omitting both throws an error. - "The SDK endpoint is
brianknows.org" -- The API base URL ishttps://api.brianknows.org. US-based projects can usehttps://us-api.brianknows.orgfor lower latency. - "
/transactionand/agent/transactionare the same" --/api/v0/agent/transactionis the agent endpoint with session context. The plain/api/v0/transactionendpoint (deprecated) does not support chat history or solver routing. Use the agent endpoint. - "I can use any HTTP header for auth" -- The API key header is
x-brian-api-key, notAuthorization: Bearer. Using the wrong header returns a 401 with no helpful message. - "Bridge and cross-chain swap are the same action" -- A bridge moves the same token across chains. A cross-chain swap bridges AND swaps in one step (e.g., ETH on Ethereum to USDC on Base). Brian handles both, but the solver routing differs.
- "Deposit/withdraw work on all chains" -- DeFi actions (deposit, withdraw, borrow, repay) are only supported on Ethereum, Arbitrum, Optimism, Polygon, Base, and Avalanche via the Enso solver. Other chains only support swap, bridge, and transfer.
npm install brian-- The package is@brian-ai/sdk. There is nobrianpackage on npm related to this project.
Setup
Get an API Key
- Go to https://brianknows.org
- Create an account or sign in
- Navigate to API Keys section
- Generate a new API key
- Store it in your environment:
export BRIAN_API_KEY="brian_..."
Install the SDK
npm install @brian-ai/sdk
Initialize
import { BrianSDK } from "@brian-ai/sdk";
const brian = new BrianSDK({
apiKey: process.env.BRIAN_API_KEY!,
});
For US-based projects, override the API URL:
const brian = new BrianSDK({
apiKey: process.env.BRIAN_API_KEY!,
apiUrl: "https://us-api.brianknows.org",
});
Core Endpoints
Transaction Endpoint
Convert a natural language prompt into executable transaction calldata.
POST https://api.brianknows.org/api/v0/agent/transaction
const response = await brian.transact({
prompt: "Swap 10 USDC for ETH on Base",
address: "0xYourWalletAddress",
chainId: "8453",
});
Raw HTTP
curl -X POST "https://api.brianknows.org/api/v0/agent/transaction" \
-H "Content-Type: application/json" \
-H "x-brian-api-key: $BRIAN_API_KEY" \
-d '{
"prompt": "Swap 10 USDC for ETH on Base",
"address": "0xYourWalletAddress",
"chainId": "8453"
}'
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Natural language transaction intent |
address |
string | Yes | Sender wallet address (checksummed) |
chainId |
string | No | Source chain ID. If omitted, inferred from prompt. Throws error if ambiguous. |
Response Structure
{
"result": [
{
"solver": "Enso",
"action": "swap",
"type": "write",
"data": {
"description": "Swap 10 USDC for ETH on Base",
"steps": [
{
"chainId": 8453,
"to": "0xUSDC_CONTRACT",
"from": "0xYourWalletAddress",
"data": "0x095ea7b3...",
"value": "0",
"gasLimit": "60000"
},
{
"chainId": 8453,
"to": "0xROUTER_CONTRACT",
"from": "0xYourWalletAddress",
"data": "0x5ae401dc...",
"value": "0",
"gasLimit": "250000"
}
],
"fromToken": {
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"chainId": 8453,
"symbol": "USDC",
"decimals": 6
},
"toToken": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 8453,
"symbol": "ETH",
"decimals": 18
},
"fromAmount": "10000000",
"toAmount": "3200000000000000"
}
}
]
}
The steps array contains transactions that must be executed in order. Step 0 is typically a token approval when swapping from an ERC-20.
Knowledge Endpoint
Ask protocol questions and get answers with source citations.
POST https://api.brianknows.org/api/v0/agent/knowledge
const response = await brian.ask({
prompt: "What is the current TVL of Aave V3 on Arbitrum?",
kb: "public-knowledge-box",
});
Raw HTTP
curl -X POST "https://api.brianknows.org/api/v0/agent/knowledge" \
-H "Content-Type: application/json" \
-H "x-brian-api-key: $BRIAN_API_KEY" \
-d '{
"prompt": "What is the current TVL of Aave V3 on Arbitrum?",
"kb": "public-knowledge-box"
}'
Response Structure
{
"result": {
"answer": "The current TVL of Aave V3 on Arbitrum is...",
"context": [
{
"pageContent": "...",
"metadata": {
"source": "https://docs.aave.com/...",
"title": "Aave V3 Documentation"
}
}
]
}
}
Smart Contracts Endpoint
Generate Solidity contracts from natural language descriptions.
POST https://api.brianknows.org/api/v0/agent/smart-contracts
const response = await brian.generateContract({
prompt: "Create an ERC-20 token with a max supply of 1 million and a 2% transfer tax",
});
Executing Transactions
Brian returns calldata but does not execute. You must sign and send each step.
With viem
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
import { BrianSDK } from "@brian-ai/sdk";
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const walletClient = createWalletClient({
account,
chain: base,
transport: http(),
});
const brian = new BrianSDK({
apiKey: process.env.BRIAN_API_KEY!,
});
async function executeIntent(prompt: string) {
const response = await brian.transact({
prompt,
address: account.address,
chainId: "8453",
});
for (const result of response) {
for (const step of result.data.steps) {
const hash = await walletClient.sendTransaction({
to: step.to as `0x${string}`,
data: step.data as `0x${string}`,
value: BigInt(step.value),
gas: step.gasLimit ? BigInt(step.gasLimit) : undefined,
});
const publicClient = createPublicClient({
chain: base,
transport: http(),
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
if (receipt.status !== "success") {
throw new Error(`Transaction failed: ${hash}`);
}
}
}
}
With ethers.js
import { ethers } from "ethers";
import { BrianSDK } from "@brian-ai/sdk";
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const brian = new BrianSDK({
apiKey: process.env.BRIAN_API_KEY!,
});
async function executeIntent(prompt: string) {
const response = await brian.transact({
prompt,
address: wallet.address,
chainId: "8453",
});
for (const result of response) {
for (const step of result.data.steps) {
const tx = await wallet.sendTransaction({
to: step.to,
data: step.data,
value: BigInt(step.value),
gasLimit: step.gasLimit ? BigInt(step.gasLimit) : undefined,
});
const receipt = await tx.wait();
if (!receipt || receipt.status === 0) {
throw new Error(`Transaction reverted: ${tx.hash}`);
}
}
}
}
Supported Actions
| Action | Description | Solver | Chains |
|---|---|---|---|
swap |
Exchange tokens on the same chain | Enso, LI.FI, Portals | All supported chains |
bridge |
Move tokens across chains | Bungee, LI.FI, Symbiosis | All EVM chains |
transfer |
Send tokens to another address | Native | All supported chains |
deposit |
Deposit into DeFi protocols (Aave, Compound, etc.) | Enso | Ethereum, Arbitrum, Optimism, Polygon, Base, Avalanche |
withdraw |
Withdraw from DeFi protocols | Enso | Ethereum, Arbitrum, Optimism, Polygon, Base, Avalanche |
borrow |
Borrow from lending protocols (Aave) | Enso | Ethereum, Arbitrum, Optimism, Polygon, Base, Avalanche |
repay |
Repay borrowed positions | Enso | Ethereum, Arbitrum, Optimism, Polygon, Base, Avalanche |
cross-chain swap |
Bridge + swap in one intent | LI.FI, Bungee | All EVM chains |
Prompt Engineering
Brian's NLP model extracts structured parameters from natural language. Better prompts produce more accurate results.
Effective Prompts
"Swap 100 USDC for WETH on Arbitrum"
"Bridge 0.5 ETH from Ethereum to Base"
"Deposit 1000 USDC into Aave on Polygon"
"Transfer 50 USDT to 0xRecipientAddress on Optimism"
"Borrow 500 USDC from Aave on Ethereum with ETH as collateral"
Ineffective Prompts
"Buy some crypto" -- no token, no amount, no chain
"Move my tokens" -- no specifics
"Do something with USDC" -- no action
"Swap USDC" -- no target token, no amount
Rules
- Always specify the amount and token symbol
- Include the chain name when the token exists on multiple chains
- For bridge/cross-chain: specify both source and destination chains
- For DeFi actions: name the protocol (e.g., "Aave", "Compound")
- Use standard token symbols (USDC, WETH, DAI), not contract addresses
LangChain Integration
The @brian-ai/langchain package provides a toolkit for building autonomous Web3 agents.
Install
npm install @brian-ai/langchain @langchain/openai langchain
Create an Agent
import { createBrianAgent } from "@brian-ai/langchain";
import { ChatOpenAI } from "@langchain/openai";
const agent = await createBrianAgent({
apiKey: process.env.BRIAN_API_KEY!,
privateKeyOrAccount: process.env.PRIVATE_KEY as `0x${string}`,
llm: new ChatOpenAI({
modelName: "gpt-4o",
temperature: 0,
}),
});
const result = await agent.invoke({
input: "Swap 10 USDC for ETH on Base",
});
console.log(result.output);
Use BrianToolkit Directly
import { BrianToolkit } from "@brian-ai/langchain";
const toolkit = new BrianToolkit({
apiKey: process.env.BRIAN_API_KEY!,
privateKeyOrAccount: process.env.PRIVATE_KEY as `0x${string}`,
});
const tools = toolkit.getTools();
The toolkit exposes individual tools for swap, bridge, transfer, deposit, withdraw, borrow, and repay. Each tool can be added to any LangChain agent.
With Coinbase CDP Wallet
import { BrianCDPToolkit } from "@brian-ai/langchain";
const cdpToolkit = new BrianCDPToolkit({
apiKey: process.env.BRIAN_API_KEY!,
coinbaseApiKeyName: process.env.CDP_API_KEY_NAME!,
coinbaseApiKeySecret: process.env.CDP_API_KEY_SECRET!,
});
const tools = cdpToolkit.getTools();
Error Handling
import { BrianSDK } from "@brian-ai/sdk";
const brian = new BrianSDK({
apiKey: process.env.BRIAN_API_KEY!,
});
async function safeTransact(prompt: string, address: string) {
try {
const response = await brian.transact({
prompt,
address,
});
if (!response || response.length === 0) {
throw new Error("Brian returned no results. Rephrase your prompt with more detail.");
}
return response;
} catch (error: unknown) {
if (error instanceof Error) {
if (error.message.includes("401")) {
throw new Error("Invalid API key. Check BRIAN_API_KEY environment variable.");
}
if (error.message.includes("429")) {
throw new Error("Rate limited. Wait before retrying.");
}
if (error.message.includes("chain")) {
throw new Error("Chain could not be determined. Include chain name in prompt or pass chainId.");
}
}
throw error;
}
}
Rate Limits
| Plan | Requests/Minute | Requests/Day |
|---|---|---|
| Free | 30 | 1,000 |
| Pro | 120 | 10,000 |
| Enterprise | Custom | Custom |
Rate limit headers are returned on every response:
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
X-RateLimit-Reset: 1709001600
Security Considerations
- Never expose your API key client-side. Route all Brian API calls through a backend server.
- Validate transaction calldata before signing. Brian returns calldata from third-party solvers (Enso, LI.FI). Verify the
toaddress is the expected contract. - Set allowances carefully. Approval steps may request unlimited allowance. Override with a specific amount if your security policy requires it.
- Simulate transactions before broadcasting on mainnet. Use
eth_callor Tenderly simulation to catch reverts. - Never log or store the full transaction response in production -- it contains calldata that could be replayed.
References
- Brian API Documentation: https://docs.brianknows.org/
- Brian TypeScript SDK: https://github.com/brian-knows/brian-sdk
- Brian LangChain Toolkit: https://github.com/brian-knows/langchain-toolkit
@brian-ai/sdkon npm: https://www.npmjs.com/package/@brian-ai/sdk@brian-ai/langchainon npm: https://www.npmjs.com/package/@brian-ai/langchain- LangChain Toolkit Docs: https://langchain.brianknows.org/
- API Swagger: https://api.brianknows.org/swagger
Last verified: February 2026
Source: aomi-labs/skills — distributed by TomeVault.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核