An OpenCode plugin that connects to Paytaca AI — an AI inference provider powered by Bitcoin Cash micropayments.
- OpenCode loads the plugin on startup
- The plugin checks for
paytaca-cliand ensures a wallet exists (auto-creates one if needed) - A local proxy server is started (or an existing one is reused) on
localhost:8001 - All LLM requests go through the proxy, which forwards them to the Paytaca backend
- When a 402 Payment Required response is received, the proxy intercepts it, shows a payment prompt via SSE, and handles approval/inline payment through the paytaca-cli x402 module
- Node.js >= 20.0.0
- OpenCode >= 1.0.0
# Global install (recommended)
opencode plugin @paytaca/opencode-plugin -g
# Or project-scoped
opencode plugin @paytaca/opencode-pluginThe paytaca-cli is bundled as a dependency and installed automatically.
Once installed and configured in your OpenCode settings, the plugin automatically:
- Creates a wallet on first run (recovery phrase is printed — save it securely)
- Starts a local proxy that manages x402 payment flows transparently
- Provides the
paytaca-aiprovider with thedeepseek/deepseek-v4-flashmodel - Registers a local MCP server (
paytaca) whose tools let the assistant work with real Paytaca data — AI account (credits, models, plan pricing) and wallet (balance, transactions, addresses, tokens, sending)
Because the MCP server is loaded automatically, you can ask in plain language:
- "How many credits do I have left?"
- "What models are available?"
- "How much does DeepSeek V4 Pro cost?"
- "What's my wallet balance?"
- "Show my latest transactions"
- "What's my receiving address?"
The assistant answers using live data via these tools:
| Tool | Description |
|---|---|
get_credits |
Remaining time credits per active model session |
get_balance |
BCH balance of the Paytaca wallet |
get_models |
Available models (id, display name, tier) |
get_plans |
Plan pricing grouped by tier (minutes, USD, BCH) |
buy_plan |
Buy time credits for any model + plan duration (spends BCH) |
get_transactions |
Recent wallet transactions (filter by direction, page) |
get_receiving_address |
Receiving address, optionally as a BIP21 URI with amount |
get_tokens |
CashToken holdings, or details for one token category |
You can ask the assistant to buy a plan for any model — even one not active in
the current session ("buy the 30-minute DeepSeek V4 Flash plan"). The assistant
shows pricing with get_plans, then purchases via buy_plan, which runs the
same x402 payment flow as the interactive proxy prompt. Because this spends
real funds, opencode always asks for approval before the tool runs (the plugin
sets the paytaca_buy_plan permission to ask).
You can ask the assistant to send BCH or CashTokens ("send 0.01 BCH to
bitcoincash:qp..."). Because that spends real funds, opencode will always
prompt you for approval before the send tool executes — the plugin sets the
paytaca_send permission to ask (an explicit choice in your own config is
respected). Token amounts are in base units and recipients should use
token-aware (z-prefix) addresses.
Payment prompts, tier-selection menus, credits output, and payment notices produced by the proxy stay visible in your session for you — but they are stripped from the context sent to the LLM, so coding conversations are not polluted by payment flow messages. Your replies in those flows (e.g. picking a plan tier) are also excluded, while all genuine coding messages pass through untouched.
The plugin keeps itself installable and up to date without manual cleanup:
- At startup it checks npm for a newer published version (5s timeout, fully offline-safe). If one exists, it clears everything that would keep opencode resolving the old one — semver-pinned dependency specs, stale lockfiles, and stale plugin cache entries — so the next session or install picks it up.
- Every install re-pins the dependency spec to the exact installed version
(avoids the
^0.xsemver trap that hides new releases) and removes other-version cache entries.
Set PAYTACA_SELF_UPDATE=0 to disable the startup check. Activity is logged
to ~/.opencode-paytaca/selfheal.log.
A wallet is created automatically, but you can manage it manually:
# Check wallet status
paytaca wallet info
# Import existing wallet
paytaca wallet import
# Get receiving address
paytaca receiveConfig is stored in ~/.opencode-paytaca/config.json:
| Field | Default | Description |
|---|---|---|
backendUrl |
https://api.paytaca.ai |
Paytaca API backend |
proxyPort |
8001 |
Local proxy port (auto-chooses 8001–8010) |
Override via PAYTACA_BACKEND_URL environment variable (highest priority).
┌──────────┐ LLM request ┌──────────────┐ forward ┌─────────────────┐
│ OpenCode │ ─────────────────→ │ Proxy │ ──────────────→ │ Paytaca API │
│ │ │ localhost │ │ api.paytaca.ai │
│ (editor) │ ←──────────────── │ :8001-8010 │ ←────────────── │ │
└──────────┘ response └──────┬───────┘ response └─────────────────┘
│
┌────────▼────────┐
│ 402 Payment │
│ intercepted │
└────────┬────────┘
│
┌────────▼────────┐
│ paytaca-cli │
│ (wallet/x402) │
└─────────────────┘
The proxy runs as a detached Node.js process. It stays running from the first OpenCode session until the machine shuts down (or the process is killed with kill <pid>), so it survives laptop sleep and subsequent OpenCode launches reuse it — no context loss, faster startup.
MIT