Skip to content

Commit 4ad5498

Browse files
authored
feat(ENG-1220): add monitor.bing() for Bing Search (0.5.0) (#8)
Add Bing Search (POST /v1/monitor/bing). The endpoint shipped in cloro-dev/backend#569 and cloro-dev/browsers#2117. - Add monitor.bing(query, country, include=...). include accepts html and aioverview. aioverview is True or {"markdown": True}. - Add BING to the task types of client.async_tasks. - Update the README (with the price), the CHANGELOG, the description and the keywords. The Unreleased CHANGELOG section becomes 0.5.0. - Add tests for the request and the BING task type. - Change the version from 0.4.0 to 0.5.0. Claude-Session: https://claude.ai/code/session_01Vi9vyg6uVJVBT2qvUFeKeq
1 parent 021af2c commit 4ad5498

9 files changed

Lines changed: 125 additions & 14 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ All notable changes to this project are documented here. The format follows
44
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres
55
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased]
7+
## [0.5.0]
8+
9+
### Added
10+
11+
- `client.monitor.bing()` for Bing Search, `POST /v1/monitor/bing`. It accepts
12+
`query`, `country` and `include` (`html`, and `aioverview` as `True` or
13+
`{"markdown": True}`). The result has `organicResults` and, when requested
14+
and Bing shows one, `aioverview`, in the same shapes as Google Search.
15+
- The `BING` task type for `client.async_tasks`.
816

917
### Removed
1018

‎README.md‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# cloro Python SDK
22

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

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

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

5151
```python
5252
client.monitor.chatgpt(prompt="...", country="US")
@@ -56,6 +56,7 @@ client.monitor.bing_aimode(prompt="...", country="US") # Bing AI Mode
5656

5757
client.monitor.google(query="best crm", country="US", pages=1)
5858
client.monitor.google_news(query="acme corp", country="US")
59+
client.monitor.bing(query="best crm", country="US") # Bing Search
5960
```
6061

6162
Pass `include={...}` to request extra formats: `markdown`, `html`,
@@ -87,6 +88,34 @@ request costs 4 credits, plus 2 credits for a sync request and 2 credits when
8788
you set `state`. An async task (`BING_AIMODE`) does not have the 2-credit sync
8889
charge. `client.countries(model="bing_aimode")` gives the supported countries.
8990

91+
### Bing Search
92+
93+
`bing()` gets the Bing results with the AI Overview. The result has
94+
`organicResults` and, when you request it and Bing shows one, `aioverview`.
95+
Both have the same shape as in Google Search. Set `include` to get `html` (the
96+
results page), or `aioverview`. Set `aioverview` to `True`, or to
97+
`{"markdown": True}` to also get the AI Overview as markdown. Bing Search has no
98+
`state`, `device` or `pages`. The country selects the Bing market.
99+
100+
```python
101+
res = client.monitor.bing(
102+
query="best running shoes for flat feet",
103+
country="US",
104+
include={"aioverview": {"markdown": True}},
105+
)
106+
107+
for r in res["result"]["organicResults"]:
108+
print(r["position"], r["link"], r["title"])
109+
if "aioverview" in res["result"]:
110+
print(res["result"]["aioverview"]["markdown"])
111+
```
112+
113+
The query can have a maximum of 3,500 characters after URL encoding. Non-Latin
114+
scripts take more characters when encoded, so the limit for them is lower. A
115+
request costs 3 credits, plus 2 credits for a sync request and 2 credits when
116+
you set `aioverview`. An async task (`BING`) does not have the 2-credit sync
117+
charge. `client.countries(model="bing")` gives the supported countries.
118+
90119
## Async task queue
91120

92121
For high-volume or long-running work, enqueue tasks and poll them to completion.
@@ -134,7 +163,7 @@ client.async_tasks.status() # queued / processing counts, concurrency usage
134163
```
135164

136165
Valid `task_type` values: `CHATGPT`, `GEMINI`, `AIMODE`, `BING_AIMODE`,
137-
`GOOGLE`, `GOOGLE_NEWS`.
166+
`GOOGLE`, `GOOGLE_NEWS`, `BING`.
138167

139168
## Configuration
140169

@@ -182,6 +211,7 @@ with `TaskFailedError` / `TaskTimeoutError` from the poller and
182211
client.countries() # supported countries
183212
client.countries(model="chatgpt")
184213
client.countries(model="bing_aimode")
214+
client.countries(model="bing")
185215
client.states() # US states for location-targeted Google
186216
```
187217

‎pyproject.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
55
[project]
66
name = "cloro"
77
dynamic = ["version"]
8-
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)."
8+
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)."
99
readme = "README.md"
1010
requires-python = ">=3.8"
1111
license = { text = "MIT" }
@@ -19,6 +19,7 @@ keywords = [
1919
"gemini",
2020
"bing",
2121
"google search",
22+
"bing search",
2223
"web scraping",
2324
"seo",
2425
"geo",

‎src/cloro/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""cloro — the official Python SDK.
22
3-
One API for Google Search and every AI answer engine (ChatGPT, Gemini,
4-
AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.
3+
One API for Google Search, Bing Search and every AI answer engine (ChatGPT,
4+
Gemini, AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.
55
66
from cloro import Cloro
77

‎src/cloro/_client.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def _make_status_error(response: httpx.Response) -> APIStatusError:
8686
class Cloro:
8787
"""Client for the cloro API.
8888
89-
One API for Google Search and every AI answer engine (ChatGPT, Gemini,
90-
AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.
89+
One API for Google Search, Bing Search and every AI answer engine (ChatGPT,
90+
Gemini, AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.
9191
9292
Args:
9393
api_key: Your cloro API key (``sk_live_...``). Falls back to the

‎src/cloro/_version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.4.0"
1+
__version__ = "0.5.0"

‎src/cloro/resources/async_tasks.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def create(
8888
8989
Args:
9090
task_type: One of ``CHATGPT``, ``GEMINI``, ``AIMODE``, ``BING_AIMODE``,
91-
``GOOGLE``, ``GOOGLE_NEWS``.
91+
``GOOGLE``, ``GOOGLE_NEWS``, ``BING``.
9292
payload: Provider-specific body (e.g. ``{"prompt": ..., "country": ...}``,
93-
or ``{"query": ..., "country": ...}`` for Google Search).
93+
or ``{"query": ..., "country": ...}`` for Google Search and Bing Search).
9494
priority: 1-10, higher runs first (default 1).
9595
idempotency_key: Unique string to dedupe task creation.
9696
webhook: ``{"url": ...}`` to be notified on completion.

‎src/cloro/resources/monitor.py‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Synchronous monitor endpoints — one call per AI engine or Google Search."""
1+
"""Synchronous monitor endpoints — one call per AI engine, Google Search or Bing Search."""
22
from __future__ import annotations
33

44
from typing import TYPE_CHECKING, Any, Dict, Optional
@@ -108,3 +108,19 @@ def google_news(
108108
"/v1/monitor/google/news",
109109
{"query": query, "country": country, "include": include, **extra},
110110
)
111+
112+
# -- Bing Search (query-based) --------------------------------------
113+
114+
def bing(
115+
self, query: str, country: str, *, include: Optional[Dict[str, Any]] = None, **extra: Any
116+
) -> Any:
117+
"""Monitor Bing Search (SERP). ``POST /v1/monitor/bing``.
118+
119+
The query can have a maximum of 3,500 characters after URL encoding.
120+
The country selects the Bing market. ``include`` accepts ``html`` and
121+
``aioverview``. ``aioverview`` is ``True`` or ``{"markdown": True}``.
122+
"""
123+
return self._run(
124+
"/v1/monitor/bing",
125+
{"query": query, "country": country, "include": include, **extra},
126+
)

‎tests/test_client.py‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,62 @@ def handler(request: httpx.Request) -> httpx.Response:
152152
assert seen["url"] == "https://api.cloro.dev/v1/countries?model=bing_aimode"
153153

154154

155+
def test_monitor_bing_request_and_response():
156+
seen = {}
157+
158+
def handler(request: httpx.Request) -> httpx.Response:
159+
seen["url"] = str(request.url)
160+
seen["body"] = json.loads(request.content)
161+
return httpx.Response(
162+
200,
163+
json={
164+
"success": True,
165+
"result": {
166+
"organicResults": [
167+
{"position": 1, "title": "A", "link": "https://a.example",
168+
"displayedLink": "a.example", "snippet": "s", "page": 1}
169+
],
170+
"aioverview": {"text": "hi", "sources": [], "markdown": "hi"},
171+
},
172+
},
173+
)
174+
175+
client = make_client(handler)
176+
res = client.monitor.bing(
177+
query="best crm", country="US", include={"html": True, "aioverview": {"markdown": True}}
178+
)
179+
180+
assert seen["url"] == "https://api.cloro.dev/v1/monitor/bing"
181+
assert seen["body"] == {
182+
"query": "best crm",
183+
"country": "US",
184+
"include": {"html": True, "aioverview": {"markdown": True}},
185+
}
186+
assert res["result"]["organicResults"][0]["link"] == "https://a.example"
187+
assert res["result"]["aioverview"]["markdown"] == "hi"
188+
189+
190+
def test_async_create_bing_task():
191+
seen = {}
192+
193+
def handler(request: httpx.Request) -> httpx.Response:
194+
seen["body"] = json.loads(request.content)
195+
return httpx.Response(
196+
200,
197+
json={
198+
"success": True,
199+
"task": {"id": "t-3", "taskType": "BING", "status": "QUEUED",
200+
"priority": 1, "createdAt": "2026-11-21T12:00:00.000Z"},
201+
"credits": {"creditsToCharge": 3, "creditsCharged": None},
202+
},
203+
)
204+
205+
client = make_client(handler)
206+
task = client.async_tasks.create(task_type="BING", payload={"query": "x", "country": "US"})
207+
assert seen["body"] == {"taskType": "BING", "payload": {"query": "x", "country": "US"}}
208+
assert task.task_type == "BING"
209+
210+
155211
def test_discontinued_engines_are_not_exposed():
156212
client = Cloro(api_key="sk_test")
157213
assert not hasattr(client.monitor, "copilot")

0 commit comments

Comments
 (0)