Shader
Install the skill

DocsGuides23 of 35 · 4 min read

Install the skill

Give a coding agent the shader skill, so it rents, generates and reports its costs through the CLI or MCP, within its key's caps or from a wallet over x402.

The shader skill is one SKILL.md file that a coding agent reads when its task needs a GPU or a generated file. You need the CLI where the agent runs, and either an agent key and its token or a Solana wallet holding USDC for x402.

#Set it up

  1. Download it

    Download SKILL.md into a shader folder in your agent's skills directory; for Claude Code that is .claude/skills/shader/SKILL.md in the project or in your home folder.

  2. Give it the token

    Put the token in the agent's environment as SHADER_TOKEN, or run shader login once where it runs. The skill tells the agent never to print or commit it.

  3. Ask for the work

    Ask for something that needs a GPU or a file. The agent reads the skill and works as below.

#What happened

  1. Check the budget

    Before spending, the agent reads shader balance, shader agents, shader whoami and shader config. It works out what is left of the key's day: the per-day cap, less what the key spent today, less rentals still running and generations not yet settled. A rental counts against its rate for 1 hour even when the agent means to stop sooner.

  2. Pick and rent

    It picks the smallest GPU whose memory fits the work, rents it with shader rent <gpu-id> --ssh-key <path> --wait, records the instance id, and connects with shader ssh.

  3. Stop

    It stops every machine it started with shader stop, also when its own work fails, and checks that the instance reaches stopped. After a crash it lists its machines with shader instances and stops the ones it no longer needs. It does not stop machines started under other keys.

  4. Generate

    It estimates first with shader estimate, using the same options it will generate with, compares the estimate with the credits and both caps, then runs shader generate --out <file>.

  5. Report

    It reports the credits actually settled and the transaction signature from shader receipts, not the estimate or the running meter.

#Renting over x402

With a wallet and no token, the skill has the agent rent through shader rent <gpu> --x402 --max-seconds <n> --wallet <path> --max-usd <usd>, with these rules:

  1. Read the quote first

    It reads the locked rate and ceiling the CLI prints, and never pays a ceiling above what you allowed. The CLI refuses before signing when the ceiling is above --max-usd.

  2. Keep secrets out

    It keeps the wallet file and the stop token out of logs, commits and chat. The CLI keeps the stop token itself.

  3. Extend within the limit

    It extends with shader extend only while what is left of your limit covers the new ceiling.

  4. Stop and report

    It runs shader stop as soon as the work ends, and reports each channel's charge, refund and receipt signature from the answer.

An x402-capable MCP client follows the same rules with rent_gpu, extend_gpu, get_instance and stop_gpu, passing the stop token. On the localnet, a fresh coding agent with only the skill, the CLI and a wallet holding 1 USDC was asked to keep under $0.25: it chose 200 seconds on an H100 SXM, got a ceiling of 112,800 atoms, SSHed in, stopped after 11 seconds, and reported 6,204 atoms charged and 106,596 refunded, matching the distribute transaction on chain.

#The receipt

The agent reports from shader receipts, and every charge it made names its key, so Receipts filtered by the key shows the same.

#If it fails

On AGENT_CAP_EXCEEDED or AGENT_DAILY_CAP_EXCEEDED it reduces the work or stops and asks the wallet owner for a higher cap. On CREDITS_TOO_LOW it asks the owner to add credits. On a revoked or invalid token it stops using it. On UNAUTHORIZED for adding credits, changing keys or staking, it knows those need the wallet's own signature. Errors lists every code.