clore-ai
Modern Python SDK and CLI for Clore.ai GPU marketplace.
Rent powerful GPUs for AI/ML workloads with a simple, intuitive interface. Supports both synchronous and asynchronous operations.
🚀 Features
- Full API Coverage — All Clore.ai endpoints (marketplace, orders, servers, wallets, spot market)
- Sync & Async —
CloreAI(sync) andAsyncCloreAI(async) clients - Rate Limiting — Built-in rate limiter with exponential backoff
- Rich CLI — Beautiful terminal interface with
richtables - Type Safe — Full type hints and Pydantic models
- SSH Helper — One-command SSH into your instances
- Production Ready — Error handling, retries, configurable timeouts
📦 Installation
pip install clore-ai
From source
git clone https://gitlab.com/cloreai/clore-ai-sdk.git
cd clore-ai
pip install -e .
🔑 Authentication
Get your API key from Clore.ai dashboard.
Option 1: Environment variable (recommended)
export CLORE_API_KEY=your_api_key_here
Option 2: CLI config
clore config set api_key YOUR_API_KEY
Option 3: Pass directly
from clore_ai import CloreAI
client = CloreAI(api_key="your_key")
🐍 SDK Usage
Basic Example
from clore_ai import CloreAI
# Initialize client
client = CloreAI(api_key="your_key")
# Browse marketplace
servers = client.marketplace(gpu="RTX 4090", max_price_usd=5.0)
for server in servers:
print(f"{server.id}: {server.gpu_model} - ${server.price_usd_per_hour}/h")
# Create order
order = client.create_order(
server_id=123,
image="cloreai/ubuntu22.04-cuda12",
type="on-demand",
currency="bitcoin",
ports={"22": "tcp", "8888": "http"},
ssh_password="mysecret"
)
print(f"Order created: {order.id} @ {order.pub_cluster}")
# List active orders
orders = client.my_orders()
for order in orders:
print(f"{order.id}: {order.status} - {order.pub_cluster}")
# Cancel order
client.cancel_order(order_id=38)
Async Example
import asyncio
from clore_ai import AsyncCloreAI
async def main():
async with AsyncCloreAI(api_key="your_key") as client:
# Search marketplace
servers = await client.marketplace(gpu="RTX 4090")
# Create order
order = await client.create_order(
server_id=servers[0].id,
image="cloreai/pytorch",
type="spot",
currency="bitcoin",
spot_price=0.0001
)
print(f"Created order {order.id}")
asyncio.run(main())
Wallets
wallets = client.wallets()
for wallet in wallets:
print(f"{wallet.currency}: {wallet.balance:.8f}")
Server Management
# Your hosted servers
my_servers = client.my_servers()
# Server configuration
config = client.server_config("MyGPU")
print(f"Availability: {config.availability}")
# Update settings
client.set_server_settings(
name="MyGPU",
availability=True,
mrl=96,
on_demand=0.0001,
spot=0.00000113
)
Spot Market
# View spot offers
offers = client.spot_marketplace(server_id=6)
# Set your spot price
client.set_spot_price(order_id=39, price=0.000003)
🖥️ CLI Usage
Search Marketplace
# All servers
clore search
# Filter by GPU
clore search --gpu "RTX 4090" --max-price 5.0
# Sort and limit
clore search --sort price --limit 10
Manage Orders
# List active orders
clore orders
# Include completed
clore orders --completed
# Create new order
clore deploy 123 \
--image cloreai/ubuntu22.04-cuda12 \
--type on-demand \
--currency bitcoin \
--ssh-password mysecret \
--port 22:tcp \
--port 8888:http
# Cancel order
clore cancel 38
SSH Access
# Auto-connect to order
clore ssh 38
# Custom user
clore ssh 38 --user ubuntu
Wallets & Servers
# View balances
clore wallets
# List your servers
clore servers
# Server configuration
clore server-config "MyGPU"
Spot Market
# View spot offers
clore spot 6
# Set spot price
clore spot-price 39 0.000003
📚 API Reference
CloreAI / AsyncCloreAI
Constructor
CloreAI(
api_key: str | None = None,
base_url: str | None = None,
timeout: float = 30.0,
max_retries: int = 3
)
Methods
| Method | Description |
|---|---|
wallets() |
Get wallet balances |
marketplace(gpu?, min_gpu_count?, max_price_usd?, ...) |
Search marketplace |
my_servers() |
List your hosted servers |
server_config(name) |
Get server configuration |
my_orders(include_completed?) |
List your orders |
create_order(server_id, image, type, currency, ...) |
Create new order |
cancel_order(order_id, issue?) |
Cancel order |
spot_marketplace(server_id) |
Get spot market offers |
set_spot_price(order_id, price) |
Update spot price |
set_server_settings(name, availability?, mrl?, ...) |
Update server settings |
🔒 Error Handling
from clore_ai import CloreAI
from clore_ai.exceptions import (
CloreAPIError,
RateLimitError,
AuthError,
InvalidInputError
)
try:
client = CloreAI(api_key="invalid")
client.wallets()
except AuthError:
print("Invalid API key")
except RateLimitError:
print("Rate limited - retry with backoff")
except CloreAPIError as e:
print(f"API error: {e} (code {e.code})")
Error Codes
| Code | Exception | Description |
|---|---|---|
| 0 | — | Success |
| 1 | DBError |
Database error |
| 2 | InvalidInputError |
Invalid input |
| 3 | AuthError |
Authentication failed |
| 4 | InvalidEndpointError |
Invalid endpoint |
| 5 | RateLimitError |
Rate limit exceeded |
| 6 | FieldError |
Error in specific field |
🛠️ Development
Setup
git clone https://gitlab.com/cloreai/clore-ai-sdk.git
cd clore-ai
pip install -e ".[dev]"
Run Tests
pytest tests/ -v
Format Code
black src/ tests/
ruff check src/ tests/
mypy src/
📝 License
MIT License - see LICENSE for details.
🔗 Links
- Website: clore.ai
- API Docs: api.clore.ai
- GitHub: cloreai/clore-ai-sdk
- PyPI: pypi.org/project/clore-ai
🤝 Contributing
Contributions welcome! Please open an issue or PR.
- Fork the repo
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -am 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open Pull Request
Made with ❤️ for the Clore.ai community
Metadata
Release files for clore-ai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clore_ai-0.1.1.tar.gz | 23.1 kB | Without provenance | Details for clore_ai-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clore_ai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for clore_ai-0.1.1-py3-none-any.whl |
Total release size: 40.7 kB
Release files / clore_ai-0.1.1.tar.gz
| Download URL | clore_ai-0.1.1.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3db2bed6c0e692f3bb3bd70729c31a9ef506f8ee1508c8e81ec4646dcc5f5ff9
|
|
BLAKE2b-256 checksum How to use checksums |
448e9af4bb3a19d177bb659b9d7cc8f3ab75158c2b90d9f8e8d4890cc54439e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / clore_ai-0.1.1-py3-none-any.whl
| Download URL | clore_ai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d19af502ee3d9d20ba7d281e32ba140fe19bc834fbceea56b4aa78285193d0e6
|
|
BLAKE2b-256 checksum How to use checksums |
04c90e22f8b60062d3354a206428a3d0b0b92491ef32af07b11974fcadbd0d98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for clore-ai 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.