NEW基于 Ollama · 100% 本地运行 →

Ethereum dApp,一条 curl 命令即可

Wagmi AI 是一组专注于 Wagmi、viem 与现代 React dApp 架构的开源 LLM。通过 Ollama 在本机运行,仓库保持私密,并以结构化 JSON 返回 hook 修复、配置审查与连接器建议。

❯ curl -s -X POST https://wagmiai.dev/api/wagmi -H "Content-Type: text/plain" --data-binary @useSwap.tsx | jq .report

⠿ wagmi-coder:7b 分析中… 186 lines · 3.1s

HIGHuseWriteContract 缺少 chainId 校验L24

MEDIUM切换钱包后数据陈旧 — 缺少 queryKeyL41

LOW写入前建议使用 useSimulateContractL52

quality_score: 88 / 100

支持技术

  • Wagmi v2
  • viem
  • React
  • TanStack Query
  • WalletConnect
  • RainbowKit
  • Ollama

Models

四种模型,覆盖不同工作流

每个模型均以 Ollama Modelfile 形式提供 — 在成熟开源代码 LLM 上叠加 Wagmi 系统提示与调参。

wagmi-coder:7b

qwen2.5-coder:7b

速度与准确度平衡

日常 PR 与 CI 的默认模型,擅长 hooks、配置与 TypeScript/React 模式。

Accuracy86%
Speed92%

wagmi-deep:14b

qwen2.5-coder:14b

逐步追踪流程

逐步分析钱包事件、RPC 错误与多 hook 状态,适合不稳定的主网问题。

Accuracy91%
Speed72%

wagmi-pro:32b

qwen2.5-coder:32b

生产级架构审查

大型应用旗舰模型:SSR、多链、账户抽象与连接器边界情况。

Accuracy95%
Speed48%

wagmi-lite:3b

qwen2.5-coder:3b

笔记本也能轻松运行

快速初扫与学习,适合编辑器保存时即时检查。

Accuracy78%
Speed98%

* 准确度与速度为模型间相对比较的参考值,实际表现取决于硬件与代码库。

How it works

代码不会离开你的电脑

无需云 API 密钥,无按量计费。终端 → Ollama → dApp 审查报告,仅此而已。

  1. 01

    发送源码

    用 curl 发送 .tsx、.ts 或 wagmi 配置。支持本地 Ollama (:11434) 或本站 /api/wagmi 代理。

    curl --data-binary @app.tsx

  2. 02

    本地 LLM 推理

    Ollama 在 GPU/CPU 上运行 Wagmi 模型,系统提示按清单检查 hooks、链与 viem 调用。

    ollama · temperature 0.15

  3. 03

    JSON 报告

    包含严重级别、位置、Wagmi 模式 ID 与修复建议的结构化 JSON,便于 jq、CI 与看板。

    format: "json"

Why local AI

全天候守护钱包栈的副驾驶

Wagmi AI 是上主网前的第一道防线 — 在开发循环中捕获链配置错误、损坏的 hooks 与连接器失误。

完全隐私

未发布的 dApp 代码也可放心分析,推理仅在本地 Ollama 中进行。

免费且无限制

无 token 计费,每次提交、每个文件都可零成本审查。

结构化输出

Ollama JSON 模式返回稳定 schema,自动化更轻松。

CI/CD 友好

配合 curl 与 jq,可在发现严重 Wagmi 配置问题时使构建失败。

Quick start · curl

5 分钟用本地 AI 自动化 Wagmi 审查

选择模型与系统后,下方 curl 命令会自动更新。按顺序复制,接入编辑器、脚本或 CI 即可。

选择模型

  1. 安装 Ollama

    安装本地 LLM 运行时 Ollama。安装后后台在 :11434 端口运行。

    install.sh
    curl -fsSL https://ollama.com/install.sh | sh
    # If the server isn't running: ollama serve
    ollama --version
    curl -s http://localhost:11434/api/tags | head
  2. 下载基础模型

    wagmi-coder:7b 基于 qwen2.5-coder:7b(4.7 GB)构建。

    pull.sh
    ollama pull qwen2.5-coder:7b
  3. 获取 Modelfile 并创建 Wagmi 模型

    用 curl 下载 Modelfile(Wagmi 系统提示与参数)并注册为 Ollama 模型。

    create.sh
    curl -fsSL https://wagmiai.dev/api/modelfile/wagmi-coder-7b -o wagmi-coder-7b.Modelfile
    ollama create wagmi-coder:7b -f wagmi-coder-7b.Modelfile
    ollama list | grep wagmi
  4. 快速测试

    向 Ollama /api/generate 发送短代码。format: "json" 保证结构化报告。

    quick-test.sh
    curl http://localhost:11434/api/generate -d '{
      "model": "wagmi-coder:7b",
      "prompt": "Review this Wagmi hook for chainId and simulation issues:\n\nexport function useBad() { ... }",
      "stream": false,
      "format": "json"
    }' | jq .
  5. 审查完整组件

    使用 jq -Rs 将文件内容安全包装后管道到 /api/chat。

    audit.sh
    jq -Rs --arg model "wagmi-coder:7b" '{
      model: $model,
      stream: false,
      format: "json",
      messages: [{ role: "user", content: . }]
    }' src/useSwap.tsx | curl -s http://localhost:11434/api/chat -d @- | jq -r '.message.content' | jq .
  6. 使用 Wagmi AI 代理 API

    npm run dev 启动本站后,/api/wagmi 代为调用 Ollama,无需 JSON 转义。

    proxy.sh
    curl -s -X POST "https://wagmiai.dev/api/wagmi?model=wagmi-coder:7b" \
      -H "Content-Type: text/plain" \
      --data-binary @src/useSwap.tsx | jq .report

Live example

输入有问题的 hook,得到如下报告

使用 wagmi-coder:7b 审查缺少 chain 守卫与陈旧余额读取的 swap 组件。

输入 · useSwap.tsx
import { useAccount, useReadContract, useWriteContract } from 'wagmi'
import { erc20Abi } from 'viem'

export function useSwap(token: `0x${string}`) {
  const { address } = useAccount()

  const { data: balance } = useReadContract({
    address: token,
    abi: erc20Abi,
    functionName: 'balanceOf',
    args: [address!],
  })

  const { writeContract } = useWriteContract()

  const swap = () =>
    writeContract({
      address: token,
      abi: erc20Abi,
      functionName: 'approve',
      args: ['0xRouter...', balance ?? 0n],
    })

  return { balance, swap }
}
输出 · POST /api/wagmi
{
  "model": "wagmi-coder:7b",
  "report": {
    "quality_score": 88,
    "findings": [
      {
        "severity": "high",
        "title": "Missing chainId on writeContract",
        "line": 24,
        "pattern": "wagmi/write-chain-guard",
        "recommendation": "Pass chainId from useChainId() or use useWriteContract({ mutation: { onError } }) with simulate first."
      },
      {
        "severity": "medium",
        "title": "Stale balance after wallet switch",
        "line": 11,
        "pattern": "tanstack/query-key-account",
        "recommendation": "Include address and chainId in TanStack Query key via wagmi's queryKey helper."
      }
    ]
  }
}

Coverage

一次请求覆盖的 Wagmi 模式

从 hook 误用到连接器配置、多链路由与 viem 类型,一次完成。

useAccount / useConnect

连接器状态、重连与 SSR 注水

useReadContract

ABI 类型、enabled 与区块/tag 新鲜度

useWriteContract

模拟、chainId 与 receipt 轮询

useWatchContractEvent

监听器清理与多链过滤

createConfig

chains、transports 与 SSR cookie

WalletConnect

Project ID、元数据与深链

Multicall & batching

Wagmi hooks 与 viem multicall

Error handling

RPC 错误、用户拒绝与 revert 数据

TanStack Query

切换链/账户后的 queryKey 设计

Testing

Mock 连接器与 hook 测试

Performance

多余 refetch 与缓存调优

Security UX

交易预览与地址校验

API reference

两个入口,一种 schema

直接调用 Ollama (http://localhost:11434),或使用 Wagmi AI 代理简化请求。

  • POST/api/wagmi

    接收 TS/TSX 源码,经 Ollama 审查后返回 JSON 报告

    Wagmi AI
  • GET/api/models

    可用模型与 Modelfile 下载地址

    Wagmi AI
  • GET/api/modelfile/:slug

    供 ollama create 使用的 Modelfile (text/plain)

    Wagmi AI
  • POST/api/chat

    对话请求 — 在 messages 中传入源码

    Ollama
  • POST/api/generate

    单提示请求 — 测试短片段

    Ollama

JSON 请求体示例

chat.json
curl -s http://localhost:11434/api/chat -d '{
  "model": "wagmi-coder:7b",
  "stream": false,
  "format": "json",
  "messages": [
    {
      "role": "user",
      "content": "Review this Wagmi React component for hook and viem best practices.\n\n<file contents>"
    }
  ]
}' | jq -r '.message.content' | jq .

CI 流水线门禁

ci-gate.sh
#!/usr/bin/env bash
set -euo pipefail
MODEL="wagmi-coder:7b"
for f in src/**/*.tsx; do
  report=$(curl -sf -X POST "$SITE/api/wagmi?model=$MODEL" \
    -H "Content-Type: text/plain" --data-binary @"$f" | jq -r '.report.quality_score')
  if [[ "$report" -lt 70 ]]; then
    echo "Wagmi review failed for $f (score $report)"
    exit 1
  fi
done

FAQ

常见问题

上线前,先问 Wagmi AI

免费 · 开源 · 100% 本地。今天审查你的第一个 hook。

AI 分析仅供参考,不能替代专业安全审查。Wagmi 与 Ollama 为各自所有者的商标。

© 2026 Wagmi AI