diff --git a/CHANGELOG.md b/CHANGELOG.md index 47639b2..8cead0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index f2f40c4..397d7f3 100644 --- a/README.md +++ b/README.md @@ -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, @@ -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") @@ -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 @@ -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 @@ -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 ``` diff --git a/pyproject.toml b/pyproject.toml index b09086c..552e6a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" } diff --git a/src/cloro/__init__.py b/src/cloro/__init__.py index 9c24683..6009262 100644 --- a/src/cloro/__init__.py +++ b/src/cloro/__init__.py @@ -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 diff --git a/src/cloro/_client.py b/src/cloro/_client.py index 51ee642..5109a39 100644 --- a/src/cloro/_client.py +++ b/src/cloro/_client.py @@ -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 diff --git a/src/cloro/_version.py b/src/cloro/_version.py index 43c4ab0..49e0fc1 100644 --- a/src/cloro/_version.py +++ b/src/cloro/_version.py @@ -1 +1 @@ -__version__ = "0.6.1" +__version__ = "0.7.0" diff --git a/src/cloro/resources/async_tasks.py b/src/cloro/resources/async_tasks.py index 96e5ae7..8adfec0 100644 --- a/src/cloro/resources/async_tasks.py +++ b/src/cloro/resources/async_tasks.py @@ -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). diff --git a/src/cloro/resources/monitor.py b/src/cloro/resources/monitor.py index 0791241..62a5221 100644 --- a/src/cloro/resources/monitor.py +++ b/src/cloro/resources/monitor.py @@ -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( diff --git a/tests/test_client.py b/tests/test_client.py index e16517a..b2ee998 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -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 = {}