pai
    Preparing search index...

    Phantom AI agent skill

    The phantom-ai skill teaches coding agents to use pai for inference, workspace funding, spending controls and model routing. It works with agents that support skills, including Claude Code, Codex and Cursor.

    From the project where you want the skill:

    npx skills add connortessaro/pai --skill phantom-ai
    

    Choose your agent when prompted. To target one agent directly:

    npx skills add connortessaro/pai --skill phantom-ai --agent codex
    

    This installs the instructions into your project. It does not install the pai CLI, connect a workspace or make a payment. Install the CLI with npm i -g @connortessaro/pai (Node 24+), then ask your agent:

    Use the phantom-ai skill to help me connect a workspace, check my balance,
    and connect my coding agent. Ask whether I want saved setup or a temporary run.
    Preview configuration changes before applying setup. Ask which budget and payment
    method I want before adding funds or starting paid inference.
    

    The same skill is available in Vercel Skills. Update installed skills with npx skills update.

    curl -fsSL https://raw.githubusercontent.com/connortessaro/pai/main/skills/phantom-ai/SKILL.md
    

    View the source. Pai's setup command also installs this skill; see permanent agent setup when you want configuration changes.

    The instructions below come directly from the shipped skill, so the docs and installed instructions stay together.

    Phantom AI

    Phantom AI serves model inference at https://phantom.codes/v1. Pai connects existing coding agents to that API, manages model routing to control costs, and handles workspace funding or explicit MPP wallet payments. Management commands print JSON; add --table for supported human-readable output.

    pai login
    pai workspace status
    pai codex
    pai claude --key coding
    pai pi

    Login uses browser device approval and saves a key privately; ask the user to complete approval themselves. For an existing key, have them run pai login --paste locally, never paste it into chat. Agent configuration is temporary. Pai flags go before agent arguments, or --.

    pai codex --key coding -- exec "review this repository"
    

    Named-key selection uses PHANTOM_KEY_NAME, then PHANTOM_API_KEY, then the saved login key. An agent's explicit --key selects that local named key.

    Offer saved setup when the user wants their installed agent to use Phantom AI without a pai launcher. Ask whether they want saved setup or a temporary run; when their request already specifies one, follow it.

    pai setup --dry-run --table
    pai setup
    pai setup --restore

    Preview and show the configuration changes before applying the setup the user approves. Plain setup detects supported agents and asks before writing. Restart the agent or open a new terminal afterward. It keeps backups for restore. To connect only Codex, preview the targeted setup first:

    pai setup --agent codex --provider --dry-run --table
    pai setup --agent codex --provider

    Targeted provider setup applies without its own confirmation; run it only after the user approves the preview. Cursor needs manual settings steps; pi receives the skill only. Setup wires up a saved key through helpers or environment variables where supported; Cline stores it in a private config file. If the user requested a budget, verify that the key the configured agent uses has that cap. Creating a separate capped key does not change the default key.

    pai workspace fund --amount 10 --card
    pai workspace fund --amount 10 --pay --x402
    pai workspace payment --id <payment-id>

    Card checkout needs the user. --pay needs an installed, configured pay.sh wallet; --x402 funds workspace credit with Solana USDC. --pay --mpp selects the other Solana funding protocol. These require the server's payment endpoint. Pai saves the purchase before paying. Check pending purchases instead of repaying.

    pai codex --mpp --limit 10
    

    Agent MPP payments use Tempo, separately from workspace funding. Wallet approval happens when needed. --limit defaults to 10 and limits session deposits; a new wallet access key uses that allowance for 7 days. Existing approvals may be reused. Do not describe it as a total run budget. --limit and --network require --mpp; --key cannot be combined with --mpp.

    pai keys create --save coding --limit 5
    pai keys list
    pai keys set --id <key-id> --budget 20 --period 30 --rate 1
    pai keys revoke --id <key-id>
    pai keys saved
    pai keys rm <name>
    pai balance

    Use the full ID from workspace key metadata. Key controls are enforced by the server; the rate is dollars per minute. Revocation preserves shared funds. keys saved lists local metadata; keys rm only forgets the local copy.

    pai route
    pai route set --models <model-a>,<model-b>
    pai route rule add --if has_tools=true --use first
    pai route test --table

    Routing affects auto requests. Use PHANTOM_KEY_NAME=coding to manage the same key used by an agent with --key coding. Route tests are free.

    Use pai --help --all for receipts, MCP and direct-key purchases. Export guest recovery with pai workspace export --file <path> only to a private destination. Recovery grants workspace management access.

    • Never print, log or repeat API keys, wallet secrets, management credentials or recovery files. pai keys show is for shell integration, not model context.
    • Use CLI commands to manage state; do not manually edit or delete its files.
    • Ask before payments the user has not requested. Existing task approval covers only the requested payment and amount.
    • Run permanent pai setup changes only when requested; otherwise preview with --dry-run.
    • Use a user's existing subscription agent when they request that workflow. Phantom inference and MPP payments require their intent.
    • Exit code 2 means a rejected key; report it rather than retrying unchanged credentials.