Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ All notable changes to this project are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.5.0]

### Added

- `client.monitor.bing()` for Bing Search, `POST /v1/monitor/bing`. It accepts
`query`, `country` and `include` (`html`, and `aioverview` as `True` or
`{"markdown": True}`). The result has `organicResults` and, when requested
and Bing shows one, `aioverview`, in the same shapes as Google Search.
- The `BING` task type for `client.async_tasks`.

### Removed

Expand Down
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# cloro Python SDK

The official Python SDK for [**cloro**](https://cloro.dev), the API for Google Search
and AI answers. It gives you a Google SERP API, a Google News API, and answers from
ChatGPT, Gemini, Google AI Mode, Bing AI Mode and Google AI Overview. cloro
and AI answers. It gives you a Google SERP API, a Google News API, a Bing SERP API,
and answers from ChatGPT, Gemini, Google AI Mode, Bing AI Mode and Google AI Overview. cloro
also runs an [MCP server](https://cloro.dev/docs/integrations/mcp) that exposes
its monitor endpoints as tools for Claude, Codex, Cursor or your own agent.

Expand Down Expand Up @@ -46,7 +46,7 @@ pass `api_key=`. Get a key (and 500 free credits) at
## Engines

Every engine is a method on `client.monitor`. AI engines take a `prompt`;
Google Search and Google News take a `query`.
Google Search, Google News and Bing Search take a `query`.

```python
client.monitor.chatgpt(prompt="...", country="US")
Expand All @@ -56,6 +56,7 @@ 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`,
Expand Down Expand Up @@ -87,6 +88,34 @@ 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 Search

`bing()` gets the Bing results with the AI Overview. The result has
`organicResults` and, when you request it and Bing shows one, `aioverview`.
Both have the same shape 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. Bing Search has no
`state`, `device` or `pages`. The country selects the Bing market.

```python
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.
Expand Down Expand Up @@ -134,7 +163,7 @@ client.async_tasks.status() # queued / processing counts, concurrency usage
```

Valid `task_type` values: `CHATGPT`, `GEMINI`, `AIMODE`, `BING_AIMODE`,
`GOOGLE`, `GOOGLE_NEWS`.
`GOOGLE`, `GOOGLE_NEWS`, `BING`.

## Configuration

Expand Down Expand Up @@ -182,6 +211,7 @@ with `TaskFailedError` / `TaskTimeoutError` from the poller and
client.countries() # supported countries
client.countries(model="chatgpt")
client.countries(model="bing_aimode")
client.countries(model="bing")
client.states() # US states for location-targeted Google
```

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "cloro"
dynamic = ["version"]
description = "Official Python SDK for the cloro API: one API for Google Search and every AI answer engine (ChatGPT, Gemini, AI Overview, Google AI Mode, Bing AI Mode)."
description = "Official Python SDK for the cloro API: one API for Google Search, Bing Search and every AI answer engine (ChatGPT, Gemini, AI Overview, Google AI Mode, Bing AI Mode)."
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
Expand All @@ -19,6 +19,7 @@ keywords = [
"gemini",
"bing",
"google search",
"bing search",
"web scraping",
"seo",
"geo",
Expand Down
4 changes: 2 additions & 2 deletions src/cloro/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""cloro — the official Python SDK.

One API for Google Search and every AI answer engine (ChatGPT, Gemini,
AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.
One API for Google Search, Bing Search and every AI answer engine (ChatGPT,
Gemini, AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.

from cloro import Cloro

Expand Down
4 changes: 2 additions & 2 deletions src/cloro/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def _make_status_error(response: httpx.Response) -> APIStatusError:
class Cloro:
"""Client for the cloro API.

One API for Google Search and every AI answer engine (ChatGPT, Gemini,
AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.
One API for Google Search, Bing Search and every AI answer engine (ChatGPT,
Gemini, AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.

Args:
api_key: Your cloro API key (``sk_live_...``). Falls back to the
Expand Down
2 changes: 1 addition & 1 deletion src/cloro/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.0"
__version__ = "0.5.0"
4 changes: 2 additions & 2 deletions src/cloro/resources/async_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def create(

Args:
task_type: One of ``CHATGPT``, ``GEMINI``, ``AIMODE``, ``BING_AIMODE``,
``GOOGLE``, ``GOOGLE_NEWS``.
``GOOGLE``, ``GOOGLE_NEWS``, ``BING``.
payload: Provider-specific body (e.g. ``{"prompt": ..., "country": ...}``,
or ``{"query": ..., "country": ...}`` for Google Search).
or ``{"query": ..., "country": ...}`` for Google Search and Bing Search).
priority: 1-10, higher runs first (default 1).
idempotency_key: Unique string to dedupe task creation.
webhook: ``{"url": ...}`` to be notified on completion.
Expand Down
18 changes: 17 additions & 1 deletion src/cloro/resources/monitor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Synchronous monitor endpoints — one call per AI engine or Google Search."""
"""Synchronous monitor endpoints — one call per AI engine, Google Search or Bing Search."""
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Dict, Optional
Expand Down Expand Up @@ -108,3 +108,19 @@ def google_news(
"/v1/monitor/google/news",
{"query": query, "country": country, "include": include, **extra},
)

# -- Bing Search (query-based) --------------------------------------

def bing(
self, query: str, country: str, *, include: Optional[Dict[str, Any]] = None, **extra: Any
) -> Any:
"""Monitor Bing Search (SERP). ``POST /v1/monitor/bing``.

The query can have a maximum of 3,500 characters after URL encoding.
The country selects the Bing market. ``include`` accepts ``html`` and
``aioverview``. ``aioverview`` is ``True`` or ``{"markdown": True}``.
"""
return self._run(
"/v1/monitor/bing",
{"query": query, "country": country, "include": include, **extra},
)
56 changes: 56 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,62 @@ def handler(request: httpx.Request) -> httpx.Response:
assert seen["url"] == "https://api.cloro.dev/v1/countries?model=bing_aimode"


def test_monitor_bing_request_and_response():
seen = {}

def handler(request: httpx.Request) -> httpx.Response:
seen["url"] = str(request.url)
seen["body"] = json.loads(request.content)
return httpx.Response(
200,
json={
"success": True,
"result": {
"organicResults": [
{"position": 1, "title": "A", "link": "https://a.example",
"displayedLink": "a.example", "snippet": "s", "page": 1}
],
"aioverview": {"text": "hi", "sources": [], "markdown": "hi"},
},
},
)

client = make_client(handler)
res = client.monitor.bing(
query="best crm", country="US", include={"html": True, "aioverview": {"markdown": True}}
)

assert seen["url"] == "https://api.cloro.dev/v1/monitor/bing"
assert seen["body"] == {
"query": "best crm",
"country": "US",
"include": {"html": True, "aioverview": {"markdown": True}},
}
assert res["result"]["organicResults"][0]["link"] == "https://a.example"
assert res["result"]["aioverview"]["markdown"] == "hi"


def test_async_create_bing_task():
seen = {}

def handler(request: httpx.Request) -> httpx.Response:
seen["body"] = json.loads(request.content)
return httpx.Response(
200,
json={
"success": True,
"task": {"id": "t-3", "taskType": "BING", "status": "QUEUED",
"priority": 1, "createdAt": "2026-11-21T12:00:00.000Z"},
"credits": {"creditsToCharge": 3, "creditsCharged": None},
},
)

client = make_client(handler)
task = client.async_tasks.create(task_type="BING", payload={"query": "x", "country": "US"})
assert seen["body"] == {"taskType": "BING", "payload": {"query": "x", "country": "US"}}
assert task.task_type == "BING"


def test_discontinued_engines_are_not_exposed():
client = Cloro(api_key="sk_test")
assert not hasattr(client.monitor, "copilot")
Expand Down
Loading