Codex by hand
Set Codex up on bInference and Binance yourself. Works for the Codex and ChatGPT desktop apps too.
The quick way
npx binference agent-os my-agent --app codex sets all of this up in one folder, with
trade limits, alerts and a cockpit. See Set up an agent. This page
sets Codex up by hand, without the cockpit's limits and brakes.
Install Codex
Skip this if codex already runs in your terminal.
curl -fsSL https://chatgpt.com/codex/install.sh | shGet a bInference key
On binference.io, press Create key and set a daily spending limit. Keep the key in your environment:
export BINF_API_KEY="binf_..."Point Codex at bInference
Codex speaks the Responses format. Add bInference as a provider:
model_provider = "binference"
model = "openai/gpt-6.1-sol"
web_search = "disabled"
[model_providers.binference]
name = "bInference"
base_url = "https://binference.io/api/v1"
env_key = "BINF_API_KEY"
wire_api = "responses"Any model on Models works as model. Codex's built-in image tool is not served here: bInference leaves it out of each request, and everything else works as usual. Codex also offers web search on every call, with no limit on how many searches one call may run, so bInference would have to set aside the cost of many rounds before the call starts (over $10 even on a small model). web_search = "disabled" keeps each call's reserve small; with plenty of credit you can leave it on.
Add the Binance MCP Server
Run Binance's command exactly as written, then authenticate when the browser opens:
codex mcp add binance-mcp-server --url https://agent.binance.com/mcp/agentic --oauth-client-id codexGrant the fewest scopes you need: market data, account, trade or transfer. There is no withdrawal scope. The Codex and ChatGPT desktop apps pick up the same connection.
Check it, then fund the sub-account
Ask Codex:
Use the Binance MCP Server to show the current BTCUSDT price and 24-hour change.Then move trading funds in on binance.com: Profile → Dashboard → Sub-account → Asset Management → Transfer. Only you can fund the Agentic sub-account, and it starts empty.
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.
- Retries are built in. Codex retries
503answers, so a busy model or a short wait on our side resolves on its own. - Every order waits for you. The agent restates each order, cancel or transfer and waits for your yes.
- Two limits keep it safe: Binance's scopes and sub-account on one side, the key's spending limit here on the other. See Safety and limits.