Python SDK Quick Start

Get up and running with the official clore-ai Python SDK in under 5 minutes. By the end of this guide, you'll search the GPU marketplace, create an order, and manage it — all from Python and the terminal.


Step 1: Install the SDK

pip install clore-ai

Verify the installation:

clore --version

Step 2: Get Your API Key

  1. Go to clore.aiarrow-up-right and sign in

  2. Navigate to your profile / API settings

  3. Copy your API key

Set it up (choose one):

# Option A: Environment variable (recommended)
export CLORE_API_KEY=your_api_key_here

# Option B: CLI config (persistent)
clore config set api_key YOUR_API_KEY

Step 3: Your First Script

Create a file called my_first_gpu.py:

Run it:


Step 4: Using the CLI

You can do the same operations from the terminal without writing any Python.

Search the marketplace

Deploy a server

List orders

SSH into your instance

Cancel an order

Check balances

Spot market


Step 5: Async Operations

For advanced use cases (concurrent API calls, integration with async frameworks), use the AsyncCloreAI client:


Troubleshooting

AuthError: API key required for this endpoint

Your API key isn't being found. Check:

Fix: set the key in your environment or pass it directly:

RateLimitError: Rate limit exceeded

The SDK auto-retries with exponential backoff up to max_retries times. If you still hit this, you're making too many requests. The built-in rate limiter enforces 1 req/sec — avoid creating your own parallel loops that bypass it.

InvalidInputError when creating an order

Double-check:

  • server_id exists and is available (check marketplace() first)

  • image is a valid Docker image

  • type is exactly "on-demand" or "spot"

  • currency is a valid payment method (e.g. "bitcoin", "CLORE-Blockchain")

  • For spot orders, spot_price must be set

Connection refused when using clore ssh

The server might still be starting up. Wait 30–60 seconds after order creation and try again. Check the order status:

ModuleNotFoundError: No module named 'clore_ai'

Make sure you installed the SDK in the right Python environment:


What's Next?

📚 See also: Clore.ai Python SDK — Automate Your GPU Workflows in 5 Minutesarrow-up-right

Last updated

Was this helpful?