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
Download it
Download
SKILL.mdinto ashaderfolder in your agent's skills directory; for Claude Code that is.claude/skills/shader/SKILL.mdin the project or in your home folder.Give it the token
Put the token in the agent's environment as
SHADER_TOKEN, or runshader loginonce where it runs. The skill tells the agent never to print or commit it.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
Check the budget
Before spending, the agent reads
shader balance,shader agents,shader whoamiandshader 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.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 withshader ssh.Stop
It stops every machine it started with
shader stop, also when its own work fails, and checks that the instance reachesstopped. After a crash it lists its machines withshader instancesand stops the ones it no longer needs. It does not stop machines started under other keys.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 runsshader generate --out <file>.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:
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.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.
Extend within the limit
It extends with
shader extendonly while what is left of your limit covers the new ceiling.Stop and report
It runs
shader stopas 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.