MCPcopy Index your code
hub / github.com/BlockRunAI/Franklin

github.com/BlockRunAI/Franklin @v3.29.16

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.29.16 ↗ · + Follow
1,899 symbols 4,862 edges 238 files 153 documented · 8%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Franklin Agent terminal

Franklin Agent

The AI agent with a wallet.

Other agents write code. Franklin Agent writes code and spends money to get things done.

One wallet. Every model. Every paid API. Pay only for outcomes — not subscriptions.

npm downloads stars license TypeScript Node x402 telegram

Quick start · YOPO · Category · What it does · Smart Router · Comparison · Architecture · Community


The pitch in one paragraph

Most coding agents write code. Franklin Agent writes code and spends money to get the job done. It holds a USDC wallet, picks the best model per task from 55+ providers, purchases trading data, generates images, pays for web search — all autonomously. You state an outcome and set a budget. Franklin Agent decides what to call, what to pay for, and when to stop. Every paid action routes through the x402 micropayment protocol and settles against your own wallet. No subscriptions. No API keys. No account. The wallet is the identity.

Built by the BlockRun team. Apache-2.0. TypeScript. Ships as one npm package.

YOPO — You Only Pay Outcome

Not a subscription (pay for access). Not a generic pay-per-call (pay for trying). You pay only for the work Franklin Agent delivers. Provider cost + 5%, settled per action in USDC. No monthly fees. No rate limits. No overdraft.


Quick start

Requires Node.js 20.19+ (Node 22 LTS recommended). Check with node -v. Older Node crashes at startup with ERR_REQUIRE_ESM.

# 1. Install
npm install -g @blockrun/franklin

# 2. Run (free — uses NVIDIA Nemotron & Qwen3 Coder out of the box)
franklin

# 3. (optional) Fund a wallet to unlock Sonnet, Opus, GPT, Gemini, Grok, + paid APIs
franklin setup base        # or: franklin setup solana
franklin balance           # show address + USDC balance

That's it. Zero signup, zero credit card, zero phone verification. Send $5 of USDC to the wallet and you've unlocked every frontier model and every paid tool in the BlockRun gateway.

No global install? Just run it directly — no permissions, no -g:

npx @blockrun/franklin

Install troubleshooting

Symptom Cause Fix
npm error EACCES … mkdir '/usr/local/lib/node_modules' Your global npm folder is owned by root (common when Node was installed from the macOS .pkg). Don't use sudo. Either run npx @blockrun/franklin (no global install needed), or switch to a user-owned Node via a version manager — see below.
Error [ERR_REQUIRE_ESM] … rpc-websockets … require() of ES Module … uuid Node is older than 20.19. Franklin's Solana deps need the require(esm) support added in Node 20.19.0. Upgrade to Node 20.19+ or 22 LTS (see below). This is the #1 cause of a crash on first run.
npm warn EBADENGINE … required: { node: '>=20.x' } Node is older than 20.19. Upgrade to Node 20.19+ or 22 LTS. The warning alone is harmless, but on old Node the run will also crash — upgrade.

The clean, permanent fix for both is a user-owned Node so global installs never touch root-owned system folders:

# nvm (https://github.com/nvm-sh/nvm)
nvm install 22 && nvm use 22
npm install -g @blockrun/franklin

# or fnm (https://github.com/Schniz/fnm)
fnm install 22 && fnm use 22
npm install -g @blockrun/franklin

Prefer a GUI? Try Franklin for VS Code

Franklin for VS Code — Beta is here

The same agent ships as a VS Code extension — chat panel, model picker, wallet balance, image / video generation, inline diff cards — all driven by the wallet you already funded for the CLI.

VS Code → Extensions  (Cmd+Shift+X / Ctrl+Shift+X)
        → search "Franklin" → Install
        → click the Franklin icon in the Activity Bar

Free models work immediately. Paid models, image gen, and video gen activate the moment your wallet has USDC. The CLI and the extension share the same ~/.blockrun/ config and session history, so jumping between terminal and VS Code is seamless.


YOPO

You Only Pay Outcome. This is Franklin Agent's pricing model, and it is the opposite of almost every other AI product you use.

You pay for... Result
AI subscription Access. Paid whether you use it or not. $20–200/month, rate-limited.
Pay-per-call (OpenAI API, etc.) Every attempt — even failed ones. Hidden cost from retries, dead ends.
Franklin Agent (YOPO) The outcome. Each signed micropayment. Provider cost + 5%. No more.

Three consequences fall out of this:

  1. No subscriptions. Use Franklin for $0.50 one week and $50 the next — you pay for compute actually consumed, nothing more.
  2. No rate limits. Subscriptions throttle you when you need AI most. YOPO has no artificial caps — if you have USDC, you have access.
  3. No overdraft. The wallet balance IS the hard limit. When it's empty, Franklin stops. No surprise bills, no 3 a.m. rate-limit walls.

Concretely — $1 in USDC gets you roughly: - ~400K GPT-4o input tokens - ~7M DeepSeek tokens - ~13M Gemini Flash tokens - ~20 DALL-E 3 images - ~40 Exa neural web searches - Unlimited agent-tested NVIDIA free tier (Qwen3 Coder + Llama 4 Maverick, no wallet needed)


A new category

Economic Agent

Software that can hold a wallet, price its own actions, spend toward an outcome, and stop at a hard budget cap.

Most AI products fit into one of three buckets: they answer questions, write code, or automate a fixed workflow. None of them can spend money.

Franklin can. It combines purchasing power (it pays for models, tools, and APIs), budget awareness (cost is part of the loop, not an afterthought), cross-vertical execution (code, trading, research, marketing, ops), and hard stopping conditions (wallet balance is a real constraint, not a suggestion).

That is why Franklin is an economic agent, not just a task agent.


What Franklin can execute

Franklin is chat-first. You do not wire a DAG, configure six API keys, or commit to one model vendor. You state an outcome. Franklin decides what to read, search, fetch, call, and pay for.

📈 Trading signals

> what's BTC looking like today?

  ✓ TradingSignal  BTC

  ## BTC Signal Report

  Price: $71,056 USD (+2.3% 24h)
  Market Cap: $1.42T
  24h Volume: $29.6B

  ### Technical Indicators (30d)
  - RSI(14): 53.2 — neutral
  - MACD: 339.21 / Signal: 280.45 — bullish crossover
  - Bollinger: within band (upper $73,773 / lower $64,545)
  - Volatility: 35.3% annualized — medium

> if I enter at 65000 with $1000, where should my stop be?

  Based on ATR(14) and support at $63,500:
  Entry: $65,000 · Stop: $63,200 (−2.8%) · Risk: $27.69
  Risk/reward to $70K target: 1:2.8 ✓

Live data from CoinGecko. RSI, MACD, Bollinger, and volatility computed locally. No API key needed.

🎨 Image generation

> generate a logo for my AI startup — minimalist, dark background

  ✓ ImageGen  "minimalist AI startup logo, dark background..."
  Saved: generated-logo-1713052800.png (1024x1024)

Generates images via DALL-E / GPT Image directly from the CLI. Paid from your wallet — no OpenAI API key needed.

📱 Remote control via Telegram

Run franklin telegram on an always-on machine (set TELEGRAM_BOT_TOKEN + TELEGRAM_OWNER_ID) and drive Franklin from your phone. Owner-locked, session-resumable across restarts, slash commands (/new, /balance, /status). Trading, content, dev work — all reachable from a Telegram chat.

🔎 Research, code, anything with a budget

> compare the top 5 AI agent pricing models, summarize the patterns, and save a note for me

  ✓ WebSearch  ai agent pricing models
  ✓ WebFetch   5 articles
  ✓ Write      notes/agent-pricing.md

  Summary:
  - Most agents hide pricing behind monthly seats
  - Usage-based products win with power users and teams
  - Wallet-based billing is still basically empty whitespace
> refactor src/auth.ts to use the new jwt helper, then run the tests

  ✓ Read   src/auth.ts                    $0.002
  ✓ Read   src/lib/jwt.ts                 $0.001
  ✓ Edit   src/auth.ts (-24 +31 lines)    $0.008
  ✓ Bash   npm test                       $0.000
    › 142 passing · 0 failing · 2.4s

  Done in 18s · $0.011

Code is still first-class. It is just one workload, not the category.

Every tool call is itemized. Every token is priced. When the wallet hits zero, Franklin stops. No overdraft, no surprise bill, no rate-limit wall at 3 a.m. — this is YOPO in practice.


Smart Router

55+ models. One decision. Zero guesswork.

You don't pick models. Franklin picks for you.

The Smart Router classifies every request — coding, trading, reasoning, research — and selects the model with the best quality-to-cost ratio. Trained on 2M+ real requests from the BlockRun gateway, continuously updated.

> refactor this auth module to use JWT

  CODING kimi-k2.5  ·  12.4K in / 2.1K out  ·  $0.0023  saved 84%

> what's the BTC outlook for the week?

  TRADING grok-4-1-fast-reasoning  ·  8.2K in / 1.8K out  ·  $0.0008  saved 95%

> prove that this algorithm is O(n log n)

  REASONING claude-sonnet-4.6  ·  15.1K in / 3.4K out  ·  $0.0312

Every response shows which model was chosen, why, and how much you saved vs. always using the most expensive option.

Four profiles:

Profile Strategy Use case
auto Best quality-to-cost ratio Default — smart spend
eco Cheapest model with decent quality Budget-conscious
premium Highest quality regardless of cost Mission-critical
free Free NVIDIA models only Zero wallet balance

Per-session breakdown — run /cost to see exactly where your USDC went:

Session Cost: $0.0847 (23 requests)
  gemini-2.5-flash       $0.0012   14 req   CODING
  kimi-k2.5              $0.0423    6 req   CODING
  claude-sonnet-4.6      $0.0412    3 req   REASONING

The router also learns from your usage. If you keep retrying a model for coding tasks, Franklin adapts and picks a better one next time. Your router gets smarter the more you use it.


Why Franklin

### 💳  AI is utility, not SaaS You don't subscribe to electricity, you pay for what you use. Franklin brings the same model to AI. YOPO settlement means Franklin never bills you for access, only for outcomes. No monthly fees, no rate limits, no overdraft. ### 🧠  Multi-model is the future No single model is best at everything. Sonnet writes better code, Gemini handles longer context, DeepSeek costs 20x less for simple tasks. The Smart Router routes every request to the optimal model in <1ms — up to 89% savings vs. always using Opus. ### 🔐  Wallet is identity No email. No phone. No KYC. Your Base or Solana address is your account — portable, permissionless, global. API keys require US banking and account approval. A wallet requires only USDC.

The comparison

Coding agents Editor IDEs Chatbots Franklin
Writes code ⚠️
Spends money for you USDC wallet, x402
Buys data + APIs + images + search 55+ APIs, one wallet
Picks best model per task ❌ single-vendor ❌ plan-tied

Extension points exported contracts — how you extend this code

ExchangeClient (Interface)
(no doc) [4 implementers]
src/trading/mock-exchange.ts
CdpAxNode (Interface)
* Shape of a single node from CDP's `Accessibility.getFullAXTree`. We only * pull the fields `serializeAxTree` consumes
src/social/browser.ts
TranslatorState (Interface)
* SSE Event Translator: OpenAI → Anthropic Messages API format * * Handles three critical gaps in the streaming pipeli
src/proxy/sse-translator.ts
MidSessionState (Interface)
* Tracks state for mid-session extraction so it only runs when there's * enough new conversation to analyze.
src/learnings/extractor.ts
SlackTarget (Interface)
* Where a reply should be posted. `threadTs` is set for channel mentions (so * replies stay grouped in a thread) but le
src/channel/slack.ts
SecretPattern (Interface)
* Secret detection + redaction for user-submitted text. * * Why this exists: a user pasted a GitHub PAT (`ghp_...`) di
src/agent/secret-redact.ts
CacheShape (Interface)
(no doc)
src/version-check.ts
PaidPricing (Interface)
(no doc)
src/gateway-models.ts

Core symbols most depended-on inside this repo

push
called by 770
src/agent/think-tag-stripper.ts
on
called by 154
src/events/bus.ts
get
called by 154
src/content/library.ts
safe
called by 83
test/local.mjs
json
called by 67
src/panel/server.ts
execute
called by 63
src/agent/types.ts
onEvent
called by 61
src/serve/server.ts
add
called by 54
src/tools/modal.ts

Shape

Function 1,275
Interface 390
Method 180
Class 54

Languages

TypeScript100%

Modules by API surface

src/session/from-import.ts44 symbols
src/agent/llm.ts39 symbols
src/ui/app.tsx36 symbols
src/social/browser.ts34 symbols
src/agent/tool-guard.ts34 symbols
src/proxy/server.ts27 symbols
src/serve/server.ts25 symbols
test/local.mjs24 symbols
src/plugins/runner.ts23 symbols
src/mcp/client.ts23 symbols
src/agent/context.ts23 symbols
src/ui/terminal.ts22 symbols

For agents

$ claude mcp add Franklin \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact