Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@blockrun/runcode

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockrun/runcode

RunCode — AI coding agent powered by 41+ models. Pay per use with USDC.

Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
16
-95.08%
Maintainers
1
Weekly downloads
 
Created
Source


██████╗ ██╗ ██╗███╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗ ██╔══██╗██║ ██║████╗ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝ ██████╔╝██║ ██║██╔██╗ ██║██║ ██║ ██║██║ ██║█████╗ ██╔══██╗██║ ██║██║╚██╗██║██║ ██║ ██║██║ ██║██╔══╝ ██║ ██║╚██████╔╝██║ ╚████║╚██████╗╚██████╔╝██████╔╝███████╗ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝

RunCode

Open-source AI coding agent. 41+ models. Pay per use with USDC.


npm version License: Apache-2.0 TypeScript x402 Telegram

runcode is a terminal-based AI coding agent that connects to 41+ LLM models through BlockRun. It reads your code, edits files, runs commands, searches the web, and manages tasks — all from your terminal. You pay per request with USDC via the x402 protocol. No API keys, no accounts, no subscriptions.

Quick Start

npm install -g @blockrun/runcode
runcode setup base     # Create a wallet (one-time)
runcode                # Launch — picks model interactively

That's it. Fund the wallet address with USDC on Base, or use free models immediately.

Features

Agent Capabilities

runcode is a full coding agent with 10 built-in tools:

ToolDescription
ReadRead files with line numbers
WriteCreate or overwrite files
EditTargeted find-and-replace edits
BashRun shell commands with timeout
GlobFind files by pattern
GrepSearch file contents (uses ripgrep)
WebSearchSearch the web
WebFetchFetch and read web pages
AgentSpawn sub-agents for parallel tasks
TaskTrack tasks within a session

Model Selection

Launch with the interactive model picker, or specify directly:

runcode                          # Interactive picker
runcode -m sonnet                # Claude Sonnet 4.6
runcode -m gpt                   # GPT-5.4
runcode -m deepseek              # DeepSeek V3
runcode -m free                  # Nemotron Ultra 253B (free)

Switch models mid-session:

/model              # Interactive picker
/model flash        # Switch to Gemini 2.5 Flash
/cost               # Check session cost

30+ shortcuts:

ShortcutModelPrice (in/out per 1M)
sonnetClaude Sonnet 4.6$3 / $15
opusClaude Opus 4.6$5 / $25
gptGPT-5.4$2.5 / $15
geminiGemini 2.5 Pro$1.25 / $10
flashGemini 2.5 Flash$0.15 / $0.6
deepseekDeepSeek V3$0.28 / $0.42
r1DeepSeek R1$0.28 / $0.42
haikuClaude Haiku 4.5$0.8 / $4
miniGPT-5 Mini$0.25 / $2
nanoGPT-5 Nano$0.05 / $0.4
o3O3$2 / $8
o4O4 Mini$1.1 / $4.4
grokGrok 3varies
freeNemotron Ultra 253BFREE
devstralDevstral 2 123BFREE
qwen-coderQwen3 Coder 480BFREE
maverickLlama 4 MaverickFREE

Token Optimization

Seven layers of automatic optimization keep context usage low and costs down:

  • Thinking block stripping — removes old reasoning from history
  • Tool result budgeting — caps large outputs at 50K chars with preview
  • Microcompaction — clears old tool results (keeps last 8)
  • Time-based cleanup — clears stale results after 60min idle
  • Auto-compact — summarizes history when approaching context limit
  • Adaptive max_tokens — starts at 8K, escalates to 64K on demand
  • Prompt-too-long recovery — auto-compacts and retries up to 3x

Permission System

By default, read-only tools run automatically. Destructive tools (Write, Edit, Bash) prompt for permission:

  Permission required: Bash
  Execute: rm -rf node_modules

  Allow? [y]es / [n]o / [a]lways:

Use --trust to skip all prompts:

runcode --trust

Configure rules in ~/.blockrun/runcode-permissions.json:

{
  "allow": ["Bash(git *)"],
  "deny": ["Bash(rm -rf *)"]
}

Streaming Tool Execution

Concurrent-safe tools (Read, Glob, Grep) start executing while the model is still streaming. Sequential tools (Write, Edit, Bash) wait for the full response. This reduces latency on multi-tool turns.

Proxy Mode

runcode also includes a proxy mode for use with Claude Code or other tools:

runcode proxy                    # Start payment proxy on :8402
runcode proxy -m deepseek        # With default model
runcode init                     # Auto-configure Claude Code + LaunchAgent

Architecture

User input → runcode CLI
  → Terminal UI (markdown rendering, model picker, spinners)
  → Permission check (allow / deny / ask)
  → Agent loop
    → Token optimization pipeline
    → BlockRun API (direct, with x402 payment)
      → 41+ models (Claude, GPT, Gemini, DeepSeek, Grok, ...)
    → Streaming tool execution
    → Context compaction (when needed)
  → Loop until task complete
src/
├── agent/                  # Core agent system
│   ├── loop.ts             # Agent loop + interactive session
│   ├── llm.ts              # API client + x402 payment + SSE parsing
│   ├── types.ts            # Type definitions
│   ├── context.ts          # System prompt assembly
│   ├── tokens.ts           # Token estimation
│   ├── compact.ts          # Auto-compaction
│   ├── optimize.ts         # 5-layer token optimization
│   ├── permissions.ts      # Tool permission system
│   └── streaming-executor.ts # Parallel tool execution
├── tools/                  # 10 built-in tools
│   ├── read.ts, write.ts, edit.ts, bash.ts
│   ├── glob.ts, grep.ts
│   ├── webfetch.ts, websearch.ts
│   ├── subagent.ts, task.ts
│   └── index.ts
├── ui/                     # Terminal interface
│   ├── terminal.ts         # Streaming output + markdown
│   └── model-picker.ts     # Interactive model selection
├── proxy/                  # Proxy mode (for Claude Code)
│   ├── server.ts           # HTTP proxy + payment handling
│   ├── fallback.ts         # Auto-fallback chain
│   └── sse-translator.ts   # OpenAI → Anthropic format
├── router/                 # Smart routing engine
│   └── index.ts
├── commands/               # CLI commands
├── config.ts               # Global configuration
└── index.ts                # Entry point

Commands

CommandDescription
runcodeStart the agent (interactive model picker)
runcode -m <model>Start with a specific model
runcode --trustStart in trust mode (no permission prompts)
runcode --debugStart with debug logging
runcode setup [base|solana]Create payment wallet
runcode balanceCheck USDC balance
runcode modelsList all models with pricing
runcode statsView usage statistics and savings
runcode config listView configuration
runcode proxyRun as payment proxy for Claude Code

Session Commands

CommandDescription
/modelInteractive model picker
/model <name>Switch model (shortcut or full ID)
/modelsSame as /model
/costShow session cost and savings
/helpList all commands
/exitQuit

Payment

runcode uses the x402 protocol for pay-per-request payments with USDC stablecoins. No accounts, no API keys, no subscriptions.

Supported chains:

  • Base (default) — Coinbase L2, low fees
  • Solana — also low fees

Setup:

runcode setup base     # or: runcode setup solana

Fund the wallet address with USDC. Free models work without funding.

What does it cost?

Model~Cost per request
Free models (Nemotron, etc.)$0
DeepSeek V3~$0.001
Gemini Flash~$0.001
Claude Sonnet~$0.01
GPT-5.4~$0.01
Claude Opus~$0.05

Typical usage: $5-20/month for active development.

Development

git clone https://github.com/BlockRunAI/runcode.git
cd runcode
npm install
npm run build
node dist/index.js --help

Contributing

Contributions are welcome. Please open an issue first to discuss what you'd like to change.

License

Apache License 2.0

Keywords

runcode

FAQs

Package last updated on 02 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts