Skip to main content

CPUMarkets Python SDK

This package provides a Python SDK and CLI to submit CPU jobs to CPUMarkets.

Install

pip install cpumarkets

Configure

export CPURENT_BASE_URL=https://www.cpu.markets
export CPURENT_API_KEY=YOUR_SDK_KEY
export CPURENT_API_SECRET=YOUR_SDK_SECRET

Python usage

from cpumarkets import CPUMarketsClient

client = CPUMarketsClient(
    base_url="https://www.cpu.markets",
    api_key="YOUR_SDK_KEY",
    api_secret="YOUR_SDK_SECRET",
)

job_id = client.submit_direct_job(
    task_type="hashing",
    payload={"data": "hello", "iterations": 200000},
    requested_cores=1,
    requested_seconds=20,
    priority=0,
)

result = client.wait_for_result(job_id, poll_interval=2, timeout=120)
print(result["output"])

CLI usage

List available listings:

cpumarkets list

Submit a direct job:

cpumarkets direct --task hashing --payload '{"data":"hello","iterations":200000}' --cores 1 --seconds 20 --wait

Run a Python script on rented CPU:

cpumarkets python3 path/to/script.py --cores 1 --seconds 30 --wait

Notes

  • Buyer IP whitelist must allow your server IP.
  • Sellers can block countries, which filters visible listings.

Release files for cpumarkets 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cpumarkets 0.1.0
File Size Uploaded
cpumarkets-0.1.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cpumarkets 0.1.0
File Interpreter ABI Platform
cpumarkets-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / cpumarkets-0.1.0.tar.gz

Download URL cpumarkets-0.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0a26da9810a02c85b1f1a42a8ea0e979642c10132593ad8202e0bf063f60194c
BLAKE2b-256 checksum
How to use checksums
b9940227a4174eca903799a7a85d8961766495da84523a3231cef0728bd3fd51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / cpumarkets-0.1.0-py3-none-any.whl

Download URL cpumarkets-0.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7163ce7753259a4077a4282f8e29466b4585bf8a25446cd71add9782fc76942
BLAKE2b-256 checksum
How to use checksums
618d5714634111057b7a1e5225924086ee2f5de09717c64977bef047d663b2de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page