Skip to main content

Examples

Example requests to the Spare Cores Navigator APIAPI: Application Programming InterfaceA defined set of requests and responses through which one program uses another, such as a web service's HTTP endpoints or a library's functions.WikipediaGlossary, from searching servers to ranking them by a benchmark and looking up one server's prices. Most endpoints need no authentication, so you can run these as they are. The API reference describes every endpoint and parameter, and its built-in API client sends the requests from your browser.

Search servers​

The cheapest server types with at least 8 vCPUsvCPU: virtual CPUA CPU of a virtual machine, the unit in which cloud vendors sell compute. It is usually one hardware thread of a physical core with SMT, so two vCPUs may share one physical core.WikipediaGlossary and 32 GB of memory, by their on-demandon-demandA pricing model of cloud servers that charges for the time a server runs, without a commitment, typically per second or hour. The server runs until you stop it, unlike a spot instance, but it costs more than spot or reserved capacity.Glossary price:

curl -G https://keeper.sparecores.net/servers \
-d vcpus_min=8 \
-d memory_min=32 \
-d best_price_allocation=ONDEMAND_ONLY \
-d limit=3

Each server type comes with its specs, its lowest prices (min_price), and its benchmark scores, e.g. its SCoreSCore: Spare Cores scoreA CPU speed score of a server type in Spare Cores Navigator, used to compare the speed of server types. It is measured with the cpu stressor of stress-ng at increasing worker counts. The single-core SCore is the result with one worker; the multi-core SCore, the raw multi-core CPU speed that SCore means on its own, is the highest result.Glossary (score), the multi-core CPUCPU: Central Processing UnitThe general-purpose processor of a computer, which runs the operating system and programs. A CPU has one or more physical cores, and with SMT each core runs two or more hardware threads.WikipediaGlossary speed, and its SCore per price (score_per_price). The results are sorted by min_price by default; set order_by and order_dir for another order.

/servers has filters for almost every column, such as vendor, regions, gpu_min or price_max.

Page through the results​

limit sets the number of results (25 by default, -1 for all), and page the page. add_total_count_header=true returns the number of all matching results in the X-Total-Count header:

curl -G -D - https://keeper.sparecores.net/servers \
-d vcpus_min=8 \
-d memory_min=32 \
-d limit=3 \
-d page=2 \
-d add_total_count_header=true

Prices: spot or on-demand, and currency​

best_price_allocation sets which prices min_price uses: ANY (the default), SPOT_ONLY, ONDEMAND_ONLY, or MONTHLY for the monthly on-demand price. Prices are hourly (monthly with MONTHLY), in USD by default; currency converts them, e.g. the cheapest spot pricesspot instanceA cloud server that runs on the vendor's spare capacity, at a large discount from its on-demand price, but which the vendor can stop or take back at short notice when it needs the capacity. Spot prices change with the demand, e.g. several times a day.AWS docsGlossary in EUR:

curl -G https://keeper.sparecores.net/servers \
-d vcpus_min=8 \
-d memory_min=32 \
-d best_price_allocation=SPOT_ONLY \
-d currency=EUR \
-d limit=3

The API converts the prices of all vendors to the same currency, so you can compare vendors that price in USD and in EUR, which the SQLite database alone can't.

Rank servers by a benchmark​

benchmark_id selects a benchmark to rank the servers by, instead of the SCoreSCore: Spare Cores scoreA CPU speed score of a server type in Spare Cores Navigator, used to compare the speed of server types. It is measured with the cpu stressor of stress-ng at increasing worker counts. The single-core SCore is the result with one worker; the multi-core SCore, the raw multi-core CPU speed that SCore means on its own, is the highest result.Glossary. For example, to look for a fast single core, with PassMarkPassMarkThe PerformanceTest benchmark suite of PassMark Software, for Windows, Linux, macOS, and mobile devices. It runs fixed CPU, memory, disk, and graphics tests, such as math workloads involving compression, encryption, and physics simulations, and combines the results into an overall PassMark Rating.PerformanceTestGlossary's CPU Single Threaded Test, highest score first:

curl -G https://keeper.sparecores.net/servers \
-d vcpus_min=8 \
-d memory_min=32 \
-d best_price_allocation=ONDEMAND_ONLY \
-d benchmark_id=passmark:cpu_single_threaded_test \
-d order_by=selected_benchmark_score \
-d order_dir=desc \
-d limit=3

Each server then has the score of that benchmark in selected_benchmark_score, and its score per price in selected_benchmark_score_per_price. The Benchmarks list the IDs of all benchmarks.

Rank servers by cost-efficiency​

Some benchmarks have a configuration, e.g. the model of the LLM inference speedLLM inference speedHow fast hardware runs an LLM, usually measured in tokens per second. It is measured separately for prompt processing, in which the model reads the input prompt, and text generation, in which it produces output tokens one at a time, because the first is usually limited by compute and the second by memory bandwidth. Benchmarks of LLM servers also measure latency, such as the time to first token, and the throughput of many concurrent requests.Glossary benchmark. benchmark_config selects one, as JSONJSON: JavaScript Object NotationA text format for structured data, built from objects (key-value pairs), arrays, strings, numbers, booleans, and null. Most languages and tools read and write it, which makes it a common format for API responses and benchmark output.JSONGlossary that must match the configuration's text exactly, including its spaces and the order of its keys: copy it from the config field of /benchmark_configs. For example, the servers that generate text with Llama 3.3 70B at the lowest cost, by the tokenstokenThe unit of text that an LLM reads and writes, as defined by the model's tokenizer, such as a word, part of a word, or a punctuation mark. Prompt and output lengths are counted in tokens, and LLM inference speed is usually measured in tokens per second.Glossary generated per second per hourly price:

curl -G https://keeper.sparecores.net/servers \
-d benchmark_id=llm_speed:text_generation \
--data-urlencode 'benchmark_config={"model": "Llama-3.3-70B-Instruct-Q4_K_M.gguf", "tokens": 128}' \
-d best_price_allocation=ONDEMAND_ONLY \
-d order_by=selected_benchmark_score_per_price \
-d order_dir=desc \
-d limit=10

The LLM speed benchmark lists the models and token counts measured.

Look up a server​

The details of one server type, by its vendor and server ID, e.g. the AWS t4g.2xlarge:

curl https://keeper.sparecores.net/v2/server/aws/t4g.2xlarge

Its prices in each regionregionA geographic area where a cloud vendor runs its data centers, such as Frankfurt or Northern Virginia, made up of one or more availability zones. A server type is offered in some regions only, and its price can differ by region; a region's ID, such as eu-central-1, is unique only within its vendor.Glossary and zone, e.g. only in Germany and in EUR:

curl -G https://keeper.sparecores.net/server/aws/t4g.2xlarge/prices \
-d countries=DE \
-d currency=EUR

Its benchmark scores:

curl https://keeper.sparecores.net/server/aws/t4g.2xlarge/benchmarks

And the 5 server types most similar to it, here by their SCoreSCore: Spare Cores scoreA CPU speed score of a server type in Spare Cores Navigator, used to compare the speed of server types. It is measured with the cpu stressor of stress-ng at increasing worker counts. The single-core SCore is the result with one worker; the multi-core SCore, the raw multi-core CPU speed that SCore means on its own, is the highest result.Glossary per price, also at other vendors:

curl https://keeper.sparecores.net/server/aws/t4g.2xlarge/similar_servers/score_per_price/5

The other methods are family (the other sizes of the same series), specs, score, and benchmark_score or benchmark_score_per_price with benchmark_id. See Get Similar Servers.

In Python​

The same search with Requests⁠ (opens in a new tab):

import requests

response = requests.get(
"https://keeper.sparecores.net/servers",
params={
"vcpus_min": 8,
"memory_min": 32,
"best_price_allocation": "ONDEMAND_ONLY",
"limit": 5,
},
timeout=30,
)
response.raise_for_status()
for server in response.json():
print(server["vendor_id"], server["api_reference"], server["min_price"])

Limits​

The API is free to use under a fair use policy, with rate limits per IP address or user. Retry a 429 or 503 response after the seconds in its Retry-After header, when it has one. See Rate Limiting and Fair Use & Commercial Use.