# Legion > Legion (Ambient GPU Rentals) is Ambient's marketplace for renting GPUs by the second. Pick a host, run any image, connect over SSH. Pay for the seconds it runs. Providers install one agent on a Linux machine with an NVIDIA GPU, set a price per GPU-hour and earn while renters use it. Legion is in closed beta: access is by invitation, and anyone can join the waitlist on the home page. ## Pages - [Legion home](https://legion.ambient.xyz/): What Legion is, for renters and for providers, and the closed beta's waitlist. - [Full context](https://legion.ambient.xyz/llms-full.txt): Every section of the home page as plain text. ## Legal - [Legion Terms of Use](https://legion.ambient.xyz/terms): The agreement between you and Ambient that governs renting and providing GPU capacity on Legion. - [Legion Acceptable Use Policy](https://legion.ambient.xyz/acceptable-use): What renters and providers may not do on Legion, including running proxies or VPN exits and reselling bandwidth, and what Ambient will do about illegal activity or misuse, including suspension, termination, preservation of evidence and disclosure to authorities. - [Legion Privacy Policy](https://legion.ambient.xyz/privacy): What personal information Legion collects from renters, providers and waitlist sign-ups, why, who it is shared with, how long it is kept, and your choices. - [Legion Data Handling](https://legion.ambient.xyz/data-handling): Where Legion rentals run, how they are isolated, what Legion logs, what providers can and cannot access, and what happens to your data when a rental stops or ends, and how backups work. ## Renting - Billed by the second - Any container image - SSH and a browser terminal - Interruptible spot for less ## Providing - One command - You set the price - Rentals isolated from your machine ## Docs - [Legion docs](https://legion.ambient.xyz/docs.md): Rent NVIDIA GPUs by the second, or earn from your own GPUs. Start here. - [Rent a GPU and SSH in](https://legion.ambient.xyz/docs/get-started/rent-a-gpu.md): Sign in, add credit, rent a GPU from the market and connect to it over SSH. - [Add your first host](https://legion.ambient.xyz/docs/get-started/add-a-host.md): Prepare a machine, run the install command, pass review and list your GPUs in the market. - [The market](https://legion.ambient.xyz/docs/renting/market.md): Read an offer, filter and sort the market, and understand what a price covers. - [The Legion score](https://legion.ambient.xyz/docs/renting/legion-score.md): How Legion scores hosts from 0 to 100, and which facts Legion checks itself. - [Images and the runtime](https://legion.ambient.xyz/docs/renting/images.md): Choose a starter image or bring your own, and see what Legion adds to every rental. - [SSH keys](https://legion.ambient.xyz/docs/renting/ssh-keys.md): Save public keys to your account and choose one for each rental. - [Connecting](https://legion.ambient.xyz/docs/renting/connecting.md): Connect over SSH through Legion's gateway, save an SSH config, copy files and use the web terminal. - [Configuration](https://legion.ambient.xyz/docs/renting/configuration.md): Set environment variables and secrets, tune a premade model's settings, and override the command of your own image, for rentals and services. - [Outbound network](https://legion.ambient.xyz/docs/renting/outbound-network.md): What your rental can reach, when it is held to the allow-list, what's always blocked, and how to ask for another site. - [Logs](https://legion.ambient.xyz/docs/renting/logs.md): Read what your rental or service writes and what Legion did with it, live or over the last 14 days, in the app or through the API. - [Rental lifecycle](https://legion.ambient.xyz/docs/renting/rental-lifecycle.md): Every rental state, what it costs, and how stop, start and delete work. - [Stopping, backups and how long your data is kept](https://legion.ambient.xyz/docs/renting/stopping-and-backups.md): What happens to your GPUs and files when you stop or delete a rental, how long Legion keeps the files, how backups work and what they cost, and why a rental's data was deleted. - [Interruptible rentals and preemption](https://legion.ambient.xyz/docs/renting/interruptible-rentals.md): Rent a GPU for less on the host's spot auction: the floor, your max, the auction price and who gets stopped. It stops when an on-demand renter needs it or someone bids more. The 5-minute notice, what happens to your data, auto-resume and waiting bids for at most 72 hours, and how to choose it in the app and the API. - [Credit and billing](https://legion.ambient.xyz/docs/renting/credit-and-billing.md): Prepaid credit, per-second GPU billing, storage, backups, adding credit, auto top-up, refunds of unused credit, and what happens at $0.00. - [Usage and spend](https://legion.ambient.xyz/docs/renting/usage-and-spend.md): See what your organization spends over a period, on which GPUs and rentals, your balance, runway and top-ups, in the app or through the API. - [Offer alerts](https://legion.ambient.xyz/docs/renting/offer-alerts.md): Ask Legion to email you once when a machine that matches your search becomes available, and manage your alerts in the app or through the API and MCP. - [Promo codes](https://legion.ambient.xyz/docs/renting/promo-codes.md): How to redeem a promo code, get a bonus on a top-up, and what promo credit is: used first, can expire, and is never refunded as cash. - [Prices and fees](https://legion.ambient.xyz/docs/renting/pricing.md): What every price on Legion includes, the 5% platform fee renters pay, what providers earn, how interruptible bids and your own hosts work, and which rentals keep their old rates. - [Services](https://legion.ambient.xyz/docs/renting/services/overview.md): A service is a public URL for something you run on Legion. Point it at a port on one of your rentals, or let Legion run your model on rented GPUs and scale it with traffic, down to zero when idle. What it is, the two modes, and when to use each. - [Expose a port](https://legion.ambient.xyz/docs/renting/services/expose-a-port.md): Give a web app in your rental its own Service URL on ambi.run, open to everyone or only to callers with a service key, and see what it costs and how to keep it working. - [Create a service](https://legion.ambient.xyz/docs/renting/services/create.md): Create an autoscaled service in five steps in the app, with the legion CLI, with the API or from an agent over MCP, and what you have after it is created. - [Call a service](https://legion.ambient.xyz/docs/renting/services/call.md): Send requests to a service with curl or the OpenAI Python and JavaScript SDKs, stream the answer, and handle the first request after idle with the X-Legion-Wait header. - [Scaling and cold starts](https://legion.ambient.xyz/docs/renting/services/scaling.md): Every scaling setting of an autoscaled service with its default, how Legion adds and removes replicas, scale to zero and cold starts, warm replicas, the hardware choice, waiting for GPUs and how changes roll out. - [Keys and security](https://legion.ambient.xyz/docs/renting/services/keys-and-security.md): How access to a service works: public or keys, keys shown once, expiry, rotation, revocation, who may do what, what a provider host can see, and own hosts compared with eligible hosts. - [Service metrics](https://legion.ambient.xyz/docs/renting/services/metrics.md): What the Metrics tab and the metrics API of a service show: requests, errors, latency, queue wait, tokens, then what each replica's engine and GPU report, which numbers Legion measures and which a host reports, and the windows. - [Service billing](https://legion.ambient.xyz/docs/renting/services/billing.md): What a service costs: GPU-hours on replicas billed by the second, the floor and ceiling shown before you create, the monthly spend cap and its alerts, what pausing costs, and the Usage tab. - [Service limits and status codes](https://legion.ambient.xyz/docs/renting/services/limits-and-errors.md): The limits that apply to services and every status and code a caller or a client of the service API can get, with what to do about it. - [Host requirements](https://legion.ambient.xyz/docs/providing/host-requirements.md): The checklist a machine must pass before you run the install command. - [Install the agent](https://legion.ambient.xyz/docs/providing/install-the-agent.md): Run the install command, give it the join token, and check that the agent is running. - [Review and approval](https://legion.ambient.xyz/docs/providing/review-and-approval.md): What happens after your machine connects, and what quarantine means. - [Listing and pricing](https://legion.ambient.xyz/docs/providing/listing-and-pricing.md): Set your price, show or hide a host in the market, set its country and rename it. - [Price recommendation](https://legion.ambient.xyz/docs/providing/price-recommendation.md): See the price Legion recommends for a host, how it's made from public data and what renters paid, and the history of your host's listing changes. - [Benchmarks and your score](https://legion.ambient.xyz/docs/providing/benchmarks-and-score.md): What Legion measures on your host, when it runs, how to ask for a re-run, and how to raise your score. - [Host network](https://legion.ambient.xyz/docs/providing/host-network.md): Block more address ranges for rentals on your host, require the allow-list for new rentals, and see what rentals did on your network. - [Earnings and payouts](https://legion.ambient.xyz/docs/providing/earnings-and-payouts.md): What your hosts earn, how they are performing, what needs attention, and when and how Ambient pays you. - [Agent updates](https://legion.ambient.xyz/docs/providing/agent-updates.md): How the Legion agent updates itself, and when it waits for renters. - [Scheduled maintenance](https://legion.ambient.xyz/docs/providing/maintenance.md): Announce maintenance on a host, how much notice keeps your uptime score whole, what renters see, and what happens to their rentals. - [Monitoring with Prometheus](https://legion.ambient.xyz/docs/providing/monitoring.md): Scrape your Legion agent's metrics with your own Prometheus, and use the example alert rules and Grafana dashboard. - [Removing or moving a host](https://legion.ambient.xyz/docs/providing/removing-a-host.md): Take a host out of the market, remove it, uninstall the agent, or move it to another organization. - [Using your own host](https://legion.ambient.xyz/docs/providing/use-your-own-host.md): Rent a host you provide, for your own work, and pay only Ambient's platform fee. - [Security for providers](https://legion.ambient.xyz/docs/providing/security.md): What the Legion agent runs on your machine, what rentals can reach, what Legion collects about the host, and the limits you should know before you list it. - [User-namespace isolation](https://legion.ambient.xyz/docs/providing/user-namespaces.md): Why every Legion host must run Docker with user namespaces, how the installer and the agent turn it on for you, what each state on the host page means, and the manual command. - [API overview](https://legion.ambient.xyz/docs/api/overview.md): The Legion API's base URL, conventions, and your first request. - [Authentication](https://legion.ambient.xyz/docs/api/authentication.md): Create an API key, send it as a bearer token, and know what a key can and can't do. - [Errors](https://legion.ambient.xyz/docs/errors.md): How the API reports errors, what each field means, and every error code. - [Pagination](https://legion.ambient.xyz/docs/api/pagination.md): Page through lists with cursor and limit. - [Idempotency](https://legion.ambient.xyz/docs/api/idempotency.md): Retry requests that create rentals or move money safely, with an Idempotency-Key. - [Rate limits](https://legion.ambient.xyz/docs/api/rate-limits.md): What a 429 means, how long to wait, and which operations have limits. - [Public market API](https://legion.ambient.xyz/docs/api/public-market.md): What GPUs can be rented on Legion now, and from what price, with no key. - [The legion command line](https://legion.ambient.xyz/docs/cli.md): Install the legion CLI, log in, and rent a GPU, SSH in and stop billing from your terminal. - [Scripting and automation](https://legion.ambient.xyz/docs/cli/scripting.md): Machine-readable output, confirmations without a terminal, exit codes, environment variables, precedence and profiles for the legion CLI. - [Command reference](https://legion.ambient.xyz/docs/cli/commands.md): Every legion command grouped by task, with a link to the full flags of each. - [Organizations and roles](https://legion.ambient.xyz/docs/account/organizations-and-roles.md): How organizations work, what owners and members can do, and how to invite people. - [Beta access and the waitlist](https://legion.ambient.xyz/docs/account/beta-access.md): How to get access to Legion while it's in closed beta. - [Legal](https://legion.ambient.xyz/docs/account/legal.md): Legion's Terms of Use, Acceptable Use Policy, Privacy Policy and Data Handling, and when you accept them. - [Support](https://legion.ambient.xyz/docs/account/support.md): How to reach a person at Ambient, and what to include. - [Security and trust](https://legion.ambient.xyz/docs/account/security.md): What a provider can and can't reach in your rental, who can connect to it, how your traffic, data and payments are handled, and how your account and API keys work. - [Changelog](https://legion.ambient.xyz/docs/changelog.md): Customer-visible changes to Legion and its API, newest first. ## Agents - [Use Legion with AI agents](https://legion.ambient.xyz/docs/agents.md): Let an AI agent find GPU offers, rent and manage GPUs, and check spend on Legion, with the Legion skill, the MCP server, or both. - [Install the Legion skill](https://legion.ambient.xyz/docs/agents/skill.md): Download the Legion skill, verify it, and install it in Claude Code, Claude, Codex, Cursor, VS Code and other agents that read Agent Skills. - [Connect the MCP server](https://legion.ambient.xyz/docs/agents/mcp.md): Connect Claude to Legion's MCP server by signing in, or add the server to Claude Code, Cursor, VS Code, Codex, Windsurf and other clients with an API key, and check that it works. - [Tools reference](https://legion.ambient.xyz/docs/agents/tools.md): Every tool the Legion MCP server offers, what it changes, which ones ask before they act, and how arguments, errors and limits work. - [Safety with AI agents](https://legion.ambient.xyz/docs/agents/safety.md): What an agent asks before it spends, exposes or deletes, how to connect it so a mistake stays small, and what to check. - [Examples](https://legion.ambient.xyz/docs/agents/examples.md): Five conversations with an agent that uses Legion, and the tool calls behind them, each showing where the agent asks before it acts. - [Legion skill](https://legion.ambient.xyz/docs/agents/skill/SKILL.md): The Agent Skill as SKILL.md; its references are linked from it. - [Legion skill (zip)](https://legion.ambient.xyz/docs/agents/legion-skill.zip): The skill folder as one archive, for Claude and other skill-aware agents. - [Legion MCP server](https://api.legion.ambient.xyz/v1/mcp): Streamable HTTP MCP endpoint; Claude connects by signing in to Legion (OAuth), other clients authenticate with an API key as a bearer token. ## API reference - [API reference](https://legion.ambient.xyz/docs/api.md): Every operation of the Legion API you can call with an API key, and the public market API, by area. - [Offers API reference](https://legion.ambient.xyz/docs/api/offers.md): Search the market's GPU offers, read one host's offer, and the score formula. - [Rentals API reference](https://legion.ambient.xyz/docs/api/rentals.md): Rent GPUs, then list, stop, start and delete rentals, back them up and read their network. - [Services API reference](https://legion.ambient.xyz/docs/api/services.md): Public URLs for what you run on Legion, on a port of a rental or autoscaled on rented GPUs: create, change, pause and delete them, manage their keys, and read their replicas, usage and activity. - [Images API reference](https://legion.ambient.xyz/docs/api/images.md): Check a container image in its registry before you rent with it. - [Billing API reference](https://legion.ambient.xyz/docs/api/billing.md): Your organization's balance, ledger, charges, top-ups, auto top-up and promo codes, and a provider's earnings and payouts. - [Network API reference](https://legion.ambient.xyz/docs/api/network.md): Your organization's outbound allow-list, and requests to add a site to it. - [Hosts API reference](https://legion.ambient.xyz/docs/api/hosts.md): The hosts you provide: enrollment tokens, listings, names, benchmarks, network and removal. - [Identity and keys API reference](https://legion.ambient.xyz/docs/api/identity.md): Who a key acts as, API keys, saved SSH public keys and your organization's invitations. - [Notifications API reference](https://legion.ambient.xyz/docs/api/notifications.md): What the bell shows, marking it read, and which events your organization is emailed about and to whom. - [Legal API reference](https://legion.ambient.xyz/docs/api/legal.md): The current versions of Legion's legal documents. - [Public market API reference](https://legion.ambient.xyz/docs/api/public.md): An anonymous, cached summary of what can be rented now. No key needed. - [OpenAPI spec](https://legion.ambient.xyz/docs/openapi.json): The whole public API as OpenAPI 3.0 (also /docs/openapi.yaml). ## API operations - [Search GPU offers](https://legion.ambient.xyz/docs/api/offers/list-offers.md): GET /v1/offers. Lists approved, listed, online hosts with at least min_gpus free GPUs, cheapest first unless sort says otherwise, filtered by every facet given (they… - [Get offer](https://legion.ambient.xyz/docs/api/offers/get-offer.md): GET /v1/offers/{host_id}. The offer of one host, as listOffers would list it, with its daily uptime over the last 30 days. - [List the caller's offer alerts](https://legion.ambient.xyz/docs/api/offers/list-offer-alerts.md): GET /v1/offer-alerts. Lists the caller's own offer alerts, newest first: active, triggered and expired ones. - [Create offer alert](https://legion.ambient.xyz/docs/api/offers/create-offer-alert.md): POST /v1/offer-alerts. Saves a market search as an offer alert. - [Get one offer alert](https://legion.ambient.xyz/docs/api/offers/get-offer-alert.md): GET /v1/offer-alerts/{alert_id}. The caller's alert. - [Update offer alert](https://legion.ambient.xyz/docs/api/offers/update-offer-alert.md): PATCH /v1/offer-alerts/{alert_id}. name renames the alert (an empty string removes the name). - [Delete an offer alert](https://legion.ambient.xyz/docs/api/offers/delete-offer-alert.md): DELETE /v1/offer-alerts/{alert_id}. Deletes the caller's alert, whatever its status. - [How the Legion score is computed](https://legion.ambient.xyz/docs/api/offers/get-score-formula.md): GET /v1/score-formula. The current version of the Legion score's formula: its components and their weights, and each component's factors with their weights and thresholds. - [List the organization's rentals](https://legion.ambient.xyz/docs/api/rentals/list-rentals.md): GET /v1/rentals. Lists rentals newest first, including deleted ones. - [Rent GPUs on a host](https://legion.ambient.xyz/docs/api/rentals/create-rental.md): POST /v1/rentals. Allocates gpu_count GPUs on the host at the host's current price and asks its agent to start the container. - [Get a rental](https://legion.ambient.xyz/docs/api/rentals/get-rental.md): GET /v1/rentals/{rental_id}. - [Change a rental's settings](https://legion.ambient.xyz/docs/api/rentals/update-rental.md): PATCH /v1/rentals/{rental_id}. Changes what a member may change on a rental after it was created: auto_resume, for an interruptible rental its bid max_price_per_gpu_hour, auto_backup… - [Delete a rental and its workspace](https://legion.ambient.xyz/docs/api/rentals/delete-rental.md): DELETE /v1/rentals/{rental_id}. Stops the container if it is running and deletes the workspace on the host. - [How to reach the model a rental serves](https://legion.ambient.xyz/docs/api/rentals/get-rental-serve.md): GET /v1/rentals/{rental_id}/serve. For a rental created with serve: the service Legion exposed for it, the API key the container checks (LEGION_API_KEY) and whether the service is ready. - [Create the rental's model service if it has none](https://legion.ambient.xyz/docs/api/rentals/expose-rental-serve.md): POST /v1/rentals/{rental_id}/serve/expose. Creates the exposed-port rule of the rental's serve port when there is none (the organization had not enabled exposed ports when the rental was created… - [Get rental network](https://legion.ambient.xyz/docs/api/rentals/get-rental-network.md): GET /v1/rentals/{rental_id}/network. What the rental can reach and whether its host's agent has applied it. - [Get rental host](https://legion.ambient.xyz/docs/api/rentals/get-rental-host.md): GET /v1/rentals/{rental_id}/host. . - [Get rental network activity](https://legion.ambient.xyz/docs/api/rentals/get-rental-network-activity.md): GET /v1/rentals/{rental_id}/network/activity. The rental's own outbound traffic as its host's agent reported it over the last 24 hours of stored windows (at most 5000 windows are summed: truncated… - [Read a rental's logs](https://legion.ambient.xyz/docs/api/rentals/get-rental-logs.md): GET /v1/rentals/{rental_id}/logs. . - [Stop a rental](https://legion.ambient.xyz/docs/api/rentals/stop-rental.md): POST /v1/rentals/{rental_id}/stop. Stops the container and releases its GPUs, which go back on the market for other renters. - [Restart a stopped rental](https://legion.ambient.xyz/docs/api/rentals/start-rental.md): POST /v1/rentals/{rental_id}/start. Allocates the same number of GPUs on the same host again and restarts the container on the retained workspace, in the rental's own tier and at its own… - [List a rental's recent workspace exports](https://legion.ambient.xyz/docs/api/rentals/list-workspace-exports.md): GET /v1/rentals/{rental_id}/workspace-exports. The rental's workspace exports requested in the last 72 hours (the 24 hours one may stay pending plus the up to 48 hours its file is kept), newest first… - [Export a stopped rental's workspace](https://legion.ambient.xyz/docs/api/rentals/create-workspace-export.md): POST /v1/rentals/{rental_id}/workspace-exports. Asks the host's agent to upload the workspace of a stopped rental (/workspace in the container) as one tar file, so the data of a rental that was… - [Get a workspace export](https://legion.ambient.xyz/docs/api/rentals/get-workspace-export.md): GET /v1/rentals/{rental_id}/workspace-exports/{export_id}. The state of an export createWorkspaceExport started. - [Cancel a pending workspace export](https://legion.ambient.xyz/docs/api/rentals/cancel-workspace-export.md): POST /v1/rentals/{rental_id}/workspace-exports/{export_id}/cancel. Cancels an export that is still pending: it becomes cancelled, what was uploaded is discarded (the S3 multipart upload is aborted), and the host's agent… - [Estimate workspace export](https://legion.ambient.xyz/docs/api/rentals/estimate-workspace-export.md): GET /v1/rentals/{rental_id}/workspace-exports/estimate. Shown before an export is started and again before a download link is made. - [Create workspace export download link](https://legion.ambient.xyz/docs/api/rentals/create-workspace-export-download-link.md): POST /v1/rentals/{rental_id}/workspace-exports/{export_id}/download-links. Charges the download and answers a link: url is a Legion address (/v1/downloads/) that works once, until expires_at (download_link_ttl_seconds). - [Get storage policy](https://legion.ambient.xyz/docs/api/rentals/get-storage-policy.md): GET /v1/storage-policy. The numbers behind stopping, deletion and backups, from the one place Legion keeps them, so the app, the docs and agents never hard-code them. - [Get rental transfer](https://legion.ambient.xyz/docs/api/rentals/get-rental-transfer.md): GET /v1/rentals/{rental_id}/transfer. The bytes sent toward the renter by this rental through the SSH gateway (ssh), exposed ports (ports) and the web terminal (terminal), this UTC month and… - [Get org transfer](https://legion.ambient.xyz/docs/api/rentals/get-org-transfer.md): GET /v1/transfer. The organization-level figures of getRentalTransfer for the current UTC month, with the 20 rentals that sent the most bytes this month. - [What a backup of this rental would cost](https://legion.ambient.xyz/docs/api/rentals/estimate-rental-backup.md): GET /v1/rentals/{rental_id}/backup-estimate. The quote a backup of the rental would be charged now: its estimated size is the disk the rental's host last reported it uses (disk_used_gib), else its… - [A rental's backups, newest first](https://legion.ambient.xyz/docs/api/rentals/list-rental-backups.md): GET /v1/rentals/{rental_id}/backups. Every backup of the rental, whatever its state, newest first. - [Back up a stopped or failed rental's workspace](https://legion.ambient.xyz/docs/api/rentals/create-rental-backup.md): POST /v1/rentals/{rental_id}/backups. Asks the host's agent to upload the rental's /workspace (only /workspace) as one tar file to Legion's backup storage, where it is kept retention_days (7… - [The organization's backups, newest first](https://legion.ambient.xyz/docs/api/rentals/list-backups.md): GET /v1/backups. Every backup of the organization's rentals, newest first; state filters. - [Get a backup](https://legion.ambient.xyz/docs/api/rentals/get-backup.md): GET /v1/backups/{backup_id}. A backup of one of the organization's rentals. - [Delete a ready backup early](https://legion.ambient.xyz/docs/api/rentals/delete-backup.md): DELETE /v1/backups/{backup_id}. Deletes a ready backup before it expires: it is deleted at once, can no longer be downloaded, and its file is purged 24 hours later. - [Cancel a queued or uploading backup](https://legion.ambient.xyz/docs/api/rentals/cancel-backup.md): POST /v1/backups/{backup_id}/cancel. Cancels a backup that is queued or uploading, as cancelWorkspaceExport cancels an export: it becomes cancelled, what was uploaded is discarded (the… - [Mint a download link for a ready backup](https://legion.ambient.xyz/docs/api/rentals/create-backup-download-link.md): POST /v1/backups/{backup_id}/download-links. A single-use link to the backup's tar file: url is a Legion address (/v1/downloads/) that works once, until expires_at (download_link_ttl_seconds… - [List the organization's services](https://legion.ambient.xyz/docs/api/services/list-services.md): GET /v1/services. The organization's services, newest first: every exposed port, model rental and autoscaled model (decision 32). - [Create a service](https://legion.ambient.xyz/docs/api/services/create-service.md): POST /v1/services. Creates a service (decision 32): a Service URL https://-.ambi.run, an access policy and a target. - [The defaults of a new service](https://legion.ambient.xyz/docs/api/services/get-service-defaults.md): GET /v1/services/defaults. The single source of service defaults and limits (decision 12): scaling, key expiry, timeouts and, for a catalog entry (catalog_id), its target… - [Estimate what a service would cost](https://legion.ambient.xyz/docs/api/services/estimate-service.md): POST /v1/services/estimate. What a service with this hardware and scaling would cost per hour at current prices, from the cheapest host that fits now: idle, at minimum and at… - [Get a service](https://legion.ambient.xyz/docs/api/services/get-service.md): GET /v1/services/{service_id}. One service with its status, replica counts, cold-start time and this month's spend, plus (on this read only) its keys (keys), live and warm replicas… - [Update service](https://legion.ambient.xyz/docs/api/services/update-service.md): PATCH /v1/services/{service_id}. Merge patch (decision 34). - [Delete a service](https://legion.ambient.xyz/docs/api/services/delete-service.md): DELETE /v1/services/{service_id}. Deletes the service and revokes its keys at once. - [Pause a service](https://legion.ambient.xyz/docs/api/services/pause-service.md): POST /v1/services/{service_id}/pause. No replicas and no GPU cost; the URL and keys stay and callers get 503 service_paused until resumed. - [Resume a paused service](https://legion.ambient.xyz/docs/api/services/resume-service.md): POST /v1/services/{service_id}/resume. Back to active: the autoscaler returns to min_replicas, warm replicas first. - [List a service's keys](https://legion.ambient.xyz/docs/api/services/list-service-keys.md): GET /v1/services/{service_id}/keys. The service's keys, newest first, revoked ones included: name, display prefix, expiry, last use and status. - [Create a service key](https://legion.ambient.xyz/docs/api/services/create-service-key.md): POST /v1/services/{service_id}/keys. A new lek_ key for this service only, its secret shown once (Cache-Control: no-store); Legion keeps only its SHA-256. - [Revoke a service key](https://legion.ambient.xyz/docs/api/services/revoke-service-key.md): DELETE /v1/services/{service_id}/keys/{key_id}. Revokes the key now; callers using it get 401 within seconds (at most 30). - [Rotate a service key](https://legion.ambient.xyz/docs/api/services/rotate-service-key.md): POST /v1/services/{service_id}/keys/{key_id}/rotate. Creates a new key and makes the old one expire after overlap_hours (default 24, 0 to 168), so callers can switch without downtime. - [List a service's replicas](https://legion.ambient.xyz/docs/api/services/list-service-replicas.md): GET /v1/services/{service_id}/replicas. The service's live and warm replicas, newest first; include_retired=true adds those retired in the last 7 days with the reason. - [A service's metrics and cost](https://legion.ambient.xyz/docs/api/services/get-service-usage.md): GET /v1/services/{service_id}/usage. Request metrics over window (1h in minute points, the default; 24h in 5-minute points; 7d hourly): requests, status classes, rejections, time to first… - [A service's inference metrics](https://legion.ambient.xyz/docs/api/services/get-service-metrics.md): GET /v1/services/{service_id}/metrics. Serving metrics of a service, or of one of its replicas with replica, over window: a time series (points) and a summary of the whole window. - [A service's activity](https://legion.ambient.xyz/docs/api/services/list-service-events.md): GET /v1/services/{service_id}/events. Scaling, key, budget and settings history, newest first, kept 30 days. - [Read a service's logs, every replica](https://legion.ambient.xyz/docs/api/services/get-service-logs.md): GET /v1/services/{service_id}/logs. . - [Get catalog settings](https://legion.ambient.xyz/docs/api/images/get-catalog-settings.md): GET /v1/catalog/settings. The runtime state of the legion-images catalog. - [List catalog](https://legion.ambient.xyz/docs/api/images/list-catalog.md): GET /v1/catalog. Legion's catalog: the starter images and premade models of the legion-images release Legion is pinned to, with Legion's runtime state applied. - [Inspect a container image before renting it](https://legion.ambient.xyz/docs/api/images/inspect-image.md): POST /v1/images/inspect. Looks the image up in its registry, without pulling any layer, and answers what a rental of it would run: the digest the tag resolves to, the platforms… - [The organization's registry sign-ins](https://legion.ambient.xyz/docs/api/images/list-registry-sign-ins.md): GET /v1/registry-sign-ins. , deprecated by listRegistryCredentials, which lists every credential. - [Save the organization's sign-in for a registry](https://legion.ambient.xyz/docs/api/images/put-registry-sign-in.md): PUT /v1/registry-sign-ins/{registry}. , deprecated by createRegistryCredential and updateRegistryCredential. - [Remove the organization's sign-in for a registry](https://legion.ambient.xyz/docs/api/images/delete-registry-sign-in.md): DELETE /v1/registry-sign-ins/{registry}. , deprecated by deleteRegistryCredential. - [The organization's registry credentials](https://legion.ambient.xyz/docs/api/images/list-registry-credentials.md): GET /v1/registry-credentials. . - [Save a registry credential](https://legion.ambient.xyz/docs/api/images/create-registry-credential.md): POST /v1/registry-credentials. . - [Detect registry credential](https://legion.ambient.xyz/docs/api/images/detect-registry-credential.md): POST /v1/registry-credentials/detect. . - [One registry credential](https://legion.ambient.xyz/docs/api/images/get-registry-credential.md): GET /v1/registry-credentials/{credential_id}. . - [Rename a registry credential or replace its secret](https://legion.ambient.xyz/docs/api/images/update-registry-credential.md): PATCH /v1/registry-credentials/{credential_id}. . - [Remove a registry credential](https://legion.ambient.xyz/docs/api/images/delete-registry-credential.md): DELETE /v1/registry-credentials/{credential_id}. . - [Get what a rental has cost](https://legion.ambient.xyz/docs/api/billing/get-rental-charges.md): GET /v1/rentals/{rental_id}/charges. Billed time and the total charged for one of the organization's rentals. - [Get the organization's balance](https://legion.ambient.xyz/docs/api/billing/get-billing-account.md): GET /v1/billing/account. The prepaid balance of the caller's organization. - [List the organization's ledger entries](https://legion.ambient.xyz/docs/api/billing/list-ledger-entries.md): GET /v1/billing/ledger. Every change to the organization's balance and provider earnings, newest first. - [List billing activity](https://legion.ambient.xyz/docs/api/billing/list-billing-activity.md): GET /v1/billing/activity. The organization's activity on one side of its ledger, newest first, folded for people to read. - [List what the organization's rentals have cost](https://legion.ambient.xyz/docs/api/billing/list-rental-charges.md): GET /v1/billing/charges. getRentalCharges for every rental the organization rented that has been billed, newest rental first, in one paginated call. - [Get the organization's provider earnings](https://legion.ambient.xyz/docs/api/billing/get-provider-earnings.md): GET /v1/billing/earnings. What the organization's hosts have earned from usage, what Ambient took back from those earnings (earnings_recovery, after payment fraud the provider was… - [Get rental earnings](https://legion.ambient.xyz/docs/api/billing/get-rental-earnings.md): GET /v1/billing/earnings/rentals/{rental_id}. Billed time, the renter's charge, the provider's earnings and the platform commission for a rental on one of the organization's hosts. - [Get provider earnings overview](https://legion.ambient.xyz/docs/api/billing/get-provider-earnings-overview.md): GET /v1/provider/earnings/overview. What the organization's hosts earned in the UTC days from to to (both included) and in the period of the same length just before it, for the Earnings… - [The organization's earnings over time](https://legion.ambient.xyz/docs/api/billing/get-provider-earnings-series.md): GET /v1/provider/earnings/series. The period in day, week (Monday to Sunday) or month buckets, each clipped to the period: gross, fee, net earnings, GPU-hours, utilization (against… - [The organization's earnings by one dimension](https://legion.ambient.xyz/docs/api/billing/get-provider-earnings-breakdown.md): GET /v1/provider/earnings/breakdown. The period's charges on the organization's hosts grouped by dimension, largest net earnings first, the first limit groups in rows, the rest added up in… - [List provider earnings hosts](https://legion.ambient.xyz/docs/api/billing/list-provider-earnings-hosts.md): GET /v1/provider/earnings/hosts. Every host of the organization that is not removed, and every removed one that earned in the period, largest net earnings first: net and gross earnings… - [Get provider earnings host](https://legion.ambient.xyz/docs/api/billing/get-provider-earnings-host.md): GET /v1/provider/earnings/hosts/{host_id}. The host's row of listProviderEarningsHosts, its earnings in day or week buckets, its uptime per UTC day over the last 30 days, its price against the… - [List provider earnings rentals](https://legion.ambient.xyz/docs/api/billing/list-provider-earnings-rentals.md): GET /v1/provider/earnings/rentals. The rentals with charges in the period, ordered by sort, at most limit (1000 at most, so the list can be exported whole): the rental's name and host, the… - [List provider earnings attention](https://legion.ambient.xyz/docs/api/billing/list-provider-earnings-attention.md): GET /v1/provider/earnings/attention. What is holding the organization's hosts back in the period, most important first, each with plain words, the figures behind it and one suggested action. - [List provider earnings payouts](https://legion.ambient.xyz/docs/api/billing/list-provider-earnings-payouts.md): GET /v1/provider/earnings/payouts. What is payable now (the rollup's balance as at today), whether the next payout can run and an estimate of it, and the money movements of the period… - [Get renter spend overview](https://legion.ambient.xyz/docs/api/billing/get-renter-spend-overview.md): GET /v1/renter/spend/overview. What the organization's prepaid balance was charged in the UTC days from to to (both included) and in the period of the same length just before it, for… - [The organization's spend over time](https://legion.ambient.xyz/docs/api/billing/get-renter-spend-series.md): GET /v1/renter/spend/series. The period in day, week (Monday to Sunday) or month buckets, each clipped to the period: spent, paid with promo credit, GPU-hours and the effective price… - [The organization's spend by one dimension](https://legion.ambient.xyz/docs/api/billing/get-renter-spend-breakdown.md): GET /v1/renter/spend/breakdown. The period's charges to the organization's balance grouped by dimension, largest spend first, the first limit groups in rows, the rest added up in others… - [List renter spend rentals](https://legion.ambient.xyz/docs/api/billing/list-renter-spend-rentals.md): GET /v1/renter/spend/rentals. The rentals with charges in the period, ordered by sort, at most limit (1000 at most, so the list can be exported whole): the rental's ID, name and… - [Get the organization's payout setup](https://legion.ambient.xyz/docs/api/billing/get-payout-status.md): GET /v1/billing/payouts. Where the organization stands with payout setup: no payout account yet, onboarding started but not finished, Stripe asking for more information, Stripe… - [List the organization's top-ups](https://legion.ambient.xyz/docs/api/billing/list-top-ups.md): GET /v1/billing/top-ups. The caller's organization's top-ups with their status, newest first: the ones in progress (open, which includes an ACH debit that has not settled), the… - [Top up the organization's balance](https://legion.ambient.xyz/docs/api/billing/create-top-up.md): POST /v1/billing/top-ups. Starts a top-up of the prepaid balance through Stripe Checkout and returns the Checkout page to send the person to. - [See the organization's auto top-up](https://legion.ambient.xyz/docs/api/billing/get-auto-top-up.md): GET /v1/billing/auto-top-up. . - [Turn auto top-up on or off and set its amounts](https://legion.ambient.xyz/docs/api/billing/put-auto-top-up.md): PUT /v1/billing/auto-top-up. . - [Save or replace the card auto top-up charges](https://legion.ambient.xyz/docs/api/billing/create-auto-top-up-card.md): POST /v1/billing/auto-top-up/card. . - [Remove the saved card and turn auto top-up off](https://legion.ambient.xyz/docs/api/billing/delete-auto-top-up-card.md): DELETE /v1/billing/auto-top-up/card. . - [Get credit refund quote](https://legion.ambient.xyz/docs/api/billing/get-credit-refund-quote.md): GET /v1/billing/credit-refund-quote. . - [Create credit refund](https://legion.ambient.xyz/docs/api/billing/create-credit-refund.md): POST /v1/billing/credit-refunds. . - [Check what a promo code gives the organization](https://legion.ambient.xyz/docs/api/billing/preview-promo-code.md): POST /v1/billing/promo-codes/preview. . - [Redeem a promo code](https://legion.ambient.xyz/docs/api/billing/redeem-promo-code.md): POST /v1/billing/promo-codes/redeem. . - [List the organization's promo code redemptions](https://legion.ambient.xyz/docs/api/billing/list-promo-redemptions.md): GET /v1/billing/promo-redemptions. . - [Get the organization's promo credit and discounts](https://legion.ambient.xyz/docs/api/billing/get-promo-credit.md): GET /v1/billing/promo-credit. . - [The organization's outbound allow-list](https://legion.ambient.xyz/docs/api/network/get-egress-allowlist.md): GET /v1/network/egress-allowlist. The platform's default allow-list plus the organization's approved requests that apply to all of its rentals (source organization), with the egress mode… - [Update org egress mode](https://legion.ambient.xyz/docs/api/network/update-org-egress-mode.md): PUT /v1/network/egress-mode. . - [The organization's egress requests](https://legion.ambient.xyz/docs/api/network/list-egress-requests.md): GET /v1/egress-requests. Requests for destinations to be added to the allow-list, newest first, for every rental and for the organization as a whole. - [Create egress request](https://legion.ambient.xyz/docs/api/network/create-egress-request.md): POST /v1/egress-requests. Asks Legion to allow a domain (example.com, or *.example.com for its subdomains) or an IPv4 range for one rental, or for the whole organization (omit… - [Withdraw a pending egress request](https://legion.ambient.xyz/docs/api/network/withdraw-egress-request.md): POST /v1/egress-requests/{egress_request_id}/withdraw. Withdraws a request that has not been decided. - [List pending enrollment tokens](https://legion.ambient.xyz/docs/api/hosts/list-enrollment-tokens.md): GET /v1/enrollment-tokens. Lists the organization's enrollment tokens that are neither used, revoked nor expired. - [Create a host enrollment token](https://legion.ambient.xyz/docs/api/hosts/create-enrollment-token.md): POST /v1/enrollment-tokens. Creates a single-use token the Legion agent uses to register one host to the caller's organization. - [Revoke an enrollment token](https://legion.ambient.xyz/docs/api/hosts/revoke-enrollment-token.md): DELETE /v1/enrollment-tokens/{enrollment_token_id}. Revokes an unused enrollment token, so no host can register with it. - [List the organization's hosts](https://legion.ambient.xyz/docs/api/hosts/list-hosts.md): GET /v1/hosts. Hosts removed by their provider, Legion or the timeout (state removed) are left out unless include_removed is true. - [Get a host](https://legion.ambient.xyz/docs/api/hosts/get-host.md): GET /v1/hosts/{host_id}. - [Remove a host](https://legion.ambient.xyz/docs/api/hosts/remove-host.md): POST /v1/hosts/{host_id}/remove. Removes the host: its state becomes removed with removed_reason provider, it leaves offers and the default host list, and its agent credentials are… - [The organization's maintenance windows](https://legion.ambient.xyz/docs/api/hosts/list-maintenance-windows.md): GET /v1/maintenance-windows. . - [Schedule maintenance on one or many hosts](https://legion.ambient.xyz/docs/api/hosts/schedule-maintenance.md): POST /v1/maintenance-windows. . - [What scheduling maintenance would do](https://legion.ambient.xyz/docs/api/hosts/preview-maintenance.md): GET /v1/maintenance-windows/preview. . - [Move or change scheduled maintenance windows](https://legion.ambient.xyz/docs/api/hosts/reschedule-maintenance.md): POST /v1/maintenance-windows/reschedule. . - [Cancel scheduled maintenance windows](https://legion.ambient.xyz/docs/api/hosts/cancel-maintenance.md): POST /v1/maintenance-windows/cancel. . - [End maintenance](https://legion.ambient.xyz/docs/api/hosts/end-maintenance.md): POST /v1/maintenance-windows/end. . - [Preview what is on a host before removing it](https://legion.ambient.xyz/docs/api/hosts/get-host-removal-preview.md): GET /v1/hosts/{host_id}/removal-preview. . - [Rename a host](https://legion.ambient.xyz/docs/api/hosts/rename-host.md): PUT /v1/hosts/{host_id}/name. Gives the host a new friendly name. - [Set a host's price and availability](https://legion.ambient.xyz/docs/api/hosts/update-listing.md): PUT /v1/hosts/{host_id}/listing. Sets the on-demand price per GPU-hour, the optional interruptible price and whether the host appears in offers. - [A host's benchmark runs, newest first](https://legion.ambient.xyz/docs/api/hosts/list-host-benchmarks.md): GET /v1/hosts/{host_id}/benchmarks. The provider's history of its host's benchmarks: each run as Legion kept it, with what was verified and what was flagged. - [Progress of a host's first benchmark](https://legion.ambient.xyz/docs/api/hosts/get-host-first-benchmark.md): GET /v1/hosts/{host_id}/first-benchmark. Where the host's first benchmark stands and, once it completed, how Legion judged it. - [Ask your host to benchmark again](https://legion.ambient.xyz/docs/api/hosts/request-host-benchmark.md): POST /v1/hosts/{host_id}/benchmark-request. A host that serves a rental accepts the request too and runs the benchmarks once it is idle (never during a rental, which they would slow down); the… - [Take your host off its start-failure pause](https://legion.ambient.xyz/docs/api/hosts/release-host-start-hold.md): POST /v1/hosts/{host_id}/start-hold/release. . - [A host's GPU benchmark runs, newest first](https://legion.ambient.xyz/docs/api/hosts/list-host-gpu-benchmarks.md): GET /v1/hosts/{host_id}/gpu-benchmarks. The provider's history of its host's GPU benchmarks: each run as Legion kept it, with what was flagged. - [A host's listing price history, newest first](https://legion.ambient.xyz/docs/api/hosts/list-host-listing-history.md): GET /v1/hosts/{host_id}/listing-history. Every change of the host's listing: when it was listed or unlisted, or its price changed, with the old and new price and who made the change (actor: a… - [Get host price recommendation](https://legion.ambient.xyz/docs/api/hosts/get-host-price-recommendation.md): GET /v1/hosts/{host_id}/price-recommendation. The price advisor: a deterministic recommendation for the host's GPU class, for an on-demand price and for an interruptible one, each with a low to high… - [Get host network](https://legion.ambient.xyz/docs/api/hosts/get-host-network.md): GET /v1/hosts/{host_id}/network. Whether the host's agent applies network policies and how far it has got, for the provider's own host: the agent's version and capabilities… - [Set the destinations blocked for rentals on a host](https://legion.ambient.xyz/docs/api/hosts/update-host-network.md): PUT /v1/hosts/{host_id}/network. Changes the fields given and leaves the others as they are. - [Get the caller](https://legion.ambient.xyz/docs/api/identity/get-me.md): GET /v1/me. Returns the user, organization and permissions behind the credential, and access: whether the person may use Legion during the beta, and the verified… - [List the caller's API keys](https://legion.ambient.xyz/docs/api/identity/list-api-keys.md): GET /v1/api-keys. Lists API keys the caller created in their organization. - [Create an API key](https://legion.ambient.xyz/docs/api/identity/create-api-key.md): POST /v1/api-keys. Creates an API key for the caller in the caller's organization. - [Revoke an API key](https://legion.ambient.xyz/docs/api/identity/revoke-api-key.md): DELETE /v1/api-keys/{api_key_id}. Revokes one of the caller's API keys. - [List the caller's saved SSH public keys](https://legion.ambient.xyz/docs/api/identity/list-ssh-keys.md): GET /v1/ssh-keys. Lists the SSH public keys the caller saved in their organization, oldest first. - [Save an SSH public key](https://legion.ambient.xyz/docs/api/identity/add-ssh-key.md): POST /v1/ssh-keys. Saves one OpenSSH public key under a label of the caller's choosing. - [Delete a saved SSH public key](https://legion.ambient.xyz/docs/api/identity/delete-ssh-key.md): DELETE /v1/ssh-keys/{ssh_key_id}. Deletes one of the caller's saved keys. - [List pending invitations](https://legion.ambient.xyz/docs/api/identity/list-invitations.md): GET /v1/invitations. Lists the organization's invitations that are neither accepted, revoked nor expired. - [Invite a person to the organization](https://legion.ambient.xyz/docs/api/identity/create-invitation.md): POST /v1/invitations. The person joins the organization by accepting the invitation (acceptInvitation, or the onboarding Invitations step) after signing in with a verified… - [Revoke a pending invitation](https://legion.ambient.xyz/docs/api/identity/revoke-invitation.md): DELETE /v1/invitations/{invitation_id}. Revokes the invitation, so it can no longer be accepted by the person it was sent to. - [Email an invitation again](https://legion.ambient.xyz/docs/api/identity/resend-invitation.md): POST /v1/invitations/{invitation_id}/resend. Sends the invitation email again. - [List the organization's members](https://legion.ambient.xyz/docs/api/identity/list-members.md): GET /v1/members. The people in the caller's organization: each person's ID, name and email, role, when they joined and, when Legion has seen them, last_active_at. - [List the organization's notifications](https://legion.ambient.xyz/docs/api/notifications/list-notifications.md): GET /v1/notifications. The caller's organization's notifications, newest first, with Legion's platform updates, which every organization sees. - [Mark every notification read](https://legion.ambient.xyz/docs/api/notifications/mark-all-notifications-read.md): POST /v1/notifications/read. Marks every notification the caller can see read, for the caller only. - [Mark a notification read](https://legion.ambient.xyz/docs/api/notifications/mark-notification-read.md): POST /v1/notifications/{notification_id}/read. Marks one notification read for the caller only. - [Which notifications are emailed, and to whom](https://legion.ambient.xyz/docs/api/notifications/get-notification-settings.md): GET /v1/notification-settings. The organization's email settings, one per notification kind: whether it is emailed and to whom (all_members, owners, or selected members). - [Update notification setting](https://legion.ambient.xyz/docs/api/notifications/update-notification-setting.md): PUT /v1/notification-settings/{kind}. Sets one kind's email setting. - [List legal documents](https://legion.ambient.xyz/docs/api/legal/list-legal-documents.md): GET /v1/legal/documents. Unauthenticated. - [Get public market](https://legion.ambient.xyz/docs/api/public/get-public-market.md): GET /api/public/market. Anonymous and cross-origin: any page may fetch it without credentials (Access-Control-Allow-Origin: *). ## Optional - [Ambient](https://ambient.xyz): The company behind Legion.