Skip to content
Open
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: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ 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).

## [0.7.0]

### Added

- `client.monitor.meta_ai()` for Meta AI, `POST /v1/monitor/meta-ai`. It
accepts `prompt` (up to 10,000 characters), `country`, an optional US
`state` and `include` (`markdown`, `html`). The result has `text`, `sources`
and `citationPills`.
- The `META_AI` task type for `client.async_tasks`.

## [0.6.1]

### Changed
Expand Down
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# cloro Python SDK

The official Python SDK for [**cloro**](https://cloro.dev), 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](https://cloro.dev/docs/integrations/mcp) that exposes
It returns structured JSON from nine engines: ChatGPT, Google Search, Google News,
Google AI Overview, Google AI Mode, Gemini, Bing Search, Bing AI Mode (Copilot
Search in Bing) and Meta AI. 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.

cloro also has an official JS SDK,
Expand Down Expand Up @@ -53,6 +53,7 @@ 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.meta_ai(prompt="...", country="US") # Meta AI

client.monitor.google(query="best crm", country="US", pages=1)
client.monitor.google_news(query="acme corp", country="US")
Expand Down Expand Up @@ -88,6 +89,33 @@ 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.

### Meta AI

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

```python
res = client.monitor.meta_ai(
prompt="which crm do small agencies use most?",
country="US",
include={"markdown": 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 10,000 characters. A request costs 4 credits,
plus 2 credits for a sync request and 2 credits when you set `state`. An async
task (`META_AI`) does not have the 2-credit sync charge. Meta AI is not
available in CN and RU. `client.countries(model="meta_ai")` gives the supported
countries. Meta AI answers without a login, and it gives no answer to some
product prompts (for example "best X"). Those requests fail, and a retry does
not help.

### Bing Search

`bing()` gets the Bing results with the AI Overview. The result has
Expand Down Expand Up @@ -165,7 +193,7 @@ client.async_tasks.status() # queued / processing counts, concurrency usage
```

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

## Configuration

Expand Down Expand Up @@ -214,6 +242,7 @@ client.countries() # supported countries
client.countries(model="chatgpt")
client.countries(model="bing_aimode")
client.countries(model="bing")
client.countries(model="meta_ai")
client.states() # US states for location-targeted Google
```

Expand Down
2 changes: 1 addition & 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 cloro, the API for AI answers: ChatGPT, Google Search, Google News, Google AI Overview, Google AI Mode, Gemini, Bing Search and Bing AI Mode."
description = "Official Python SDK for cloro, the API for AI answers: ChatGPT, Google Search, Google News, Google AI Overview, Google AI Mode, Gemini, Bing Search, Bing AI Mode and Meta AI."
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
Expand Down
2 changes: 1 addition & 1 deletion 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, Bing Search and every AI answer engine (ChatGPT,
Gemini, AI Overview, Google AI Mode, Bing AI Mode). Real-time, structured JSON.
Gemini, AI Overview, Google AI Mode, Bing AI Mode, Meta AI). Real-time, structured JSON.

from cloro import Cloro

Expand Down
2 changes: 1 addition & 1 deletion src/cloro/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Cloro:
"""Client 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). Real-time, structured JSON.
Gemini, AI Overview, Google AI Mode, Bing AI Mode, Meta AI). 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.6.1"
__version__ = "0.7.0"
2 changes: 1 addition & 1 deletion src/cloro/resources/async_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def create(

Args:
task_type: One of ``CHATGPT``, ``GEMINI``, ``AIMODE``, ``BING_AIMODE``,
``GOOGLE``, ``GOOGLE_NEWS``, ``BING``.
``GOOGLE``, ``GOOGLE_NEWS``, ``BING``, ``META_AI``.
payload: Provider-specific body (e.g. ``{"prompt": ..., "country": ...}``,
or ``{"query": ..., "country": ...}`` for Google Search and Bing Search).
priority: 1-10, higher runs first (default 1).
Expand Down
20 changes: 20 additions & 0 deletions src/cloro/resources/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ def bing_aimode(
{"prompt": prompt, "country": country, "state": state, "include": include, **extra},
)

def meta_ai(
self,
prompt: str,
country: str,
*,
state: Optional[str] = None,
include: Optional[Dict[str, bool]] = None,
**extra: Any,
) -> Any:
"""Monitor Meta AI. ``POST /v1/monitor/meta-ai``.

The prompt can have a maximum of 10,000 characters. Meta AI is not
available in CN and RU. ``state`` is a US state code and is valid only
with ``country="US"``. ``include`` accepts ``markdown`` and ``html``.
"""
return self._run(
"/v1/monitor/meta-ai",
{"prompt": prompt, "country": country, "state": state, "include": include, **extra},
)

# -- Google Search (query-based) ------------------------------------

def google(
Expand Down
83 changes: 83 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,89 @@ def handler(request: httpx.Request) -> httpx.Response:
assert seen["url"] == "https://api.cloro.dev/v1/countries?model=bing_aimode"


def test_monitor_meta_ai_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": {
"text": "hi",
"sources": [{"position": 1, "label": "A", "url": "https://a.example"}],
"citationPills": [
{"position": 1, "label": "A", "url": "https://a.example",
"domain": "a.example", "citationPillId": 1}
],
},
},
)

client = make_client(handler)
res = client.monitor.meta_ai(
prompt="hello", country="US", state="CA", include={"markdown": True, "html": True}
)

assert seen["url"] == "https://api.cloro.dev/v1/monitor/meta-ai"
assert seen["body"] == {
"prompt": "hello",
"country": "US",
"state": "CA",
"include": {"markdown": True, "html": True},
}
assert res["result"]["citationPills"][0]["citationPillId"] == 1


def test_monitor_meta_ai_drops_unset_state():
seen = {}

def handler(request: httpx.Request) -> httpx.Response:
seen["body"] = json.loads(request.content)
return httpx.Response(200, json={"success": True, "result": {}})

client = make_client(handler)
client.monitor.meta_ai(prompt="x", country="GB")
assert seen["body"] == {"prompt": "x", "country": "GB"}


def test_async_create_meta_ai_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-4", "taskType": "META_AI", "status": "QUEUED",
"priority": 1, "createdAt": "2026-11-28T12:00:00.000Z"},
"credits": {"creditsToCharge": 4, "creditsCharged": None},
},
)

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


def test_countries_for_meta_ai():
seen = {}

def handler(request: httpx.Request) -> httpx.Response:
seen["url"] = str(request.url)
return httpx.Response(200, json=["US", "GB"])

client = make_client(handler)
client.countries(model="meta_ai")
assert seen["url"] == "https://api.cloro.dev/v1/countries?model=meta_ai"


def test_monitor_bing_request_and_response():
seen = {}

Expand Down