Official Python SDK for the cloro API — one API for Google Search and every AI answer engine (ChatGPT, Gemini, Perplexity, Copilot, Grok, AI Overview, AI Mode).
Project description
cloro Python SDK
The official Python client for cloro — one API for Google Search and every AI answer engine (ChatGPT, Gemini, Perplexity, Copilot, Grok, AI Overview, AI Mode). Real-time, structured JSON.
Use the SDK, or just curl it — same clean response
either way. The SDK adds typed methods, sensible retries, and a polling helper
for the async task queue so you don't hand-roll it.
Installation
pip install cloro
Requires Python 3.8+.
Quickstart
from cloro import Cloro
client = Cloro(api_key="sk_live_...") # or set CLORO_API_KEY
res = client.monitor.chatgpt(
prompt="What do you know about Acme Corp?",
country="US",
include={"markdown": True},
)
print(res["result"]["text"])
for source in res["result"]["sources"]:
print(source["position"], source["url"], source["label"])
The API key is read from the CLORO_API_KEY environment variable when you don't
pass api_key=. Get a key (and 500 free credits) at
dashboard.cloro.dev.
Engines
Every engine is a method on client.monitor. AI engines take a prompt;
Google Search and Google News take a query.
client.monitor.chatgpt(prompt="...", country="US")
client.monitor.gemini(prompt="...", country="US")
client.monitor.perplexity(prompt="...", country="US")
client.monitor.copilot(prompt="...", country="US")
client.monitor.grok(prompt="...", country="US")
client.monitor.aimode(prompt="...", country="US") # Google AI Mode
client.monitor.google(query="best crm", country="US", pages=1)
client.monitor.google_news(query="acme corp", country="US")
Pass include={...} to request extra formats — markdown, html,
searchQueries, shopping, and more, depending on the engine.
Async task queue
For high-volume or long-running work, enqueue tasks and poll them to completion.
run() does create-then-wait in one call:
result = client.async_tasks.run(
task_type="CHATGPT",
payload={"prompt": "What is cloro?", "country": "US"},
)
print(result["response"]) # present once COMPLETED
print(result["credits"]) # credits reserved / charged
Prefer to manage the lifecycle yourself:
task = client.async_tasks.create(
task_type="GOOGLE",
payload={"query": "serp api", "country": "US"},
priority=5,
)
status = client.async_tasks.retrieve(task) # non-blocking snapshot
result = client.async_tasks.wait(task, timeout=120, poll_interval=2)
Batch up to 500 tasks in a single request (results preserve input order):
results = client.async_tasks.create_batch([
{"task_type": "CHATGPT", "payload": {"prompt": "q1", "country": "US"}},
{"task_type": "PERPLEXITY", "payload": {"prompt": "q2", "country": "GB"}},
])
for item in results:
if item["success"]:
client.async_tasks.wait(item["task"]["id"])
else:
print("failed:", item["error"]["message"])
Queue-wide status:
client.async_tasks.status() # queued / processing counts, concurrency usage
Valid task_type values: CHATGPT, GEMINI, PERPLEXITY, COPILOT, GROK,
AIMODE, GOOGLE, GOOGLE_NEWS.
Configuration
client = Cloro(
api_key="sk_live_...",
base_url="https://api.cloro.dev", # override if needed
timeout=60.0, # per-request seconds
max_retries=2, # timeouts, connection errors, 429/5xx
)
The client is a context manager and pools connections:
with Cloro() as client:
client.monitor.chatgpt(prompt="...", country="US")
Error handling
All errors subclass CloroError. HTTP failures map to status-specific types:
from cloro import Cloro, AuthenticationError, RateLimitError, CloroError
try:
client.monitor.chatgpt(prompt="...", country="US")
except AuthenticationError:
... # 401 — bad or missing API key
except RateLimitError as e:
... # 429 — back off and retry
except CloroError as e:
... # everything else
BadRequestError (400), PermissionDeniedError (403), NotFoundError (404),
ConflictError (409), and InternalServerError (5xx) are also available, along
with TaskFailedError / TaskTimeoutError from the poller and
APITimeoutError / APIConnectionError from the transport.
Reference data
client.countries() # supported countries
client.countries(model="chatgpt")
client.states() # US states for location-targeted Google
Links
- Docs: https://cloro.dev/docs
- API reference (OpenAPI): https://cloro.dev/docs/api-reference/openapi.json
- Dashboard: https://dashboard.cloro.dev/
- TypeScript SDK: cloro-node
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloro-0.1.0.tar.gz.
File metadata
- Download URL: cloro-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ddb70c0e8dc6d73acefebe99eca6fbd0aaf08d664f5cfce99dd294efa9cf9fd
|
|
| MD5 |
3d9627d598b33d3f306d69978f83e7c7
|
|
| BLAKE2b-256 |
163de1ab801e45f2150516db17351a87c112071c1be493e3c84b69cbd8e401a0
|
Provenance
The following attestation bundles were made for cloro-0.1.0.tar.gz:
Publisher:
publish.yml on cloro-dev/cloro-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloro-0.1.0.tar.gz -
Subject digest:
5ddb70c0e8dc6d73acefebe99eca6fbd0aaf08d664f5cfce99dd294efa9cf9fd - Sigstore transparency entry: 2156474853
- Sigstore integration time:
-
Permalink:
cloro-dev/cloro-python@76bacb6e4077f950938a9391431a6c572d35b685 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cloro-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76bacb6e4077f950938a9391431a6c572d35b685 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cloro-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cloro-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
042e7fdc0aad19984af85956b004d3513b417d74fe414df0bdf70865d468dcc3
|
|
| MD5 |
15635304339cdccfe13b5943ae57b2d5
|
|
| BLAKE2b-256 |
76da43096d888e76a7dee960516e94d02c6c6a27f344c317c14b66bf4e6e68a7
|
Provenance
The following attestation bundles were made for cloro-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on cloro-dev/cloro-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloro-0.1.0-py3-none-any.whl -
Subject digest:
042e7fdc0aad19984af85956b004d3513b417d74fe414df0bdf70865d468dcc3 - Sigstore transparency entry: 2156475075
- Sigstore integration time:
-
Permalink:
cloro-dev/cloro-python@76bacb6e4077f950938a9391431a6c572d35b685 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cloro-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76bacb6e4077f950938a9391431a6c572d35b685 -
Trigger Event:
workflow_dispatch
-
Statement type: