Skip to main content

cloro Python SDK

The official Python SDK for cloro, the API for AI answers. It returns structured JSON from eight engines: ChatGPT, Google Search, Google News, Google AI Overview, Google AI Mode, Gemini, Bing Search and Bing AI Mode (Copilot Search in Bing). cloro also runs an MCP server that exposes its monitor endpoints as tools for Claude, Codex, Cursor or your own agent.

cloro also has an official JS SDK, @cloro-dev/cloro.

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, Google News and Bing Search take a query.

client.monitor.chatgpt(prompt="...", country="US")
client.monitor.gemini(prompt="...", country="US")
client.monitor.aimode(prompt="...", country="US")           # Google AI Mode
client.monitor.bing_aimode(prompt="...", country="US")      # Bing AI Mode

client.monitor.google(query="best crm", country="US", pages=1)
client.monitor.google_news(query="acme corp", country="US")
client.monitor.bing(query="best crm", country="US")         # Bing Search

Pass include={...} to request extra formats: markdown, html, searchQueries, shopping, and more, depending on the engine.

Bing AI Mode

bing_aimode() gets the answer from Bing AI Mode. The result has text, sources and citationPills. Set include to get markdown, or html (a URL to the HTML of the page that Bing shows). Use state to target a US state. state is valid only with country="US".

res = client.monitor.bing_aimode(
    prompt="best running shoes for flat feet",
    country="US",
    state="CA",
    include={"markdown": True, "html": True},
)

print(res["result"]["text"])
for pill in res["result"]["citationPills"]:
    print(pill["citationPillId"], pill["domain"], pill["url"])

The prompt can have a maximum of 3,500 characters after URL encoding. Non-Latin scripts take more characters when encoded, so the limit for them is lower. A request costs 4 credits, plus 2 credits for a sync request and 2 credits when you set state. An async task (BING_AIMODE) does not have the 2-credit sync charge. client.countries(model="bing_aimode") gives the supported countries.

bing() gets the Bing results with the AI Overview. The result has organicResults, ads when the page has ads and, when you request it and Bing shows one, aioverview. They have the same shapes as in Google Search. Set include to get html (the results page), or aioverview. Set aioverview to True, or to {"markdown": True} to also get the AI Overview as markdown. pages (1 to 10, 2 credits for each page after the first) and first (the result to start at, default 1) select the results. Bing shows its AI summary only on the first page. Bing Search has no state or device. The country selects the Bing market.

res = client.monitor.bing(
    query="best running shoes for flat feet",
    country="US",
    include={"aioverview": {"markdown": True}},
)

for r in res["result"]["organicResults"]:
    print(r["position"], r["link"], r["title"])
if "aioverview" in res["result"]:
    print(res["result"]["aioverview"]["markdown"])

The query can have a maximum of 3,500 characters after URL encoding. Non-Latin scripts take more characters when encoded, so the limit for them is lower. A request costs 3 credits, plus 2 credits for a sync request and 2 credits when you set aioverview. An async task (BING) does not have the 2-credit sync charge. client.countries(model="bing") gives the supported countries.

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": "GEMINI", "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, AIMODE, BING_AIMODE, GOOGLE, GOOGLE_NEWS, BING.

Configuration

client = Cloro(
    api_key="sk_live_...",
    base_url="https://api.cloro.dev",  # override if needed
    timeout=320.0,                      # per-request seconds (the default)
    max_retries=2,                      # timeouts, connection errors, 429/5xx
)

A request that can charge credits twice is retried only when the server cannot have run it. A client.monitor.* call, or an async task without an idempotency_key, is retried when the connection did not open, and on a 429, 500 or 503. It is not retried after a timeout, a dropped connection, a 502 or a 504, because the server can complete the first request and charge for it. Use the async queue with an idempotency_key if you want retries in those cases.

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.countries(model="bing_aimode")
client.countries(model="bing")
client.states()                # US states for the `state` field (ChatGPT, Gemini, Bing AI Mode)
client.states(country="US")    # the same, with the country given

License

MIT

Metadata

Release files for cloro 0.6.2

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

Source distribution (sdist)

Source distribution for cloro 0.6.2
File Size Uploaded Provenance Actions
cloro-0.6.2.tar.gz 13.4 kB With provenance Details for cloro-0.6.2.tar.gz

Built distribution (wheel)

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

Total release size: 28.4 kB

Release files / cloro-0.6.2.tar.gz

Download URL cloro-0.6.2.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4e017c89548729d33df9c7bb9292a534cbc8510a02efcb72eff844c5c1c5bec1
BLAKE2b-256 checksum
How to use checksums
e6b7b8cb397bebcd23ce6f856da10932611d4938daa51a192f3a9f17a4147d6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / cloro-0.6.2-py3-none-any.whl

Download URL cloro-0.6.2-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34873005b58c65d2443b42a9675253de45ed516f7a26061074971107762a1bf9
BLAKE2b-256 checksum
How to use checksums
3272737c9e5310e52376e7496a8432f62f3e802fb21ccf47d8849db44225ca2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for cloro 0.6.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cloro-0.6.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

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.

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