Install the Legion skill
Download the Legion skill, verify it, and install it in Claude Code, Claude, Codex, Cursor, VS Code and other agents that read Agent Skills.
After this page, your agent has the Legion skill and knows how to rent and manage GPUs on Legion, and when to ask you first.
The skill is a folder named legion with a SKILL. file and a few reference files. It is plain Markdown. It has no scripts and nothing that runs by itself. An agent loads only the short description at first, and reads the rest when your request is about Legion.
Download it
The skill is one zip file. Its top-level folder is legion, which is what every client expects.
Download legion-skill.zip (opens in a new tab).
Read it first: SKILL.md (opens in a new tab). A skill tells your agent what to do, so read one before you install it.
From a terminal:
curl -sSLO https://legion.ambient.xyz/docs/agents/legion-skill.zip
curl -sSLO https://legion.ambient.xyz/docs/agents/legion-skill.zip.sha256
shasum -a 256 -c legion-skill.zip.sha256The last command should print legion-skill.. The SHA-256 of the current zip is:
064fb6bc090ea0a8069628de55bf1b919b8f7fbba08dee140e75d9a0866de051The file SKILL. is also served on its own at /docs/agents/skill/SKILL.md, for agents and tools that read one file.
Install the CLI, if your agent has a shell
Agents that run commands on your computer, such as Claude Code and OpenAI Codex, use the legion command line. It rents and stops GPUs like the MCP tools, and it also connects to a rental over SSH and copies files in and out. Install it in your own terminal:
curl -fsSL https://raw.githubusercontent.com/AmbientCrypto/legion-cli/main/scripts/install.sh | bashIt checks the release's SHA-256 and installs legion in ~/. Then log in:
legion auth loginYour browser opens Legion. Sign in and approve Legion CLI: the CLI saves an API key named after your computer, with Full access, for 90 days. Revoke it in Settings, API keys, or with legion auth logout. Run the login yourself, not through the agent: it needs a terminal, and the agent never sees the key. On a machine with no browser, use legion auth login --paste with a key you made in the app. In CI, pipe a key to legion auth login --with-token, or set LEGION_.
Claude on the web, Claude Desktop and the Claude mobile apps have no shell: there, connect the MCP server instead.
Set your API key, if you use curl
If you connect Claude with sign-in, there is no key for the MCP tools: connect Claude and the skill uses the tools. You need a key only for the skill's curl commands, and for any tool that calls the Legion API from a script. They read your key from the LEGION_ environment variable. Create a key for the agent in the app first: Settings, then API keys. Give it a name, and an expiry. See Safety.
In the terminal you start your agent from, read the key without showing it or saving it in your shell history:
read -rs LEGION_API_KEY && export LEGION_API_KEYPaste the key and press Enter. Then start your agent from that same terminal. Never type the key into the agent's chat. If an agent asks you for it, say no.
If you connect the MCP server with a key, your client reads the key from the same variable, and the agent never needs curl.
Claude Code
Claude Code reads skills from two places:
~/for you, in every project;. claude/ skills/ legion/ .for one project, which you can commit so the team shares it. The skill holds no key, so committing it is safe.claude/ skills/ legion/
For yourself:
mkdir -p ~/.claude/skills
unzip -o legion-skill.zip -d ~/.claude/skillsFor one project, from the project's folder:
mkdir -p .claude/skills
unzip -o legion-skill.zip -d .claude/skillsClaude Code watches these folders. If it was already running and the skills folder is new, restart it. Then ask a question about Legion, and Claude uses the skill when the question matches its description.
Claude on the web, and Claude Desktop
Make sure code execution is turned on in your Claude settings.
Open Customize, then Skills, press +, then Create skill, then Upload a skill.
Choose
legion-skill.. Do not unzip it first, and do not zip the files yourself: the zip must have thezip legionfolder as its root, as this one does.Turn the skill on.
Custom skills belong to your account. Each person on a team uploads their own.
Claude's code execution runs with network access that you or your administrator set, and it can be off. The skill's curl commands need it. If you cannot use the network there, connect the MCP server as a connector, which works without it.
The Claude API
Upload the skill with the Skills API, with the files named legion/ and legion/, then list the skill in the code execution container of your request. See Anthropic's Skills guide (opens in a new tab).
Code execution on the API has no network access, so the skill's curl commands cannot run there. Give your agent the MCP server as well, and it uses the tools instead.
OpenAI Codex, Cursor, VS Code, Gemini CLI and other agents
Agents that follow the open Agent Skills (opens in a new tab) format read a skill folder from a known place. The shared place is ., in the project or in your home folder:
mkdir -p ~/.agents/skills
unzip -o legion-skill.zip -d ~/.agents/skillsFor one project, use . in its folder instead. These agents read it:
| Agent | Personal folder | Project folder |
|---|---|---|
| OpenAI Codex | ~/ | . |
| Cursor | ~/, and it reads ~/ and ~/ | ., . |
| VS Code, GitHub Copilot | ~/, and it reads ~/ and ~/ | ., ., . |
| Gemini CLI | ~/, ~/ | ., . |
Other agents that read Agent Skills, such as OpenCode, use . or their own folder. Check your agent's documentation for the folder, and unzip into it the same way.
Check that it works
Start your agent from the terminal where you set LEGION_, and ask:
What can the Legion skill do? Then tell me how much credit my Legion account has.The agent should describe renting, spend and cleanup, and read your balance. If it does not mention Legion, check that the folder is legion/, not legion/, and restart the agent.
Update it
To update, remove the old folder and install the new zip over it, so no old file is left behind:
rm -rf ~/.claude/skills/legion
unzip -o legion-skill.zip -d ~/.claude/skillsUse the folder your agent reads. Check the new zip's SHA-256 as above.
Next steps
Connect the MCP server: the tools the skill prefers.
Safety: what the skill makes the agent ask, and what you should still check.