Claude Code by hand
Set Claude Code up on bInference and Binance yourself, for every session on this computer.
The quick way
npx binference agent-os my-agent sets all of this up in one folder, with trade
limits, alerts and a cockpit. See Set up an agent. This page sets
Claude Code up by hand, without the cockpit's limits and brakes.
Get a bInference key
On binference.io, sign in with your wallet and press Create key. Turn on Limit spending and set a daily limit: it caps what this agent can spend on AI, however long it runs.
Point Claude Code at bInference
Add these to ~/.claude/settings.json, so every Claude Code session uses them:
{
"env": {
"ANTHROPIC_BASE_URL": "https://binference.io/api",
"ANTHROPIC_AUTH_TOKEN": "binf_...",
"ANTHROPIC_API_KEY": ""
}
}ANTHROPIC_API_KEY stays empty so Claude Code never falls back to another key. To pick the model, add "ANTHROPIC_MODEL": "anthropic/claude-sonnet-5.5". Any model on Models that handles tools well works. Claude Code explains the settings that keep each call's hold small.
Add the Binance MCP Server
In Terminal (PowerShell on Windows), run Binance's command exactly as written:
claude mcp add binance-mcp-server --transport http https://agent.binance.com/mcp/agenticThen start Claude Code, open the /mcp menu, select binance-mcp-server and authenticate. Binance opens its own sign-in and asks which scopes to grant. Start with the fewest:
| Scope | Lets the agent |
|---|---|
| Market data | Read prices, order books, candles and funding. No sign-in needed |
| Account | Read the Agentic sub-account's balances and positions, and optionally view your main account |
| Trade | Trade Spot, Margin, Convert and Futures, as far as your account allows |
| Transfer | Move funds between wallets inside the Agentic sub-account only |
There is no withdrawal scope: the agent can never send funds out.
Never paste the address into a chat
Don't ask Claude to install the server for you, and don't open the address in a browser. Binance asks you to run the command above yourself.
Check both connections
Ask Claude Code:
Use the Binance MCP Server to show the current BTCUSDT price and 24-hour change.The answer should show the Binance tool being used and live BTCUSDT data. That one question used both sides: the model ran on bInference, the price came from Binance. The call shows up on your Calls page within a minute.
Fund the Agentic sub-account
Your agent trades in its own sub-account, created the first time you authorize. It starts empty, and only you can fund it:
- On binance.com, go to Profile → Dashboard → Sub-account → Asset Management.
- Press Transfer and move assets from your main account to the Agentic sub-account. It's instant and free.
Put in only what you're willing to let the agent trade.
Your first session
| You ask | What happens |
|---|---|
| "What's BTCUSDT trading at, and how's it moved over 24h?" | Reads live data at once. Nothing to confirm |
| "What do I have in my Agentic account?" | Reads the sub-account's balances across wallets |
| "Buy $100 of BNB at market on spot." | Restates the order and waits for your yes. This step spends real funds |
| "Did that fill? What's my BNB balance now?" | Checks the order and the new balance |
Every order, cancel and transfer asks for your confirmation first. Reads run straight away.
Add on-chain trading
To let the same Claude Code session swap tokens on BNB Chain, Ethereum, Base or Solana, add the Agentic Wallet skill. See Agentic Wallet.
Good to know
- Let the agent watch its own budget. Add the bInference MCP server with the same key, and it can check its credit before a long task. See MCP server.
- Long sessions cost more per turn. Claude Code sends the whole conversation, plus Binance's tool list, on every turn. Run
/compactwhen a session grows long. See What it costs. - Busy models: a busy model answers
529 overloaded_errorand Claude Code moves to its fallback model on its own. - Big pasted images can push a request past 4 MB (
413). Run/compactor/clear. - Two different "insufficient balance" errors. A trade that fails for funds means the Binance sub-account is empty. A
402 insufficient_balancefrom bInference means the AI budget is. See Troubleshooting.