# Public market API

> What GPUs can be rented on Legion now, and from what price, with no key.

Source: https://legion.ambient.xyz/docs/api/public-market

One request tells you which GPU models can be rented on Legion now, how many are free, and the lowest price for each. It needs no key, no cookie and no sign-in.

```sh
curl -s "https://legion.ambient.xyz/api/public/market"
```

## Call it from a browser

The response sends `Access-Control-Allow-Origin: *`. A plain `fetch` with no custom headers works from any page. Don't send credentials.

```js
const response = await fetch("https://legion.ambient.xyz/api/public/market");
const market = response.ok ? await response.json() : undefined;
```

## The response

When nothing can be rented, `models` is empty:

```json
{
  "generated_at": "2026-10-15T20:18:20.751571Z",
  "currency": "USD",
  "models": []
}
```

Each entry in `models` has this shape (values shown as `…`):

```json
{
  "slug": "rtx-4090",
  "gpu_model": "NVIDIA GeForce RTX 4090",
  "class": "workstation",
  "memory_gib": 24,
  "from_price_per_gpu_hour": "…",
  "max_gpus_on_one_host": …,
  "gpus_available": …,
  "hosts_available": …,
  "rent_url": "https://legion.ambient.xyz/rent/market?gpu_model=NVIDIA+GeForce+RTX+4090",
  "median_tflops": …
}
```

| Field | What it is |
| --- | --- |
| `generated_at` | When Legion computed this summary. |
| `currency` | The currency of every price. |
| `models` | One entry per GPU model with a GPU free now. Empty when nothing can be rented. |
| `slug` | A stable, URL-safe name for the model. Match on it. |
| `gpu_model` | The model's full name, as the NVIDIA driver reports it. |
| `class` | `datacenter` or `workstation`. |
| `memory_gib` | Memory per GPU, in whole GiB. |
| `from_price_per_gpu_hour` | The lowest price for one GPU for one hour, as a decimal string. Never a float. |
| `max_gpus_on_one_host` | The most GPUs free on a single host: the largest single rental possible now. |
| `gpus_available` | GPUs free now, on all hosts together. |
| `hosts_available` | Hosts with at least one GPU free. |
| `rent_url` | The Legion market, filtered to this model. |
| `median_tflops` | The median measured TFLOPS per GPU across the free hosts, when there is one. |

New fields can appear. Ignore the ones you don't know.

The summary is aggregated per GPU model. It never names a host, provider or organization.

## Prices

Prices are decimal strings with two decimal places. To do arithmetic, convert to integer cents first, for example `Math.round(Number(price) * 100)`, and format with `Intl.NumberFormat`. The prices are all-in: they include Legion's platform fee, like every price a renter sees. These are "from" prices: renters see each host's exact price in the market.

## Link to the market

`rent_url` opens the market filtered to the model. To ask for more than one GPU, add `min_gpus`, up to `max_gpus_on_one_host`:

```js
const url = new URL(model.rent_url);
url.searchParams.set("min_gpus", "2");
```

## Caching and limits

- Responses carry `Cache-Control: public, max-age=30, s-maxage=60, stale-while-revalidate=300`. `generated_at` shows how old the data is.
- Fetch it once per page view. Don't poll faster than once a minute.
- Each IP address can make 60 requests a minute. Over that, you get `429` for a minute.

## Errors

A response that isn't `200` is `application/problem+json`. Treat it like an empty list. Don't show stale or sample prices as if they were live.
