Black Friday: 10% off every GPU you launch, no code needed. Until 30 Nov. Rent a GPU

Arrakis / Blog / AI agents

Claude Code GPU: Let Claude Rent GPUs Inside a Spend Cap

Give Claude Code GPU access and it can rent a machine, run your job on it and shut it down, all from the terminal you already have open. Connect the Arrakis MCP server with a token that carries a spend cap, and the most Claude can spend is a number you set before the first prompt. Setup is one form in the console and one command.

Stop being the GPU middleman

Claude Code writes the training script, the eval harness and the benchmark. Then it stops and waits for you to find a GPU, copy files over and paste logs back. That handoff is where an afternoon goes, and where a rented GPU sits idle while you are in a meeting, billing by the hour.

Give Claude the market instead. Over MCP it searches live machines from several independent GPU markets, rents one with a removal time, connects over SSH with your key, copies results back and terminates the machine. Right now an RTX 4090 starts at the live price per GPU-hour and an H100 at the live price, paid from a prepaid balance one started hour at a time.

Step 1: a token Claude cannot overspend

In the console, open API & agents and create a token for an agent. Give it four limits:

Limit What it does
Scopes: read and rent Claude can search, rent and stop machines. It cannot create tokens, save keys or touch billing.
Spend cap The most this token can ever commit. Each rental counts at its worst case: price per hour times removal hours.
Longest rental Every rental must carry a removal time, and none can run longer than this.
Expiry The token stops working on the date you pick.

The token is shown once. Keep it out of prompts and out of any file you commit.

If you script your setup, a token with the manage scope can mint a capped one with POST /v1/tokens:

Shell
curl -X POST https://arrakis.goodailabs.com/v1/tokens \
  -H "Authorization: Bearer $ARRAKIS_MANAGE_TOKEN" -H "Content-Type: application/json" \
  -d '{"name": "claude-code", "scopes": ["read", "rent"], "spend_limit_usd": 25,
       "max_rental_hours": 4, "expires_at": "2026-12-31T00:00:00Z"}'

Step 2: connect Claude Code

One command. The server speaks MCP over streamable HTTP, so there is nothing to install:

Shell
claude mcp add --transport http arrakis https://arrakis.goodailabs.com/mcp \
  --header "Authorization: Bearer ark_..."

Run /mcp inside Claude Code to see it connected. Claude now has the tools it needs: search_gpus and get_market_summary for live prices; rent_gpu, get_instance, schedule_removal and terminate_instance for the machine; get_balance for the cap; get_events for what happened; instance_ssh_keys for who can log in; and plan_deploy with deploy_model for serving models.

Step 3: the first rental

Make the first prompt specific about money and about the ending:

Find the cheapest single GPU with at least 24 GB. Tell me its price and the worst case for 2 hours, and wait for my go. Then rent it with my key from ~/.ssh/id_ed25519.pub, run nvidia-smi and python bench.py over SSH, copy results/ back, and terminate it.

Here is what Claude does with that:

  1. search_gpus with min_vram_gb 24 and max_gpus 1. Rows come best first, ranked on what the GPU can do, its price and its host's record, and the answer names a pick and why.
  2. It quotes the price and the worst case, then waits for you.
  3. rent_gpu with the node_id, a name, termination_hours 2, your public key and max_price_per_gpu_hour set to the price it showed you. If the live price moved up, nothing is rented and the error gives the new price.
  4. get_instance every 30 to 60 seconds until the state is RUNNING. Booting is free: the first hour is charged when the machine starts running.
  5. It runs the job with the machine's SSH command from your shell and copies results back with scp or rsync.
  6. terminate_instance. Billing stops, and the machine's disk is deleted with it.

Retries are safe. The same idempotency_key returns the same machine, and over MCP a repeat of the same machine, name and hours within 10 minutes returns the first one instead of renting a second.

What Claude cannot do with this token

These rules live in the API, so they hold whatever the model decides:

  • Spend past the cap. A rental whose worst case would pass it is refused before anything is rented.
  • Rent without a removal time, or for longer than the longest rental.
  • Move a removal later. A capped token can only bring it earlier.
  • Create a token with more power than its own, or add funds.
  • See or touch another account's machines.

Do the money math before you hit enter

The worst case is the cap, so pick a cap you would approve without a meeting. Use real numbers: say an 8x B300 costs $50 an hour (the console shows today's price). With a $25 cap, Claude cannot rent one even for an hour. With a $100 cap, a 2-hour rental ($100) goes through and a 3-hour one ($150) is refused.

Two more things to know. Each started hour is charged in full, so a 61-minute job pays two hours: ask for a removal time of the job plus a margin, not a round day. And the cap counts commitments, not usage. Stopping a machine early saves money from your balance, but the cap still counts that rental's worst case.

Ask Claude how much of the cap is left and it calls get_balance, which reports the cap, what is committed, what remains, the longest rental and the expiry. Every tool result also carries the last day's alerts: a host's removal notice, a host that stopped answering, an eviction. Claude hears about trouble even when it was asking about something else. (Balance alerts come only to tokens with the billing scope, which this one deliberately lacks; the balance itself still stops machines it cannot pay for.)

The full rule set is in Agents and MCP, and the agents page has prompts that work. For a closer look at caps and worst cases, read AI agent spend limits for GPUs.

Want an endpoint, not a box?

If the job is "run this model so my code can call it", Claude should not rent a bare machine and install an engine over SSH. It should call plan_deploy, then deploy_model, and hand you an OpenAI-compatible URL with its own key and root SSH on the machine. That flow, prompt to endpoint, is in deploy a model from chat.

Give Claude the GPU, keep the wallet

A capped token and one command, and Claude Code runs its own GPU jobs while you do something else. Create an agent token in the console.

New here? Use code FIRST25 for $25 off your first deposit of $50 or more, until 31 December 2026.

Rent the GPUs in this post

New here? Use code FIRST25 for $25 off your first deposit of $50 or more, until 31 December 2026.

Lowest price now, per GPU-hour. Billed per started hour; stop any time.

Questions

Can Claude Code rent a GPU?
Yes. Connect the Arrakis MCP server with an API token and Claude Code can search live GPUs, rent one with a removal time, run a job over SSH and stop the machine. It cannot spend past the token's cap.
How do I add the Arrakis MCP server to Claude Code?
Create a token under API & agents in the console, then run claude mcp add with --transport http, the URL https://arrakis.goodailabs.com/mcp and an Authorization header carrying the token.
What is the most Claude Code can spend on GPUs?
The token's spend cap. Each rental counts at its worst case, price per hour times removal hours, and a rental that would pass the cap is refused before anything is rented.
Does Claude Code need its own Arrakis account?
No. It works under your account with a token you create, and you can revoke that token at any time.

More from the blog

Every postRSS feed