--- name: bankr description: AI-powered crypto trading agent and LLM gateway via natural language. Use when the user wants to trade crypto, check portfolio balances, view token prices, transfer crypto, manage NFTs, use leverage, bet on Polymarket, deploy tokens, set up automated trading, sign and submit raw transactions, or access LLM models through the Bankr LLM gateway funded by your Bankr wallet. Supports Base, Ethereum, Polygon, Solana, and Unichain. metadata: { "clawdbot": { "emoji": "📺", "homepage": "https://bankr.bot", "requires": { "bins": ["bankr"] }, }, } --- # Bankr Execute crypto trading and DeFi operations using natural language. Two integration options: 1. **Bankr CLI** (recommended) — Install `@bankr/cli` for a batteries-included terminal experience 2. **REST API** — Call `https://api.bankr.bot` directly from any language or tool Both use the same API key and the same async job workflow under the hood. ## Getting an API Key Before using either option, you need a Bankr API key: 1. Visit [bankr.bot/api](https://bankr.bot/api) 2. **Sign up / Sign in** — Enter your email and the one-time passcode (OTP) sent to it 3. **Generate an API key** — Create a key with **Agent API** access enabled (the key starts with `bk_...`) Creating a new account automatically provisions **EVM wallets** (Base, Ethereum, Polygon, Unichain) and a **Solana wallet** — no manual wallet setup needed. ## Option 1: Bankr CLI (Recommended) ### Install ```bash bun install -g @bankr/cli ``` Or with npm: ```bash npm install -g @bankr/cli ``` ### First-Time Setup ```bash # Authenticate with Bankr (interactive — opens browser or paste key) bankr login # Verify your identity bankr whoami ``` The `bankr login` command gives you two choices: **A) Open the Bankr dashboard** — The CLI opens [bankr.bot/api](https://bankr.bot/api) where you generate a key and paste it back. **B) Paste an existing API key** — Select "Paste an existing Bankr API key" and enter it directly. #### Separate LLM Gateway Key (Optional) If your LLM gateway key differs from your API key, pass `--llm-key` during login or run `bankr config set llmKey YOUR_LLM_KEY` afterward. When not set, the API key is used for both. See [references/llm-gateway.md](references/llm-gateway.md) for full details. #### Non-Interactive Login (for AI agents) If you cannot interact with terminal prompts, use these flags: **If the user needs to create an API key:** 1. Run `bankr login --url` — prints the dashboard URL 2. Present the URL to the user, ask them to generate a `bk_...` key 3. Run `bankr login --api-key bk_THE_KEY` **If the user already has an API key:** ```bash bankr login --api-key bk_YOUR_KEY_HERE ``` #### Verify Setup ```bash bankr whoami bankr prompt "What is my balance?" ``` ## Option 2: REST API (Direct) No CLI installation required — call the API directly with `curl`, `fetch`, or any HTTP client. ### Authentication All requests require an `X-API-Key` header: ```bash curl -X POST "https://api.bankr.bot/agent/prompt" \ -H "X-API-Key: bk_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "What is my ETH balance?"}' ``` ### Quick Example: Submit → Poll → Complete ```bash # 1. Submit a prompt — returns a job ID JOB=$(curl -s -X POST "https://api.bankr.bot/agent/prompt" \ -H "X-API-Key: $BANKR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "What is my ETH balance?"}') JOB_ID=$(echo "$JOB" | jq -r '.jobId') # 2. Poll until terminal status while true; do RESULT=$(curl -s "https://api.bankr.bot/agent/job/$JOB_ID" \ -H "X-API-Key: $BANKR_API_KEY") STATUS=$(echo "$RESULT" | jq -r '.status') [ "$STATUS" = "completed" ] || [ "$STATUS" = "failed" ] || [ "$STATUS" = "cancelled" ] && break sleep 2 done # 3. Read the response echo "$RESULT" | jq -r '.response' ``` ### Conversation Threads Every prompt response includes a `threadId`. Pass it back to continue the conversation: ```bash # Start — the response includes a threadId curl -X POST "https://api.bankr.bot/agent/prompt" \ -H "X-API-Key: $BANKR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "What is the price of ETH?"}' # → {"jobId": "job_abc", "threadId": "thr_XYZ", ...} # Continue — pass threadId to maintain context curl -X POST "https://api.bankr.bot/agent/prompt" \ -H "X-API-Key: $BANKR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "And what about SOL?", "threadId": "thr_XYZ"}' ``` Omit `threadId` to start a new conversation. CLI equivalent: `bankr prompt --continue` (reuses last thread) or `bankr prompt --thread `. ### API Endpoints Summary | Endpoint | Method | Description | |----------|--------|-------------| | `/agent/prompt` | POST | Submit a prompt (async, returns job ID) | | `/agent/job/{jobId}` | GET | Check job status and results | | `/agent/job/{jobId}/cancel` | POST | Cancel a running job | | `/agent/sign` | POST | Sign messages/transactions (sync) | | `/agent/submit` | POST | Submit raw transactions (sync) | For full API details (request/response schemas, job states, rich data, polling strategy), see: **Reference**: [references/api-workflow.md](references/api-workflow.md) | [references/sign-submit-api.md](references/sign-submit-api.md) ## CLI Command Reference ### Core Commands | Command | Description | |---------|-------------| | `bankr login` | Authenticate with the Bankr API (interactive) | | `bankr login --url` | Print dashboard URL for API key generation | | `bankr login --api-key ` | Login with an API key directly (non-interactive) | | `bankr login --api-key --llm-key ` | Login with separate LLM gateway key | | `bankr logout` | Clear stored credentials | | `bankr whoami` | Show current authentication info | | `bankr prompt ` | Send a prompt to the Bankr AI agent | | `bankr prompt --continue ` | Continue the most recent conversation thread | | `bankr prompt --thread ` | Continue a specific conversation thread | | `bankr status ` | Check the status of a running job | | `bankr cancel ` | Cancel a running job | | `bankr skills` | Show all Bankr AI agent skills with examples | ### Configuration Commands | Command | Description | |---------|-------------| | `bankr config get [key]` | Get config value(s) | | `bankr config set ` | Set a config value | | `bankr --config ` | Use a custom config file path | Valid config keys: `apiKey`, `apiUrl`, `llmKey`, `llmUrl` Default config location: `~/.bankr/config.json`. Override with `--config` or `BANKR_CONFIG` env var. ### Environment Variables | Variable | Description | |----------|-------------| | `BANKR_API_KEY` | API key (overrides stored key) | | `BANKR_API_URL` | API URL (default: `https://api.bankr.bot`) | | `BANKR_LLM_KEY` | LLM gateway key (falls back to `BANKR_API_KEY` if not set) | | `BANKR_LLM_URL` | LLM gateway URL (default: `https://llm.bankr.bot`) | Environment variables override config file values. Config file values override defaults. ### LLM Gateway Commands | Command | Description | |---------|-------------| | `bankr llm models` | List available LLM models | | `bankr llm setup openclaw [--install]` | Generate or install OpenClaw config | | `bankr llm setup opencode [--install]` | Generate or install OpenCode config | | `bankr llm setup claude` | Show Claude Code environment setup | | `bankr llm setup cursor` | Show Cursor IDE setup instructions | | `bankr llm claude [args...]` | Launch Claude Code via the Bankr LLM Gateway | ## Core Usage ### Simple Query For straightforward requests that complete quickly: ```bash bankr prompt "What is my ETH balance?" bankr prompt "What's the price of Bitcoin?" ``` The CLI handles the full submit-poll-complete workflow automatically. You can also use the shorthand — any unrecognized command is treated as a prompt: ```bash bankr What is the price of ETH? ``` ### Interactive Prompt For prompts containing `$` or special characters that the shell would expand: ```bash # Interactive mode — no shell expansion issues bankr prompt # Then type: Buy $50 of ETH on Base # Or pipe input echo 'Buy $50 of ETH on Base' | bankr prompt ``` ### Conversation Threads Continue a multi-turn conversation with the agent: ```bash # First prompt — starts a new thread automatically bankr prompt "What is the price of ETH?" # → Thread: thr_ABC123 # Continue the conversation (agent remembers the ETH context) bankr prompt --continue "And what about BTC?" bankr prompt -c "Compare them" # Resume any thread by ID bankr prompt --thread thr_ABC123 "Show me ETH chart" ``` Thread IDs are automatically saved to config after each prompt. The `--continue` / `-c` flag reuses the last thread. ### Manual Job Control For advanced use or long-running operations: ```bash # Submit and get job ID bankr prompt "Buy $100 of ETH" # → Job submitted: job_abc123 # Check status of a specific job bankr status job_abc123 # Cancel if needed bankr cancel job_abc123 ``` ## LLM Gateway The [Bankr LLM Gateway](https://docs.bankr.bot/llm-gateway/overview) is a unified API for Claude, Gemini, GPT, and other models — multi-provider access, cost tracking, automatic failover, and SDK compatibility through a single endpoint. **Base URL:** `https://llm.bankr.bot` Uses your `llmKey` if configured, otherwise falls back to your API key. ### Quick Commands ```bash bankr llm models # List available models bankr llm credits # Check credit balance bankr llm setup openclaw --install # Install Bankr provider into OpenClaw bankr llm setup opencode --install # Install Bankr provider into OpenCode bankr llm setup claude # Print Claude Code env vars bankr llm setup cursor # Cursor setup instructions bankr llm claude # Launch Claude Code through gateway bankr llm claude --model claude-opus-4.6 # Launch with specific model ``` ### Direct SDK Usage The gateway works with standard OpenAI and Anthropic SDKs — just override the base URL: ```bash # OpenAI-compatible curl -X POST "https://llm.bankr.bot/v1/chat/completions" \ -H "Authorization: Bearer $BANKR_LLM_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "claude-sonnet-4.5", "messages": [{"role": "user", "content": "Hello"}]}' ``` For full model list, provider config JSON shape, SDK examples (Python, TypeScript), all setup commands, and troubleshooting, see: **Reference**: [references/llm-gateway.md](references/llm-gateway.md) ## Capabilities Overview ### Trading Operations - **Token Swaps**: Buy/sell/swap tokens across chains - **Cross-Chain**: Bridge tokens between chains - **Limit Orders**: Execute at target prices - **Stop Loss**: Automatic sell protection - **DCA**: Dollar-cost averaging strategies - **TWAP**: Time-weighted average pricing **Reference**: [references/token-trading.md](references/token-trading.md) ### Portfolio Management - Check balances across all chains - View USD valuations - Track holdings by token or chain - Real-time price updates - Multi-chain aggregation **Reference**: [references/portfolio.md](references/portfolio.md) ### Market Research - Token prices and market data - Technical analysis (RSI, MACD, etc.) - Social sentiment analysis - Price charts - Trending tokens - Token comparisons **Reference**: [references/market-research.md](references/market-research.md) ### Transfers - Send to addresses, ENS, or social handles - Multi-chain support - Flexible amount formats - Social handle resolution (Twitter, Farcaster, Telegram) **Reference**: [references/transfers.md](references/transfers.md) ### NFT Operations - Browse and search collections - View floor prices and listings - Purchase NFTs via OpenSea - View your NFT portfolio - Transfer NFTs - Mint from supported platforms **Reference**: [references/nft-operations.md](references/nft-operations.md) ### Polymarket Betting - Search prediction markets - Check odds - Place bets on outcomes - View positions - Redeem winnings **Reference**: [references/polymarket.md](references/polymarket.md) ### Leverage Trading - Long/short positions (up to 50x crypto, 100x forex/commodities) - Crypto, forex, and commodities - Stop loss and take profit - Position management via Avantis on Base **Reference**: [references/leverage-trading.md](references/leverage-trading.md) ### Token Deployment - **EVM (Base)**: Deploy ERC20 tokens via Clanker with customizable metadata and social links - **Solana**: Launch SPL tokens via Raydium LaunchLab with bonding curve and auto-migration to CPMM - Creator fee claiming on both chains - Fee Key NFTs for Solana (50% LP trading fees post-migration) - Optional fee recipient designation with 99.9%/0.1% split (Solana) - Both creator AND fee recipient can claim bonding curve fees (gas sponsored) - Optional vesting parameters (Solana) - Rate limits: 1/day standard, 10/day Bankr Club (gas sponsored within limits) **Reference**: [references/token-deployment.md](references/token-deployment.md) ### Automation - Limit orders - Stop loss orders - DCA (dollar-cost averaging) - TWAP (time-weighted average price) - Scheduled commands **Reference**: [references/automation.md](references/automation.md) ### Arbitrary Transactions - Submit raw EVM transactions with explicit calldata - Custom contract calls to any address - Execute pre-built calldata from other tools - Value transfers with data **Reference**: [references/arbitrary-transaction.md](references/arbitrary-transaction.md) ## Supported Chains | Chain | Native Token | Best For | Gas Cost | | -------- | ------------ | ----------------------------- | -------- | | Base | ETH | Memecoins, general trading | Very Low | | Polygon | MATIC | Gaming, NFTs, frequent trades | Very Low | | Ethereum | ETH | Blue chips, high liquidity | High | | Solana | SOL | High-speed trading | Minimal | | Unichain | ETH | Newer L2 option | Very Low | ## Common Patterns ### Check Before Trading ```bash # Check balance bankr prompt "What is my ETH balance on Base?" # Check price bankr prompt "What's the current price of PEPE?" # Then trade bankr prompt "Buy $20 of PEPE on Base" ``` ### Portfolio Review ```bash # Full portfolio bankr prompt "Show my complete portfolio" # Chain-specific bankr prompt "What tokens do I have on Base?" # Token-specific bankr prompt "Show my ETH across all chains" ``` ### Set Up Automation ```bash # DCA strategy bankr prompt "DCA $100 into ETH every week" # Stop loss protection bankr prompt "Set stop loss for my ETH at $2,500" # Limit order bankr prompt "Buy ETH if price drops to $3,000" ``` ### Market Research ```bash # Price and analysis bankr prompt "Do technical analysis on ETH" # Trending tokens bankr prompt "What tokens are trending on Base?" # Compare tokens bankr prompt "Compare ETH vs SOL" ``` ## API Workflow Bankr uses an asynchronous job-based API: 1. **Submit** — Send prompt (with optional `threadId`), get job ID and thread ID 2. **Poll** — Check status every 2 seconds 3. **Complete** — Process results when done 4. **Continue** — Reuse `threadId` for multi-turn conversations The `bankr prompt` command handles this automatically. When using the REST API directly, implement the poll loop yourself (see Option 2 above or the reference below). For manual job control via CLI, use `bankr status ` and `bankr cancel `. For details on the API structure, job states, polling strategy, and error handling, see: **Reference**: [references/api-workflow.md](references/api-workflow.md) ### Synchronous Endpoints For direct signing and transaction submission, Bankr also provides synchronous endpoints: - **POST /agent/sign** - Sign messages, typed data, or transactions without broadcasting - **POST /agent/submit** - Submit raw transactions directly to the blockchain These endpoints return immediately (no polling required) and are ideal for: - Authentication flows (sign messages) - Gasless approvals (sign EIP-712 permits) - Pre-built transactions (submit raw calldata) **Reference**: [references/sign-submit-api.md](references/sign-submit-api.md) ## Error Handling Common issues and fixes: - **Authentication errors** → Run `bankr login` or check `bankr whoami` (CLI), or verify your `X-API-Key` header (REST API) - **Insufficient balance** → Add funds or reduce amount - **Token not found** → Verify symbol and chain - **Transaction reverted** → Check parameters and balances - **Rate limiting** → Wait and retry For comprehensive error troubleshooting, setup instructions, and debugging steps, see: **Reference**: [references/error-handling.md](references/error-handling.md) ## Best Practices ### Security 1. Never share your API key 2. Start with small test amounts 3. Verify addresses before large transfers 4. Use stop losses for leverage trading 5. Double-check transaction details ### Trading 1. Check balance before trades 2. Specify chain for lesser-known tokens 3. Consider gas costs (use Base/Polygon for small amounts) 4. Start small, scale up after testing 5. Use limit orders for better prices ### Automation 1. Test automation with small amounts first 2. Review active orders regularly 3. Set realistic price targets 4. Always use stop loss for leverage 5. Monitor execution and adjust as needed ## Tips for Success ### For New Users - Start with balance checks and price queries - Test with $5-10 trades first - Use Base for lower fees - Enable trading confirmations initially - Learn one feature at a time ### For Experienced Users - Leverage automation for strategies - Use multiple chains for diversification - Combine DCA with stop losses - Explore advanced features (leverage, Polymarket) - Monitor gas costs across chains ## Prompt Examples by Category ### Trading - "Buy $50 of ETH on Base" - "Swap 0.1 ETH for USDC" - "Sell 50% of my PEPE" - "Bridge 100 USDC from Polygon to Base" ### Portfolio - "Show my portfolio" - "What's my ETH balance?" - "Total portfolio value" - "Holdings on Base" ### Market Research - "What's the price of Bitcoin?" - "Analyze ETH price" - "Trending tokens on Base" - "Compare UNI vs SUSHI" ### Transfers - "Send 0.1 ETH to vitalik.eth" - "Transfer $20 USDC to @friend" - "Send 50 USDC to 0x123..." ### NFTs - "Show Bored Ape floor price" - "Buy cheapest Pudgy Penguin" - "Show my NFTs" ### Polymarket - "What are the odds Trump wins?" - "Bet $10 on Yes for [market]" - "Show my Polymarket positions" ### Leverage - "Open 5x long on ETH with $100" - "Short BTC 10x with stop loss at $45k" - "Show my Avantis positions" ### Automation - "DCA $100 into ETH weekly" - "Set limit order to buy ETH at $3,000" - "Stop loss for all holdings at -20%" ### Token Deployment **Solana (LaunchLab):** - "Launch a token called MOON on Solana" - "Launch a token called FROG and give fees to @0xDeployer" - "Deploy SpaceRocket with symbol ROCK" - "Launch BRAIN and route fees to 7xKXtg..." - "How much fees can I claim for MOON?" - "Claim my fees for MOON" (works for creator or fee recipient) - "Show my Fee Key NFTs" - "Claim my fee NFT for ROCKET" (post-migration) - "Transfer fees for MOON to 7xKXtg..." **EVM (Clanker):** - "Deploy a token called BankrFan with symbol BFAN on Base" - "Claim fees for my token MTK" ### Arbitrary Transactions - "Submit this transaction: {to: 0x..., data: 0x..., value: 0, chainId: 8453}" - "Execute this calldata on Base: {...}" - "Send raw transaction with this JSON: {...}" ### Sign API (Synchronous) Direct message signing without AI processing: ```bash # Sign a plain text message curl -X POST "https://api.bankr.bot/agent/sign" \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d '{"signatureType": "personal_sign", "message": "Hello, Bankr!"}' # Sign EIP-712 typed data (permits, orders) curl -X POST "https://api.bankr.bot/agent/sign" \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d '{"signatureType": "eth_signTypedData_v4", "typedData": {...}}' # Sign a transaction without broadcasting curl -X POST "https://api.bankr.bot/agent/sign" \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d '{"signatureType": "eth_signTransaction", "transaction": {"to": "0x...", "chainId": 8453}}' ``` ### Submit API (Synchronous) Direct transaction submission without AI processing: ```bash # Submit a raw transaction curl -X POST "https://api.bankr.bot/agent/submit" \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "transaction": {"to": "0x...", "chainId": 8453, "value": "1000000000000000000"}, "waitForConfirmation": true }' ``` **Reference**: [references/sign-submit-api.md](references/sign-submit-api.md) ## Resources - **Documentation**: https://docs.bankr.bot - **LLM Gateway Docs**: https://docs.bankr.bot/llm-gateway/overview - **API Key Management**: https://bankr.bot/api - **Terminal**: https://bankr.bot/terminal - **CLI Package**: https://www.npmjs.com/package/@bankr/cli - **Twitter**: @bankr_bot ## Troubleshooting ### CLI Not Found ```bash # Verify installation which bankr # Reinstall if needed bun install -g @bankr/cli ``` ### Authentication Issues **CLI:** ```bash # Check current auth bankr whoami # Re-authenticate bankr login # Check LLM key specifically bankr config get llmKey ``` **REST API:** ```bash # Test your API key curl -s "https://api.bankr.bot/_health" -H "X-API-Key: $BANKR_API_KEY" ``` ### API Errors See [references/error-handling.md](references/error-handling.md) for comprehensive troubleshooting. ### Getting Help 1. Check error message in CLI output or API response 2. Run `bankr whoami` to verify auth (CLI) or test with a curl to `/_health` (REST API) 3. Consult relevant reference document 4. Test with simple queries first (`bankr prompt "What is my balance?"` or `POST /agent/prompt`) --- **Pro Tip**: The most common issue is not specifying the chain for tokens. When in doubt, always include "on Base" or "on Ethereum" in your prompt. **Security**: Keep your API key private. Never commit your config file to version control. Only trade amounts you can afford to lose. **Quick Win**: Start by checking your portfolio (`bankr prompt "Show my portfolio"`) to see what's possible, then try a small $5-10 trade on Base to get familiar with the flow.