pai
Provides sandboxed command execution using Docker containers, allowing agents to run commands in isolated, throwaway environments.
Allows reading and sending emails via Gmail's IMAP/SMTP, with support for managing drafts and searching messages.
Allows reading and sending emails via iCloud's IMAP/SMTP, with support for managing drafts and searching messages.
Provides sandboxed command execution using Podman containers, allowing agents to run commands in isolated, throwaway environments.
Enables agents to manage Solana wallets and pay for credit on the Phantom AI platform using USDC or SOL.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@paicreate a child key with $0.50 for 6 hours"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Your agents have expensive taste.
Connect your agents to Phantom AI. Route models, control spending and pay from your terminal.
pai by Phantom AI · Docs · npm
Use Phantom AI's router to send requests to cheaper models when your rules allow it, or choose a model yourself. Connect the coding agents you already use, fund their inference and pay per request—all from your terminal.
Install the agent skill
Teach your agent how to use pai:
npx skills add connortessaro/pai --skill phantom-aiChoose your agent when prompted. The skill covers workspace setup, funding, spending controls and model routing. Install the pai CLI separately using the quickstart below. Skill docs · Vercel Skills
Related MCP server: L402 Gateway
Let your agent set it up
Copy this into Claude Code, Codex, Cursor or another agent with terminal access:
Help me set up pai for AI inference through Phantom AI.
Read https://raw.githubusercontent.com/connortessaro/pai/main/skills/phantom-ai/SKILL.md first.
Check that I have Node 24 or newer, then install @connortessaro/pai if needed.
Check for an existing workspace and saved keys before changing anything.
If I need to connect, start pai login and let me complete the device approval.
Check the workspace balance. Ask which coding agent I use and what budget I want,
then create a named workspace key with that cap, or help me choose MPP payments.
Ask whether I want to connect my existing agent for future runs or use a temporary
connection for one run. For saved setup, preview the changes with pai setup --dry-run
and show them to me before applying the setup I approve. Make sure any spending cap
is on the key my agent will actually use. Ask before adding funds or starting paid
inference. Keep keys and recovery credentials out of chat. Finish with the command
to launch my agent, and explain how to undo any saved setup.For agents that can fetch instructions directly:
curl -fsSL https://raw.githubusercontent.com/connortessaro/pai/main/skills/phantom-ai/SKILL.mdThis reads the same instructions pai installs as its agent skill. It does not install software or make a payment.
Connect your existing agents
Keep using your coding agent, with Phantom AI handling its inference and model routing. Connect it using your saved key:
npm i -g @connortessaro/pai
pai login
pai setupPai detects supported agents, previews the configuration changes, then asks before applying them. It connects their model calls to Phantom AI and wires up the saved key. Restart your agent, or open a new terminal, to use the connection.
Codex, Claude Code, opencode, Continue, Goose, Aider, GitHub Copilot CLI and Cline support saved setup. Cursor gets instructions for its settings screen; pi gets the agent skill. Agent-specific setup.
Preview without changing files with pai setup --dry-run. Pai keeps backups;
undo the changes with pai setup --restore.
Connect for one run
npm i -g @connortessaro/pai
pai login
pai workspace fund --amount 10 --card
pai workspace status
pai codexBoth setup options require Node 24+ and your coding agent installed. Connect, fund your
workspace, then launch Codex (pai codex), Claude Code (pai claude),
pi (pai pi), or any other compatible agent.
Set up other agents.
Login opens a device approval page and saves a key privately. Funding opens checkout; check your workspace balance after payment. Agent runs use temporary configuration and print spending afterward. Your existing agent configuration stays in place.
Already have a Phantom key? Use pai login --paste to save it locally.
Pay for inference
Pay from your wallet
Use MPP to pay for inference from a Tempo wallet as your agent runs:
pai codex --mpp --limit 10Pai asks for wallet approval when needed. --limit 10 sets the maximum session
deposit; it does not cap the cost of the whole run. For a fixed spending cap,
use a workspace key below. How wallet limits work.
Fund a workspace
Add credit first, then let your agents spend from the shared balance. With a configured pay.sh wallet, add $10 of Solana USDC using x402:
pai workspace fund --amount 10 --pay --x402
pai workspace payment --id <payment-id>Credit is available after the payment is verified. If a payment is pending, check the payment ID pai printed before sending another payment. x402 funding must be enabled on the Phantom server.
You can also fund a workspace by card or Solana crypto. Workspace funding is separate from paying directly through Tempo MPP sessions. Funding and payment details.
Give each agent a budget
Create a key with its own cap, sharing your workspace balance:
pai keys create --save coding --limit 5
pai claude --key coding
pai keys list
pai keys set --id <key-id> --limit 10Workspace key controls include total limits, periodic budgets and spending
rates. Use the full key ID from pai keys list when changing or revoking a key.
Revoking a workspace key preserves workspace funds.
Choose what answers
Let the router choose a model for auto requests. Your policy can prefer cheaper
models and change the choice for tool use, reasoning or spending limits:
PHANTOM_KEY_NAME=coding pai route set --models <model-a>,<model-b>
PHANTOM_KEY_NAME=coding pai route test --tablePrefer a specific model? Select it in your agent. Policies that apply only to
auto leave explicit model choices alone.
Routing covers conditions, fallback and conversation affinity.
Commands
Task | Commands |
Connect |
|
Connect existing agents |
|
Run inference |
|
Fund and check spending |
|
Manage workspace keys |
|
Manage local copies |
|
Route models |
|
Put pai flags before agent arguments; use -- to separate them:
pai codex --key coding -- exec "explain this repository"Commands print JSON; --table renders supported results for people. Agent
commands inherit the terminal and print a spending summary on stderr.
Exit codes: 0 success, 1 error, 2 rejected key; agent runs return the agent's exit code.
pai --help shows the main workflows. pai --help --all and the
interface reference cover every command.
Signed receipts: check which model answered with
pai verify.MCP tools:
pai mcpfor clients that need a stdio server.Direct-key purchases: existing
pai buyandpai paymentworkflows remain supported.Saved secrets: macOS Keychain or private files; guest recovery uses
pai workspace exportandpai workspace import.Key selection and API address: environment overrides and shell integration.
The historical pai key commands and phantom-key executable still work.
pai keys list reads the workspace; pai keys saved lists local copies.
pai keys show prints a secret for shell integration; keep it out of chat and logs.
npm ci
npm run typecheck
npm run build
npm run coverage
npm run docs
node scripts/gen-docs.mjs --checkSee CONTRIBUTING.md and SECURITY.md.
The CLI is MIT licensed; Phantom AI is the hosted API it calls.
This server cannot be deployed
Maintenance
Related MCP Connectors
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Connect MCP clients to 2,000+ AI models without managing provider API keys.
Pay-per-call APIs and MCP services for agents, no accounts or keys, with verifiable receipts.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceMCP server for AgentPay — the payment gateway for autonomous AI agents. Fund a wallet once, give your agent the key, and it discovers, provisions, and pays for tool APIs on its own. One key, every tool.112 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to manage Bitcoin micropayments, service offers, and escrow contracts through MCP tools, without requiring a Lightning node.8 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to manage personal finances through MCP tools for transaction management, spending analytics, and goal tracking.1-

litellm-admin-mcpofficial
AlicenseNot gradedqualityAmaintenanceEnables agents to administer a LiteLLM gateway by creating and managing keys, model deployments, teams, budgets, and spending through MCP.MIT