Using the Official clore-ai SDK
Note: This chapter previously covered building a custom SDK from scratch. With the release of the official
clore-aipackage, we recommend using it instead. The custom client approach is still documented in Clore Client Reference.
Why Use the Official SDK?
Feature
Custom CloreClient
Official clore-ai
Rate limiting
Manual time.sleep()
Built-in (1 req/sec + create_order cooldown)
Retries
Manual or tenacity
Automatic exponential backoff
Type safety
Raw dicts
Pydantic models (MarketplaceServer, Order, Wallet, etc.)
Async
Build your own
AsyncCloreAI included
CLI
None
clore search, clore deploy, clore ssh, etc.
Error handling
Generic Exception
Typed hierarchy (AuthError, RateLimitError, etc.)
Install
Copy-paste class
pip install clore-ai
Quick Migration
Before
from clore_client import CloreClient
client = CloreClient(api_key="your-key")
servers = client.get_marketplace()
cheapest = client.find_cheapest(gpu_type="RTX 4090")
order = client.create_order(server_id=cheapest["id"], image="nvidia/cuda:12.1.0-base-ubuntu22.04")
running = client.wait_for_order(order["order_id"])After
Key differences:
No
get_prefix —marketplace()notget_marketplace()Returns typed objects —
servers[0].gpu_modelnotservers[0]["gpu_array"][0]Filtering built-in — pass
gpu=,max_price_usd=directly tomarketplace()Rate limiting automatic — no need for
time.sleep()between calls
Advanced Patterns
Context Manager
Async Client
Structured Error Handling
Server Management (Hosts)
Spot Market
CLI One-Liners
Next Steps
SDK API Reference — every method, model, and exception
SDK Quick Start — 5-minute tutorial
Automation Recipes — auto-scaler, spot bot, training pipeline
CI/CD Integration — GitHub Actions, GitLab CI, Docker
Last updated
Was this helpful?