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

Published 19 October 2026, updated 7 November 2026. 5 min read. For: Developers who use Claude Code and want it to run GPU jobs on its own.

## Key facts

- Claude Code can rent GPUs over the Arrakis MCP server: it searches live machines, rents one with a removal time, runs the job and terminates it.
- Create a token under API & agents in the console, then run claude mcp add --transport http with https://arrakis.goodailabs.com/mcp and an Authorization header carrying the token.
- The most Claude Code can spend is the token's spend cap, with each rental counted at its worst case: price per hour times removal hours.
- Say an 8x B300 costs $50 an hour: a $100 cap allows 2 hours ($100) and refuses 3 ($150).
- With a capped read-and-rent token, Claude cannot rent without a removal time, move a removal later, mint a stronger token or add funds.

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](/gpus/rtx-4090.html.md) starts at [the live price](/gpus/rtx-4090.html.md) per GPU-hour and an [H100](/gpus/h100.html.md) at [the live price](/gpus/h100.html.md), paid from a prepaid balance one started hour at a time.

## Step 1: a token Claude cannot overspend

In the console, open [API & agents](/console/#/api) 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`:

```sh
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:

```sh
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](/docs/agents.html.md), and the [agents page](/agents.html.md) has prompts that work. For a closer look at caps and worst cases, read [AI agent spend limits for GPUs](/blog/ai-agent-gpu-budget-spend-cap.html.md).

## 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](/blog/deploy-model-from-chat.html.md).

## 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](/console/#/api).

New here? Use code [FIRST25](/console/?code=FIRST25) for $25 off your first deposit of $50 or more, until 31 December 2026.

## Rent the GPUs in this post

- [RTX 4090](/gpus/rtx-4090.html.md): [the live price](/gpus/rtx-4090.html.md) per GPU-hour now; rent in the console (/console/#/gpus?gpu_type=RTX 4090) or with the MCP tool rent_gpu.
- [H100](/gpus/h100.html.md): [the live price](/gpus/h100.html.md) per GPU-hour now; rent in the console (/console/#/gpus?gpu_type=H100) or with the MCP tool rent_gpu.
- [B300](/gpus/b300.html.md): [the live price](/gpus/b300.html.md) per GPU-hour now; rent in the console (/console/#/gpus?gpu_type=B300) or with the MCP tool rent_gpu.

## 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

- [AI Agent Spend Limit for GPUs: Know the Worst Case](/blog/ai-agent-gpu-budget-spend-cap.html.md): Set an AI agent spend limit for GPU rentals: a token cap that counts each rental at its worst case, required removal times, and the most an agent can cost.
- [GPU Cloud Promo Code: $25 Off Your First $50 Deposit](/blog/first-deposit-25-off.html.md): Our GPU cloud promo code takes $25 off a first deposit of $50 or more until 31 December 2026. What $50 rents at live prices, and how to use it.
- [Deploy an LLM with an AI Agent: One Prompt, One Endpoint](/blog/deploy-model-from-chat.html.md): Deploy an LLM with an AI agent in one prompt: plan_deploy prices every GPU the model fits on, deploy_model returns an OpenAI-compatible endpoint and its key.

Every post: [/blog](/blog.html.md). RSS: [/blog/feed.xml](/blog/feed.xml).
