From ce777063ef4e45d6f00cb77d85d239137b677691 Mon Sep 17 00:00:00 2001 From: Ricardo Batista <138892976+rbatista191@users.noreply.github.com> Date: Thu, 5 Nov 2026 23:20:57 +0100 Subject: [PATCH] feat!: remove Copilot, Perplexity and Grok --- CHANGELOG.md | 13 + README.md | 10 +- openapi.json | 3634 +++++++--------------------- pyproject.toml | 4 +- src/cloro/__init__.py | 2 +- src/cloro/_client.py | 2 +- src/cloro/_version.py | 2 +- src/cloro/resources/async_tasks.py | 4 +- src/cloro/resources/monitor.py | 18 - tests/test_client.py | 6 + 10 files changed, 872 insertions(+), 2823 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb53c8..341ec62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ 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.3.0] + +### Removed + +- `client.monitor.copilot()`, `client.monitor.perplexity()`, and the `COPILOT` + and `PERPLEXITY` task types. This is a breaking change. Copilot and + Perplexity now block access for logged-out sessions. cloro uses logged-out + sessions, so it cannot get their answers. The API now rejects + `/v1/monitor/copilot` and `/v1/monitor/perplexity` with a `400` + (`MODEL_UNAVAILABLE`). These requests cost no credits. +- The Copilot, Perplexity, and Grok paths, schemas, and enum values from the + vendored `openapi.json`. + ## [0.2.0] ### Removed diff --git a/README.md b/README.md index a3f9d6f..d67db38 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 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, Perplexity, Gemini, Copilot, Google AI Mode and Google AI Overview. cloro +ChatGPT, Gemini, Google 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. @@ -51,8 +51,6 @@ Google Search and Google News take a `query`. ```python client.monitor.chatgpt(prompt="...", country="US") client.monitor.gemini(prompt="...", country="US") -client.monitor.perplexity(prompt="...", country="US") -client.monitor.copilot(prompt="...", country="US") client.monitor.aimode(prompt="...", country="US") # Google AI Mode client.monitor.google(query="best crm", country="US", pages=1) @@ -93,7 +91,7 @@ Batch up to 500 tasks in a single request (results preserve input order): ```python results = client.async_tasks.create_batch([ {"task_type": "CHATGPT", "payload": {"prompt": "q1", "country": "US"}}, - {"task_type": "PERPLEXITY", "payload": {"prompt": "q2", "country": "GB"}}, + {"task_type": "GEMINI", "payload": {"prompt": "q2", "country": "GB"}}, ]) for item in results: if item["success"]: @@ -108,8 +106,8 @@ Queue-wide status: client.async_tasks.status() # queued / processing counts, concurrency usage ``` -Valid `task_type` values: `CHATGPT`, `GEMINI`, `PERPLEXITY`, `COPILOT`, `AIMODE`, -`GOOGLE`, `GOOGLE_NEWS`. +Valid `task_type` values: `CHATGPT`, `GEMINI`, `AIMODE`, `GOOGLE`, +`GOOGLE_NEWS`. ## Configuration diff --git a/openapi.json b/openapi.json index a68a816..2d9b2dc 100644 --- a/openapi.json +++ b/openapi.json @@ -408,17 +408,17 @@ } } }, - "/v1/monitor/grok": { + "/v1/monitor/google": { "post": { - "summary": "Monitor Grok Responses", - "description": "Extract structured data from Grok — answer text and cited sources, including X/Twitter references — for any prompt across supported regions", - "operationId": "monitorGrok", + "summary": "Monitor Google Search Results", + "description": "Extract structured data from Google Search including organic results, People Also Ask, related searches, and optional AI Overview", + "operationId": "monitorGoogle", "requestBody": { - "description": "Request parameters for monitoring Grok responses", + "description": "Request parameters for monitoring Google search results", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GrokMonitorRequest" + "$ref": "#/components/schemas/GoogleMonitorRequest" } } }, @@ -426,7 +426,7 @@ }, "responses": { "200": { - "description": "successful Grok monitoring response", + "description": "successful Google monitoring response", "headers": { "X-Concurrent-Limit": { "description": "Maximum number of concurrent requests allowed", @@ -453,7 +453,7 @@ "description": "Number of credits remaining in user account", "schema": { "type": "integer", - "example": 4 + "example": 997 } }, "X-Credits-Charged": { @@ -467,13 +467,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GrokMonitorResponse" + "$ref": "#/components/schemas/GoogleMonitorResponse" } } } }, "400": { - "description": "Bad Request - Validation error", + "description": "Bad Request - Invalid parameters", "content": { "application/json": { "schema": { @@ -483,7 +483,7 @@ } }, "401": { - "description": "Unauthorized - Authentication error", + "description": "Unauthorized - Invalid or missing API key", "content": { "application/json": { "schema": { @@ -493,7 +493,7 @@ } }, "403": { - "description": "Forbidden - Insufficient permissions or credits", + "description": "Forbidden - Insufficient credits or access denied", "content": { "application/json": { "schema": { @@ -602,17 +602,17 @@ } } }, - "/v1/monitor/google": { + "/v1/monitor/google/news": { "post": { - "summary": "Monitor Google Search Results", - "description": "Extract structured data from Google Search including organic results, People Also Ask, related searches, and optional AI Overview", - "operationId": "monitorGoogle", + "summary": "Monitor Google News Results", + "description": "Extract structured news articles from Google News including titles, links, snippets, sources, dates, and thumbnails", + "operationId": "monitorGoogleNews", "requestBody": { - "description": "Request parameters for monitoring Google search results", + "description": "Request parameters for monitoring Google News results", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GoogleMonitorRequest" + "$ref": "#/components/schemas/GoogleNewsMonitorRequest" } } }, @@ -620,7 +620,7 @@ }, "responses": { "200": { - "description": "successful Google monitoring response", + "description": "successful Google News monitoring response", "headers": { "X-Concurrent-Limit": { "description": "Maximum number of concurrent requests allowed", @@ -661,7 +661,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GoogleMonitorResponse" + "$ref": "#/components/schemas/GoogleNewsMonitorResponse" } } } @@ -796,17 +796,17 @@ } } }, - "/v1/monitor/google/news": { + "/v1/monitor/aimode": { "post": { - "summary": "Monitor Google News Results", - "description": "Extract structured news articles from Google News including titles, links, snippets, sources, dates, and thumbnails", - "operationId": "monitorGoogleNews", + "summary": "Monitor AI Mode Responses", + "description": "Extract structured data from AI Mode about your brand, products, or any topic across various regions", + "operationId": "monitorAiMode", "requestBody": { - "description": "Request parameters for monitoring Google News results", + "description": "Request parameters for monitoring AI Mode responses", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GoogleNewsMonitorRequest" + "$ref": "#/components/schemas/AiModeMonitorRequest" } } }, @@ -814,7 +814,7 @@ }, "responses": { "200": { - "description": "successful Google News monitoring response", + "description": "successful AI Mode monitoring response", "headers": { "X-Concurrent-Limit": { "description": "Maximum number of concurrent requests allowed", @@ -841,27 +841,27 @@ "description": "Number of credits remaining in user account", "schema": { "type": "integer", - "example": 997 + "example": 4 } }, "X-Credits-Charged": { "description": "Number of credits charged for this request", "schema": { "type": "integer", - "example": 3 + "example": 5 } } }, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GoogleNewsMonitorResponse" + "$ref": "#/components/schemas/AiModeMonitorResponse" } } } }, "400": { - "description": "Bad Request - Invalid parameters", + "description": "Bad Request - Validation error", "content": { "application/json": { "schema": { @@ -871,7 +871,7 @@ } }, "401": { - "description": "Unauthorized - Invalid or missing API key", + "description": "Unauthorized - Authentication error", "content": { "application/json": { "schema": { @@ -881,7 +881,7 @@ } }, "403": { - "description": "Forbidden - Insufficient credits or access denied", + "description": "Forbidden - Insufficient permissions or credits", "content": { "application/json": { "schema": { @@ -990,72 +990,51 @@ } } }, - "/v1/monitor/copilot": { - "post": { - "summary": "Monitor Copilot Responses", - "description": "Extract structured data from Microsoft Copilot about your brand, products, or any topic across various regions", - "operationId": "monitorCopilot", - "requestBody": { - "description": "Request parameters for monitoring Copilot responses", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CopilotMonitorRequest" - } - } - }, - "required": true - }, + "/v1/countries": { + "get": { + "summary": "List of countries", + "description": "Returns a list of all supported ISO 3166-1 alpha-2 country codes. Can be filtered by model to get countries available for specific AI providers.", + "operationId": "getCountries", + "parameters": [ + { + "name": "model", + "in": "query", + "description": "Filter countries available for a specific model", + "schema": { + "type": "string", + "enum": [ + "aimode", + "chatgpt", + "gemini", + "google" + ] + }, + "example": "chatgpt" + } + ], "responses": { "200": { - "description": "successful Copilot monitoring response", - "headers": { - "X-Concurrent-Limit": { - "description": "Maximum number of concurrent requests allowed", - "schema": { - "type": "integer", - "example": 10 - } - }, - "X-Concurrent-Current": { - "description": "Current number of concurrent requests", - "schema": { - "type": "integer", - "example": 3 - } - }, - "X-Concurrent-Remaining": { - "description": "Number of remaining concurrent slots available", - "schema": { - "type": "integer", - "example": 7 - } - }, - "X-Credits-Remaining": { - "description": "Number of credits remaining in user account", - "schema": { - "type": "integer", - "example": 4 - } - }, - "X-Credits-Charged": { - "description": "Number of credits charged for this request", - "schema": { - "type": "integer", - "example": 5 - } - } - }, + "description": "List of supported country codes", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CopilotMonitorResponse" + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "AF", + "AX", + "AL", + "DZ", + "AS" + ] } } } }, "400": { - "description": "Bad Request - Validation error", + "description": "Bad Request - Invalid model parameter", "content": { "application/json": { "schema": { @@ -1074,16 +1053,6 @@ } } }, - "403": { - "description": "Forbidden - Insufficient permissions or credits", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ForbiddenError" - } - } - } - }, "404": { "description": "Not Found - Route not found", "content": { @@ -1094,162 +1063,187 @@ } } }, - "409": { - "description": "Conflict - Resource conflict", + "500": { + "description": "Internal Server Error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ConflictError" + "$ref": "#/components/schemas/InternalError" } } } - }, - "429": { - "description": "Too Many Requests", - "headers": { - "X-Concurrent-Limit": { - "description": "Maximum number of concurrent requests allowed", - "schema": { - "type": "integer", - "example": 10 - } - }, - "X-Concurrent-Current": { - "description": "Current number of concurrent requests", - "schema": { - "type": "integer", - "example": 11 - } - }, - "X-Concurrent-Remaining": { - "description": "Number of remaining concurrent slots available", - "schema": { - "type": "integer", - "example": 0 - } + } + } + } + }, + "/v1/async/task": { + "post": { + "summary": "Create async task", + "description": "Submit an asynchronous task for background processing. Returns a task ID that you can use to poll for results or receive via webhook.", + "operationId": "createAsyncTask", + "security": [ + { + "bearerAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BatchTaskRequest" }, - "X-Credits-Remaining": { - "description": "Number of credits remaining in user account", - "schema": { - "type": "integer", - "example": 4 + "example": { + "taskType": "CHATGPT", + "priority": 5, + "idempotencyKey": "your-custom-identifier-123", + "webhook": { + "url": "https://your-app.com/webhook-handler" + }, + "payload": { + "prompt": "What is the weather in New York?", + "country": "US" } - }, - "X-Credits-Charged": { - "description": "Number of credits charged for this request", + } + } + } + }, + "responses": { + "200": { + "description": "Task created successfully. Returns task ID and initial status.", + "content": { + "application/json": { "schema": { - "type": "integer", - "example": 0 + "$ref": "#/components/schemas/AsyncTaskCreateResponse" } } - }, + } + }, + "401": { + "description": "Unauthorized - Authentication error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ConcurrentLimitError" + "$ref": "#/components/schemas/AuthenticationError" } } } }, - "499": { - "description": "Client Closed Request - Request was canceled", + "409": { + "description": "Conflict - Task with this idempotencyKey already exists", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CanceledError" + "$ref": "#/components/schemas/ConflictError" } } } }, - "500": { - "description": "Internal Server Error", + "422": { + "description": "Validation Error - Invalid request body", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/InternalError" + "$ref": "#/components/schemas/ValidationError" } } } }, - "502": { - "description": "Bad Gateway - External service error", + "429": { + "description": "Queue Limit Exceeded - Organization has reached maximum queued tasks", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExternalServiceError" + "$ref": "#/components/schemas/QueueLimitError" } } } - } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalError" + } + } + } + } } } }, - "/v1/monitor/perplexity": { + "/v1/async/task/batch": { "post": { - "summary": "Monitor Perplexity Responses", - "description": "Extract structured data from Perplexity AI about your brand, products, or any topic across various regions", - "operationId": "monitorPerplexity", + "summary": "Create batch async tasks", + "description": "Submit up to 500 async tasks in one request. Each task is validated independently, so one invalid task does not block the rest. Returns per-task results.", + "operationId": "createBatchAsyncTasks", + "security": [ + { + "bearerAuth": [] + } + ], "requestBody": { - "description": "Request parameters for monitoring Perplexity responses", + "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PerplexityMonitorRequest" - } + "type": "array", + "minItems": 1, + "maxItems": 500, + "description": "Array of task objects to create.", + "items": { + "$ref": "#/components/schemas/BatchTaskRequest" + } + }, + "example": [ + { + "taskType": "CHATGPT", + "priority": 5, + "idempotencyKey": "batch-chatgpt-001", + "webhook": { + "url": "https://your-app.com/webhook-handler" + }, + "payload": { + "prompt": "What do you know about Acme Corp?", + "country": "US" + } + }, + { + "taskType": "GEMINI", + "priority": 3, + "idempotencyKey": "batch-gemini-001", + "payload": { + "prompt": "Latest news about Acme Corp", + "country": "US" + } + } + ] } - }, - "required": true + } }, "responses": { "200": { - "description": "successful Perplexity monitoring response", - "headers": { - "X-Concurrent-Limit": { - "description": "Maximum number of concurrent requests allowed", - "schema": { - "type": "integer", - "example": 10 - } - }, - "X-Concurrent-Current": { - "description": "Current number of concurrent requests", - "schema": { - "type": "integer", - "example": 3 - } - }, - "X-Concurrent-Remaining": { - "description": "Number of remaining concurrent slots available", - "schema": { - "type": "integer", - "example": 7 - } - }, - "X-Credits-Remaining": { - "description": "Number of credits remaining in user account", - "schema": { - "type": "integer", - "example": 4 - } - }, - "X-Credits-Charged": { - "description": "Number of credits charged for this request", + "description": "Batch processed. Check the summary and individual results for per-task success or failure.", + "content": { + "application/json": { "schema": { - "type": "integer", - "example": 5 + "$ref": "#/components/schemas/BatchTaskResponse" } } - }, + } + }, + "401": { + "description": "Unauthorized - Authentication error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PerplexityMonitorResponse" + "$ref": "#/components/schemas/AuthenticationError" } } } }, - "400": { - "description": "Bad Request - Validation error", + "422": { + "description": "Validation Error - Request body is not a valid array or is empty", "content": { "application/json": { "schema": { @@ -1258,119 +1252,132 @@ } } }, - "401": { - "description": "Unauthorized - Authentication error", + "429": { + "description": "Queue Limit Exceeded - The entire batch is rejected because it would exceed your organization's queue capacity", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthenticationError" + "$ref": "#/components/schemas/QueueLimitError" } } } }, - "403": { - "description": "Forbidden - Insufficient permissions or credits", + "500": { + "description": "Internal Server Error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ForbiddenError" + "$ref": "#/components/schemas/InternalError" } } } - }, - "404": { - "description": "Not Found - Route not found", + } + } + } + }, + "/v1/async/task/{taskId}": { + "get": { + "summary": "Get async task status", + "description": "Poll the status and result of an asynchronous task by ID. Returns the task state and, once complete, the full structured result payload.", + "operationId": "getTaskStatus", + "parameters": [ + { + "name": "taskId", + "in": "path", + "required": true, + "description": "The ID of the task to fetch.", + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "security": [ + { + "bearerAuth": [] + } + ], + "responses": { + "200": { + "description": "Successful response with the task status and result if completed.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotFoundError" + "$ref": "#/components/schemas/TaskStatusResponse" } } } }, - "409": { - "description": "Conflict - Resource conflict", + "401": { + "description": "Unauthorized - Authentication error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ConflictError" + "$ref": "#/components/schemas/AuthenticationError" } } } }, - "429": { - "description": "Too Many Requests", - "headers": { - "X-Concurrent-Limit": { - "description": "Maximum number of concurrent requests allowed", - "schema": { - "type": "integer", - "example": 10 - } - }, - "X-Concurrent-Current": { - "description": "Current number of concurrent requests", - "schema": { - "type": "integer", - "example": 11 - } - }, - "X-Concurrent-Remaining": { - "description": "Number of remaining concurrent slots available", - "schema": { - "type": "integer", - "example": 0 - } - }, - "X-Credits-Remaining": { - "description": "Number of credits remaining in user account", - "schema": { - "type": "integer", - "example": 4 - } - }, - "X-Credits-Charged": { - "description": "Number of credits charged for this request", + "404": { + "description": "Not Found - Task not found", + "content": { + "application/json": { "schema": { - "type": "integer", - "example": 0 + "$ref": "#/components/schemas/NotFoundError" } } - }, + } + }, + "500": { + "description": "Internal Server Error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ConcurrentLimitError" + "$ref": "#/components/schemas/InternalError" } } } - }, - "499": { - "description": "Client Closed Request - Request was canceled", + } + } + } + }, + "/v1/async/status": { + "get": { + "summary": "Get async queue status", + "description": "Get organization-wide async queue metrics including queued and processing task counts, and concurrency usage.", + "operationId": "getAsyncStatus", + "security": [ + { + "bearerAuth": [] + } + ], + "responses": { + "200": { + "description": "Successful response with queue metrics.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CanceledError" + "$ref": "#/components/schemas/AsyncStatusResponse" } } } }, - "500": { - "description": "Internal Server Error", + "401": { + "description": "Unauthorized - Authentication error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/InternalError" + "$ref": "#/components/schemas/AuthenticationError" } } } }, - "502": { - "description": "Bad Gateway - External service error", + "500": { + "description": "Internal Server Error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExternalServiceError" + "$ref": "#/components/schemas/InternalError" } } } @@ -1378,248 +1385,88 @@ } } }, - "/v1/monitor/aimode": { - "post": { - "summary": "Monitor AI Mode Responses", - "description": "Extract structured data from AI Mode about your brand, products, or any topic across various regions", - "operationId": "monitorAiMode", - "requestBody": { - "description": "Request parameters for monitoring AI Mode responses", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AiModeMonitorRequest" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "successful AI Mode monitoring response", - "headers": { - "X-Concurrent-Limit": { - "description": "Maximum number of concurrent requests allowed", - "schema": { - "type": "integer", - "example": 10 - } - }, - "X-Concurrent-Current": { - "description": "Current number of concurrent requests", - "schema": { - "type": "integer", - "example": 3 - } - }, - "X-Concurrent-Remaining": { - "description": "Number of remaining concurrent slots available", - "schema": { - "type": "integer", - "example": 7 - } - }, - "X-Credits-Remaining": { - "description": "Number of credits remaining in user account", - "schema": { - "type": "integer", - "example": 4 - } - }, - "X-Credits-Charged": { - "description": "Number of credits charged for this request", - "schema": { - "type": "integer", - "example": 5 - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AiModeMonitorResponse" - } - } - } - }, - "400": { - "description": "Bad Request - Validation error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ValidationError" - } - } - } - }, - "401": { - "description": "Unauthorized - Authentication error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthenticationError" - } - } - } - }, - "403": { - "description": "Forbidden - Insufficient permissions or credits", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ForbiddenError" - } - } - } - }, - "404": { - "description": "Not Found - Route not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NotFoundError" - } - } - } - }, - "409": { - "description": "Conflict - Resource conflict", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConflictError" - } - } - } - }, - "429": { - "description": "Too Many Requests", - "headers": { - "X-Concurrent-Limit": { - "description": "Maximum number of concurrent requests allowed", - "schema": { - "type": "integer", - "example": 10 - } - }, - "X-Concurrent-Current": { - "description": "Current number of concurrent requests", - "schema": { - "type": "integer", - "example": 11 - } - }, - "X-Concurrent-Remaining": { - "description": "Number of remaining concurrent slots available", - "schema": { - "type": "integer", - "example": 0 - } - }, - "X-Credits-Remaining": { - "description": "Number of credits remaining in user account", - "schema": { - "type": "integer", - "example": 4 - } - }, - "X-Credits-Charged": { - "description": "Number of credits charged for this request", - "schema": { - "type": "integer", - "example": 0 - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConcurrentLimitError" - } - } - } - }, - "499": { - "description": "Client Closed Request - Request was canceled", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CanceledError" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "502": { - "description": "Bad Gateway - External service error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ExternalServiceError" - } - } - } - } - } - } - }, - "/v1/countries": { + "/v1/states": { "get": { - "summary": "List of countries", - "description": "Returns a list of all supported ISO 3166-1 alpha-2 country codes. Can be filtered by model to get countries available for specific AI providers.", - "operationId": "getCountries", + "summary": "List of states", + "description": "Returns a list of US states supported for state-level geo-targeting. Only US is currently supported — other country values return an empty array.", + "operationId": "getStates", "parameters": [ { - "name": "model", + "name": "country", "in": "query", - "description": "Filter countries available for a specific model", + "required": true, + "description": "ISO 3166-1 alpha-2 country code. Only \"US\" returns results.", "schema": { "type": "string", - "enum": [ - "aimode", - "chatgpt", - "copilot", - "gemini", - "google", - "grok", - "perplexity" - ] + "minLength": 2, + "maxLength": 2, + "pattern": "^[A-Z]{2}$" }, - "example": "chatgpt" + "example": "US" } ], "responses": { "200": { - "description": "List of supported country codes", + "description": "List of supported states", "content": { "application/json": { "schema": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "USPS two-letter state code", + "example": "CA" + }, + "name": { + "type": "string", + "description": "Full state name", + "example": "California" + } + }, + "required": [ + "code", + "name" + ] }, "example": [ - "AF", - "AX", - "AL", - "DZ", - "AS" + { + "code": "AL", + "name": "Alabama" + }, + { + "code": "AK", + "name": "Alaska" + }, + { + "code": "AZ", + "name": "Arizona" + }, + { + "code": "CA", + "name": "California" + }, + { + "code": "DC", + "name": "District of Columbia" + }, + { + "code": "NY", + "name": "New York" + }, + { + "code": "TX", + "name": "Texas" + } ] } } } }, "400": { - "description": "Bad Request - Invalid model parameter", + "description": "Bad Request — missing or invalid country parameter", "content": { "application/json": { "schema": { @@ -1638,936 +1485,498 @@ } } }, - "404": { - "description": "Not Found - Route not found", + "500": { + "description": "Internal Server Error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotFoundError" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InternalError" + "$ref": "#/components/schemas/InternalError" } } } } } } - }, - "/v1/async/task": { - "post": { - "summary": "Create async task", - "description": "Submit an asynchronous task for background processing. Returns a task ID that you can use to poll for results or receive via webhook.", - "operationId": "createAsyncTask", - "security": [ - { - "bearerAuth": [] - } + } + }, + "components": { + "schemas": { + "AsyncTaskSummary": { + "type": "object", + "required": [ + "id", + "taskType", + "status", + "priority", + "createdAt" ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BatchTaskRequest" - }, - "example": { - "taskType": "CHATGPT", - "priority": 5, - "idempotencyKey": "your-custom-identifier-123", - "webhook": { - "url": "https://your-app.com/webhook-handler" - }, - "payload": { - "prompt": "What is the weather in New York?", - "country": "US" - } - } - } - } - }, - "responses": { - "200": { - "description": "Task created successfully. Returns task ID and initial status.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AsyncTaskCreateResponse" - } - } - } + "description": "Common task summary fields shared across async task responses.", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "Unique task identifier.", + "example": "b27a21e1-7c39-4aa2-a347-23e828c426f9" }, - "401": { - "description": "Unauthorized - Authentication error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthenticationError" - } - } - } + "taskType": { + "type": "string", + "enum": [ + "AIMODE", + "GOOGLE", + "GOOGLE_NEWS", + "GEMINI", + "CHATGPT" + ], + "description": "The AI provider for this task.", + "example": "CHATGPT" }, - "409": { - "description": "Conflict - Task with this idempotencyKey already exists", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConflictError" - } - } - } + "status": { + "type": "string", + "enum": [ + "QUEUED", + "PROCESSING", + "COMPLETED", + "FAILED" + ], + "description": "Current task status.", + "example": "QUEUED" }, - "422": { - "description": "Validation Error - Invalid request body", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ValidationError" - } - } - } + "priority": { + "type": "integer", + "description": "Task priority level (1-10). Higher numbers are processed first. Defaults to 1.", + "minimum": 1, + "maximum": 10, + "example": 1 }, - "429": { - "description": "Queue Limit Exceeded - Organization has reached maximum queued tasks", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueueLimitError" - } - } - } + "createdAt": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the task was created.", + "example": "2026-04-09T15:00:00.000Z" }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InternalError" - } - } - } + "idempotencyKey": { + "type": [ + "string", + "null" + ], + "description": "The idempotency key if one was provided.", + "example": "batch-chatgpt-001" } } - } - }, - "/v1/async/task/batch": { - "post": { - "summary": "Create batch async tasks", - "description": "Submit up to 500 async tasks in one request. Each task is validated independently, so one invalid task does not block the rest. Returns per-task results.", - "operationId": "createBatchAsyncTasks", - "security": [ - { - "bearerAuth": [] - } + }, + "AsyncTaskCredits": { + "type": "object", + "required": [ + "creditsToCharge", + "creditsCharged" ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "array", - "minItems": 1, - "maxItems": 500, - "description": "Array of task objects to create.", - "items": { - "$ref": "#/components/schemas/BatchTaskRequest" - } - }, - "example": [ - { - "taskType": "CHATGPT", - "priority": 5, - "idempotencyKey": "batch-chatgpt-001", - "webhook": { - "url": "https://your-app.com/webhook-handler" - }, - "payload": { - "prompt": "What do you know about Acme Corp?", - "country": "US" - } - }, - { - "taskType": "PERPLEXITY", - "priority": 3, - "idempotencyKey": "batch-perplexity-001", - "payload": { - "prompt": "Latest news about Acme Corp", - "country": "US" - } - } - ] - } + "description": "Credit information for an async task.", + "properties": { + "creditsToCharge": { + "type": "number", + "description": "Credits reserved for this task.", + "example": 10 + }, + "creditsCharged": { + "type": [ + "number", + "null" + ], + "description": "Credits actually charged. Null until the task completes.", + "example": null } - }, - "responses": { - "200": { - "description": "Batch processed. Check the summary and individual results for per-task success or failure.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BatchTaskResponse" - } - } - } + } + }, + "AsyncTaskCreateResponse": { + "type": "object", + "required": [ + "success", + "task", + "credits" + ], + "properties": { + "success": { + "type": "boolean", + "example": true }, - "401": { - "description": "Unauthorized - Authentication error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthenticationError" - } - } - } + "task": { + "$ref": "#/components/schemas/AsyncTaskSummary" }, - "422": { - "description": "Validation Error - Request body is not a valid array or is empty", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ValidationError" - } - } - } - }, - "429": { - "description": "Queue Limit Exceeded - The entire batch is rejected because it would exceed your organization's queue capacity", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueueLimitError" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InternalError" - } - } - } + "credits": { + "$ref": "#/components/schemas/AsyncTaskCredits" } } - } - }, - "/v1/async/task/{taskId}": { - "get": { - "summary": "Get async task status", - "description": "Poll the status and result of an asynchronous task by ID. Returns the task state and, once complete, the full structured result payload.", - "operationId": "getTaskStatus", - "parameters": [ - { - "name": "taskId", - "in": "path", - "required": true, - "description": "The ID of the task to fetch.", - "schema": { - "type": "string", - "format": "uuid" - } - } + }, + "TaskStatusResponse": { + "type": "object", + "required": [ + "task", + "credits" ], - "security": [ - { - "bearerAuth": [] + "properties": { + "task": { + "$ref": "#/components/schemas/AsyncTaskSummary" + }, + "credits": { + "$ref": "#/components/schemas/AsyncTaskCredits" + }, + "response": { + "type": "object", + "description": "The full response object, present only when the task is COMPLETED or FAILED." } + } + }, + "AsyncStatusResponse": { + "type": "object", + "required": [ + "queuedTasks", + "processingTasks", + "priorityBreakdown" ], - "responses": { - "200": { - "description": "Successful response with the task status and result if completed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskStatusResponse" - } - } - } + "properties": { + "queuedTasks": { + "type": "integer", + "description": "Number of tasks currently queued for this organization.", + "example": 3 }, - "401": { - "description": "Unauthorized - Authentication error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthenticationError" - } - } - } + "processingTasks": { + "type": "integer", + "description": "Number of tasks currently being processed for this organization.", + "example": 2 }, - "404": { - "description": "Not Found - Task not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NotFoundError" + "priorityBreakdown": { + "type": "array", + "description": "Queued task counts per priority level, ordered by priority descending. Only includes priority levels that have queued tasks.", + "items": { + "type": "object", + "required": [ + "priority", + "count" + ], + "properties": { + "priority": { + "type": "integer", + "description": "The priority level (1-10).", + "minimum": 1, + "maximum": 10, + "example": 5 + }, + "count": { + "type": "integer", + "description": "Number of queued tasks at this priority level.", + "example": 2 } } } }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InternalError" - } + "concurrency": { + "type": "object", + "nullable": true, + "description": "Current concurrency usage. Null if unable to retrieve concurrency information.", + "properties": { + "used": { + "type": "integer", + "description": "Number of concurrent slots currently in use.", + "example": 2 + }, + "max": { + "type": "integer", + "description": "Maximum allowed concurrent tasks for this organization.", + "example": 5 } } } } - } - }, - "/v1/async/status": { - "get": { - "summary": "Get async queue status", - "description": "Get organization-wide async queue metrics including queued and processing task counts, and concurrency usage.", - "operationId": "getAsyncStatus", - "security": [ - { - "bearerAuth": [] - } + }, + "BatchTaskRequest": { + "type": "object", + "required": [ + "taskType", + "payload" ], - "responses": { - "200": { - "description": "Successful response with queue metrics.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AsyncStatusResponse" - } - } - } + "properties": { + "taskType": { + "type": "string", + "enum": [ + "AIMODE", + "GOOGLE", + "GOOGLE_NEWS", + "GEMINI", + "CHATGPT" + ], + "description": "The AI provider to use for this task.", + "example": "CHATGPT" }, - "401": { - "description": "Unauthorized - Authentication error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthenticationError" - } - } + "payload": { + "type": "object", + "description": "Provider-specific request payload. Must include at least `prompt` (or `query` for Google Search).", + "example": { + "prompt": "What do you know about Acme Corp?", + "country": "US" } }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InternalError" - } + "priority": { + "type": "integer", + "description": "Task priority level (1-10). Higher numbers are processed first. Defaults to 1.", + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 5 + }, + "idempotencyKey": { + "type": "string", + "description": "Unique string to prevent duplicate task creation. Must be unique across your account.", + "example": "batch-chatgpt-001" + }, + "webhook": { + "type": "object", + "description": "Webhook configuration for task completion notification.", + "properties": { + "url": { + "type": "string", + "format": "uri", + "description": "URL to receive the webhook POST request when the task completes.", + "example": "https://your-app.com/webhook-handler" } - } - } - } - } - }, - "/v1/states": { - "get": { - "summary": "List of states", - "description": "Returns a list of US states supported for state-level geo-targeting. Only US is currently supported — other country values return an empty array.", - "operationId": "getStates", - "parameters": [ - { - "name": "country", - "in": "query", - "required": true, - "description": "ISO 3166-1 alpha-2 country code. Only \"US\" returns results.", - "schema": { - "type": "string", - "minLength": 2, - "maxLength": 2, - "pattern": "^[A-Z]{2}$" }, - "example": "US" - } - ], - "responses": { - "200": { - "description": "List of supported states", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "USPS two-letter state code", - "example": "CA" - }, - "name": { - "type": "string", - "description": "Full state name", - "example": "California" - } - }, - "required": [ - "code", - "name" - ] - }, - "example": [ - { - "code": "AL", - "name": "Alabama" - }, - { - "code": "AK", - "name": "Alaska" - }, - { - "code": "AZ", - "name": "Arizona" - }, - { - "code": "CA", - "name": "California" - }, - { - "code": "DC", - "name": "District of Columbia" - }, - { - "code": "NY", - "name": "New York" - }, - { - "code": "TX", - "name": "Texas" - } - ] - } - } - } + "required": [ + "url" + ], + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "BatchTaskResponse": { + "type": "object", + "required": [ + "success", + "summary", + "results" + ], + "properties": { + "success": { + "type": "boolean", + "description": "Always true for a successfully processed batch (individual tasks may still fail).", + "example": true }, - "400": { - "description": "Bad Request — missing or invalid country parameter", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ValidationError" - } + "summary": { + "type": "object", + "required": [ + "total", + "succeeded", + "failed" + ], + "description": "Aggregate counts for the batch.", + "properties": { + "total": { + "type": "integer", + "description": "Total number of tasks submitted in the batch.", + "example": 3 + }, + "succeeded": { + "type": "integer", + "description": "Number of tasks successfully created.", + "example": 2 + }, + "failed": { + "type": "integer", + "description": "Number of tasks that failed validation or processing.", + "example": 1 } } }, - "401": { - "description": "Unauthorized - Authentication error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthenticationError" + "results": { + "type": "array", + "description": "Per-task results preserving the original input order by index.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/BatchTaskSuccessResult" + }, + { + "$ref": "#/components/schemas/BatchTaskFailureResult" } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InternalError" + ], + "discriminator": { + "propertyName": "success", + "mapping": { + "true": "#/components/schemas/BatchTaskSuccessResult", + "false": "#/components/schemas/BatchTaskFailureResult" } } } } } - } - } - }, - "components": { - "schemas": { - "AsyncTaskSummary": { + }, + "BatchTaskSuccessResult": { "type": "object", "required": [ - "id", - "taskType", - "status", - "priority", - "createdAt" + "success", + "index", + "task", + "credits" ], - "description": "Common task summary fields shared across async task responses.", "properties": { - "id": { - "type": "string", - "format": "uuid", - "description": "Unique task identifier.", - "example": "b27a21e1-7c39-4aa2-a347-23e828c426f9" - }, - "taskType": { - "type": "string", - "enum": [ - "AIMODE", - "GOOGLE", - "GOOGLE_NEWS", - "GEMINI", - "CHATGPT", - "COPILOT", - "PERPLEXITY", - "GROK" - ], - "description": "The AI provider for this task.", - "example": "CHATGPT" - }, - "status": { - "type": "string", + "success": { + "type": "boolean", "enum": [ - "QUEUED", - "PROCESSING", - "COMPLETED", - "FAILED" + true ], - "description": "Current task status.", - "example": "QUEUED" + "description": "Indicates this task was created successfully.", + "example": true }, - "priority": { + "index": { "type": "integer", - "description": "Task priority level (1-10). Higher numbers are processed first. Defaults to 1.", - "minimum": 1, - "maximum": 10, - "example": 1 + "description": "The zero-based position of this task in the original request array.", + "example": 0 }, - "createdAt": { - "type": "string", - "format": "date-time", - "description": "Timestamp when the task was created.", - "example": "2026-04-09T15:00:00.000Z" + "task": { + "allOf": [ + { + "$ref": "#/components/schemas/AsyncTaskSummary" + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "QUEUED" + ], + "description": "Initial status of a newly created task.", + "example": "QUEUED" + } + } + } + ] }, - "idempotencyKey": { - "type": [ - "string", - "null" - ], - "description": "The idempotency key if one was provided.", - "example": "batch-chatgpt-001" + "credits": { + "$ref": "#/components/schemas/AsyncTaskCredits" } } }, - "AsyncTaskCredits": { + "BatchTaskFailureResult": { "type": "object", "required": [ - "creditsToCharge", - "creditsCharged" + "success", + "index", + "error" ], - "description": "Credit information for an async task.", "properties": { - "creditsToCharge": { - "type": "number", - "description": "Credits reserved for this task.", - "example": 10 - }, - "creditsCharged": { - "type": [ - "number", - "null" + "success": { + "type": "boolean", + "enum": [ + false ], - "description": "Credits actually charged. Null until the task completes.", - "example": null - } - } - }, - "AsyncTaskCreateResponse": { - "type": "object", - "required": [ - "success", - "task", - "credits" - ], - "properties": { - "success": { - "type": "boolean", - "example": true - }, - "task": { - "$ref": "#/components/schemas/AsyncTaskSummary" - }, - "credits": { - "$ref": "#/components/schemas/AsyncTaskCredits" - } - } - }, - "TaskStatusResponse": { - "type": "object", - "required": [ - "task", - "credits" - ], - "properties": { - "task": { - "$ref": "#/components/schemas/AsyncTaskSummary" - }, - "credits": { - "$ref": "#/components/schemas/AsyncTaskCredits" - }, - "response": { - "type": "object", - "description": "The full response object, present only when the task is COMPLETED or FAILED." - } - } - }, - "AsyncStatusResponse": { - "type": "object", - "required": [ - "queuedTasks", - "processingTasks", - "priorityBreakdown" - ], - "properties": { - "queuedTasks": { - "type": "integer", - "description": "Number of tasks currently queued for this organization.", - "example": 3 + "description": "Indicates this task failed.", + "example": false }, - "processingTasks": { + "index": { "type": "integer", - "description": "Number of tasks currently being processed for this organization.", + "description": "The zero-based position of this task in the original request array.", "example": 2 }, - "priorityBreakdown": { - "type": "array", - "description": "Queued task counts per priority level, ordered by priority descending. Only includes priority levels that have queued tasks.", - "items": { - "type": "object", - "required": [ - "priority", - "count" - ], - "properties": { - "priority": { - "type": "integer", - "description": "The priority level (1-10).", - "minimum": 1, - "maximum": 10, - "example": 5 - }, - "count": { - "type": "integer", - "description": "Number of queued tasks at this priority level.", - "example": 2 - } - } - } - }, - "concurrency": { + "error": { "type": "object", - "nullable": true, - "description": "Current concurrency usage. Null if unable to retrieve concurrency information.", + "required": [ + "code", + "message", + "timestamp" + ], "properties": { - "used": { - "type": "integer", - "description": "Number of concurrent slots currently in use.", - "example": 2 + "code": { + "type": "string", + "description": "Error code identifying the failure reason.", + "enum": [ + "VALIDATION_ERROR", + "RESOURCE_ALREADY_EXISTS", + "INSUFFICIENT_CREDITS" + ], + "example": "VALIDATION_ERROR" }, - "max": { - "type": "integer", - "description": "Maximum allowed concurrent tasks for this organization.", - "example": 5 + "message": { + "type": "string", + "description": "Human-readable error message.", + "example": "Task validation failed" + }, + "details": { + "type": "object", + "description": "Additional context about the error, such as field-level validation failures.", + "example": { + "field": "payload.prompt", + "message": "Required" + } + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the error occurred.", + "example": "2026-04-09T15:00:00.000Z" } } } } }, - "BatchTaskRequest": { - "type": "object", - "required": [ - "taskType", - "payload" - ], - "properties": { - "taskType": { - "type": "string", - "enum": [ - "AIMODE", - "GOOGLE", - "GOOGLE_NEWS", - "GEMINI", - "CHATGPT", - "COPILOT", - "PERPLEXITY", - "GROK" - ], - "description": "The AI provider to use for this task.", - "example": "CHATGPT" - }, - "payload": { - "type": "object", - "description": "Provider-specific request payload. Must include at least `prompt` (or `query` for Google Search).", - "example": { - "prompt": "What do you know about Acme Corp?", - "country": "US" - } - }, - "priority": { - "type": "integer", - "description": "Task priority level (1-10). Higher numbers are processed first. Defaults to 1.", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 5 - }, - "idempotencyKey": { - "type": "string", - "description": "Unique string to prevent duplicate task creation. Must be unique across your account.", - "example": "batch-chatgpt-001" - }, - "webhook": { - "type": "object", - "description": "Webhook configuration for task completion notification.", - "properties": { - "url": { - "type": "string", - "format": "uri", - "description": "URL to receive the webhook POST request when the task completes.", - "example": "https://your-app.com/webhook-handler" - } - }, - "required": [ - "url" - ], - "additionalProperties": false - } - }, - "additionalProperties": false - }, - "BatchTaskResponse": { + "QueueLimitError": { "type": "object", "required": [ "success", - "summary", - "results" + "error" ], "properties": { "success": { "type": "boolean", - "description": "Always true for a successfully processed batch (individual tasks may still fail).", - "example": true + "example": false }, - "summary": { + "error": { "type": "object", "required": [ - "total", - "succeeded", - "failed" + "code", + "message", + "timestamp" ], - "description": "Aggregate counts for the batch.", "properties": { - "total": { - "type": "integer", - "description": "Total number of tasks submitted in the batch.", - "example": 3 + "code": { + "type": "string", + "enum": [ + "QUEUE_LIMIT_EXCEEDED" + ], + "example": "QUEUE_LIMIT_EXCEEDED" }, - "succeeded": { - "type": "integer", - "description": "Number of tasks successfully created.", - "example": 2 + "message": { + "type": "string", + "example": "Batch would exceed queue capacity" }, - "failed": { - "type": "integer", - "description": "Number of tasks that failed validation or processing.", - "example": 1 - } - } - }, - "results": { - "type": "array", - "description": "Per-task results preserving the original input order by index.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/BatchTaskSuccessResult" - }, - { - "$ref": "#/components/schemas/BatchTaskFailureResult" - } - ], - "discriminator": { - "propertyName": "success", - "mapping": { - "true": "#/components/schemas/BatchTaskSuccessResult", - "false": "#/components/schemas/BatchTaskFailureResult" - } - } - } - } - } - }, - "BatchTaskSuccessResult": { - "type": "object", - "required": [ - "success", - "index", - "task", - "credits" - ], - "properties": { - "success": { - "type": "boolean", - "enum": [ - true - ], - "description": "Indicates this task was created successfully.", - "example": true - }, - "index": { - "type": "integer", - "description": "The zero-based position of this task in the original request array.", - "example": 0 - }, - "task": { - "allOf": [ - { - "$ref": "#/components/schemas/AsyncTaskSummary" - }, - { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "QUEUED" - ], - "description": "Initial status of a newly created task.", - "example": "QUEUED" - } - } - } - ] - }, - "credits": { - "$ref": "#/components/schemas/AsyncTaskCredits" - } - } - }, - "BatchTaskFailureResult": { - "type": "object", - "required": [ - "success", - "index", - "error" - ], - "properties": { - "success": { - "type": "boolean", - "enum": [ - false - ], - "description": "Indicates this task failed.", - "example": false - }, - "index": { - "type": "integer", - "description": "The zero-based position of this task in the original request array.", - "example": 2 - }, - "error": { - "type": "object", - "required": [ - "code", - "message", - "timestamp" - ], - "properties": { - "code": { - "type": "string", - "description": "Error code identifying the failure reason.", - "enum": [ - "VALIDATION_ERROR", - "RESOURCE_ALREADY_EXISTS", - "INSUFFICIENT_CREDITS" - ], - "example": "VALIDATION_ERROR" - }, - "message": { - "type": "string", - "description": "Human-readable error message.", - "example": "Task validation failed" - }, - "details": { - "type": "object", - "description": "Additional context about the error, such as field-level validation failures.", - "example": { - "field": "payload.prompt", - "message": "Required" - } - }, - "timestamp": { - "type": "string", - "format": "date-time", - "description": "Timestamp when the error occurred.", - "example": "2026-04-09T15:00:00.000Z" - } - } - } - } - }, - "QueueLimitError": { - "type": "object", - "required": [ - "success", - "error" - ], - "properties": { - "success": { - "type": "boolean", - "example": false - }, - "error": { - "type": "object", - "required": [ - "code", - "message", - "timestamp" - ], - "properties": { - "code": { - "type": "string", - "enum": [ - "QUEUE_LIMIT_EXCEEDED" - ], - "example": "QUEUE_LIMIT_EXCEEDED" - }, - "message": { - "type": "string", - "example": "Batch would exceed queue capacity" - }, - "details": { - "type": "object", - "properties": { - "queuedCount": { - "type": "integer", - "description": "Current number of tasks in the queue.", - "example": 99950 - }, - "batchSize": { - "type": "integer", - "description": "Number of tasks in the submitted batch.", - "example": 100 - }, - "maxQueueSize": { - "type": "integer", - "description": "Maximum allowed queue size.", - "example": 100000 - }, - "remainingCapacity": { - "type": "integer", - "description": "Number of tasks that can still be added to the queue.", - "example": 50 - } - } - }, - "timestamp": { - "type": "string", - "format": "date-time", - "example": "2026-04-09T15:00:00.000Z" + "details": { + "type": "object", + "properties": { + "queuedCount": { + "type": "integer", + "description": "Current number of tasks in the queue.", + "example": 99950 + }, + "batchSize": { + "type": "integer", + "description": "Number of tasks in the submitted batch.", + "example": 100 + }, + "maxQueueSize": { + "type": "integer", + "description": "Maximum allowed queue size.", + "example": 100000 + }, + "remainingCapacity": { + "type": "integer", + "description": "Number of tasks that can still be added to the queue.", + "example": 50 + } + } + }, + "timestamp": { + "type": "string", + "format": "date-time", + "example": "2026-04-09T15:00:00.000Z" } } } @@ -2850,62 +2259,7 @@ } } }, - "GrokMonitorRequest": { - "required": [ - "prompt", - "country" - ], - "type": "object", - "properties": { - "prompt": { - "description": "The prompt to send to Grok", - "type": "string", - "minLength": 1, - "maxLength": 10000, - "example": "What are the best laptops for programming?" - }, - "country": { - "description": "Country/region code for localized response", - "type": "string", - "example": "US" - }, - "include": { - "description": "Optional flags for including additional response formats", - "type": "object", - "properties": { - "markdown": { - "description": "Include markdown-formatted response in the result", - "type": "boolean", - "default": false, - "example": true - }, - "html": { - "description": "Include HTML-formatted response in the result", - "type": "boolean", - "default": false, - "example": true - }, - "rawResponse": { - "description": "Include raw streaming response events", - "type": "boolean", - "default": false, - "example": true - } - }, - "default": { - "markdown": false, - "html": false, - "rawResponse": false - }, - "additionalProperties": false - }, - "state": { - "$ref": "#/components/schemas/StateParameter" - } - }, - "additionalProperties": false - }, - "GrokMonitorResponse": { + "ChatGPTMonitorResponse": { "required": [ "success", "result" @@ -2917,23 +2271,17 @@ "example": true }, "result": { - "description": "Grok response data", + "description": "ChatGPT's response data", "type": "object", "properties": { "text": { "type": "string", - "description": "Grok's response text", - "example": "Based on current information and real-time web search, here are excellent laptop options for programming..." - }, - "html": { - "type": "string", - "format": "uri", - "description": "A URL to the full HTML of the response.", - "example": "https://storage.cloro.dev/results/c45a5081-808d-4ed3-9c86-e4baf16c8ab8/page-1.html" + "description": "ChatGPT's response text", + "example": "The name \"Acme Corporation\" is used in various contexts, both fictional and real. Here's an overview:\n\n🐾 Acme Corporation in Fiction\nThe Acme Corporation is a fictional company featured prominently in Warner Bros. cartoons, particularly the Road Runner/Wile E. Coyote series." }, "sources": { "type": "array", - "description": "Array of sources referenced in the response with enhanced metadata", + "description": "Array of sources referenced in the response. Returns empty array when no sources are available.", "items": { "type": "object", "properties": { @@ -2945,139 +2293,7 @@ "url": { "type": "string", "description": "The URL of the source", - "example": "https://example.com/article" - }, - "label": { - "type": "string", - "description": "The display label for the source", - "example": "Tech Source" - }, - "description": { - "type": "string", - "description": "A description of the source content", - "example": "In-depth laptop guide for developers" - }, - "preview": { - "type": "string", - "description": "Preview text snippet from the source", - "example": "When choosing a laptop for programming, consider RAM, processor, storage..." - }, - "searchEngineText": { - "type": "string", - "description": "Search engine display text", - "example": "Best Programming Laptops 2025" - }, - "siteName": { - "type": "string", - "description": "Website name", - "example": "Tech Reviews" - }, - "metadataTitle": { - "type": "string", - "description": "Source metadata title", - "example": "Complete Guide to Development Laptops" - }, - "creator": { - "type": "string", - "description": "Content creator/author", - "example": "John Doe" - }, - "image": { - "type": "string", - "format": "uri", - "description": "Source image URL", - "example": "https://example.com/preview.jpg" - }, - "favicon": { - "type": "string", - "format": "uri", - "description": "Website favicon URL", - "example": "https://example.com/favicon.ico" - } - } - }, - "example": [ - { - "position": 1, - "url": "https://techcrunch.com/programming-laptops", - "label": "TechCrunch", - "description": "Best laptops for coding and development", - "preview": "When looking for a programming laptop, prioritize RAM and processor power...", - "searchEngineText": "Top Development Laptops 2025", - "siteName": "TechCrunch", - "metadataTitle": "Ultimate Guide to Programming Laptops", - "creator": "Tech Team", - "image": "https://techcrunch.com/preview.jpg", - "favicon": "https://techcrunch.com/favicon.ico" - } - ] - }, - "searchQueries": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Array of search queries Grok used to gather information for the response", - "example": [ - "best laptops for programming 2026", - "top developer laptops 2026" - ] - }, - "model": { - "type": "string", - "nullable": true, - "description": "The model identifier used to generate the response", - "example": "grok-4-auto" - }, - "markdown": { - "type": "string", - "description": "Grok's response formatted in Markdown (included when include.markdown is true)", - "example": "Based on current information and real-time web search, here are excellent laptop options for programming..." - }, - "rawResponse": { - "type": "array", - "description": "Raw upstream provider stream captured during the request. Each item is one chunk from the provider's wire protocol (SSE event, batchexecute frame, etc.). Format is provider-specific, undocumented, and may change without notice — use it for debugging or to access data not yet surfaced in the structured fields above.", - "items": {} - } - } - } - } - }, - "ChatGPTMonitorResponse": { - "required": [ - "success", - "result" - ], - "type": "object", - "properties": { - "success": { - "type": "boolean", - "example": true - }, - "result": { - "description": "ChatGPT's response data", - "type": "object", - "properties": { - "text": { - "type": "string", - "description": "ChatGPT's response text", - "example": "The name \"Acme Corporation\" is used in various contexts, both fictional and real. Here's an overview:\n\n🐾 Acme Corporation in Fiction\nThe Acme Corporation is a fictional company featured prominently in Warner Bros. cartoons, particularly the Road Runner/Wile E. Coyote series." - }, - "sources": { - "type": "array", - "description": "Array of sources referenced in the response. Returns empty array when no sources are available.", - "items": { - "type": "object", - "properties": { - "position": { - "type": "number", - "description": "The position index of the source in the response", - "example": 1 - }, - "url": { - "type": "string", - "description": "The URL of the source", - "example": "https://www.rippling.com/blog/ai-recruiting?utm_source=chatgpt.com" + "example": "https://www.rippling.com/blog/ai-recruiting?utm_source=chatgpt.com" }, "label": { "type": "string", @@ -3671,7 +2887,7 @@ }, "citationPillId": { "type": "integer", - "description": "0-based identifier shared by all entries from the same chip. Group by `citationPillId` to recover the pill-level structure. **Note:** unlike the other providers (Google AIO, AI Mode, Copilot, Perplexity, Gemini) which use 1-based `citationPillId`, ChatGPT's IDs start at 0 for historical reasons.", + "description": "0-based identifier shared by all entries from the same chip. Group by `citationPillId` to recover the pill-level structure. **Note:** unlike the other providers (Google AIO, AI Mode, Gemini) which use 1-based `citationPillId`, ChatGPT's IDs start at 0 for historical reasons.", "example": 0 }, "type": { @@ -5524,794 +4740,126 @@ }, "merchantVideos": { "type": "array", - "description": "Merchant or brand video content — present for retail businesses", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string", - "description": "Video title", - "example": "Foot Locker Week of Greatness" - }, - "link": { - "type": "string", - "description": "Video URL", - "example": "https://www.youtube.com/watch?v=..." - }, - "platform": { - "type": "string", - "description": "Video platform — omitted when not available", - "example": "YouTube" - }, - "duration": { - "type": "string", - "description": "Video duration as displayed — omitted when not available", - "example": "2:34" - } - } - } - }, - "listenOn": { - "type": "array", - "description": "Music streaming platform links — present for musicians and musical acts", - "items": { - "type": "object", - "properties": { - "platform": { - "type": "string", - "description": "Streaming platform name", - "example": "Spotify" - }, - "link": { - "type": "string", - "description": "Link to the artist on the platform", - "example": "https://open.spotify.com/artist/..." - } - } - } - } - } - }, - "html": { - "type": "array", - "description": "Raw HTML from Google search page (if requested)", - "items": { - "type": "string", - "format": "uri" - }, - "example": [ - "https://storage.cloro.dev/results/b83e8dfd-c3a1-4b98-83b9-af91adc21e26/page-1.html" - ] - } - } - } - } - }, - "GoogleNewsMonitorRequest": { - "required": [ - "query", - "country" - ], - "type": "object", - "properties": { - "query": { - "description": "The search query to execute on Google News", - "type": "string", - "minLength": 1, - "maxLength": 10000, - "example": "climate change" - }, - "country": { - "description": "ISO 3166-1 alpha-2 country code for localized news results", - "type": "string", - "example": "US" - }, - "device": { - "description": "Device type for news results", - "type": "string", - "enum": [ - "desktop", - "mobile" - ], - "default": "desktop", - "example": "desktop" - }, - "pages": { - "description": "Number of news results pages to scrape (1-10)", - "type": "integer", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 1 - }, - "include": { - "description": "Optional flags for including additional response data", - "type": "object", - "properties": { - "html": { - "description": "Include raw HTML response from Google News", - "type": "boolean", - "default": false, - "example": false - } - }, - "default": { - "html": false - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - "GoogleNewsMonitorResponse": { - "required": [ - "success", - "result" - ], - "type": "object", - "properties": { - "success": { - "type": "boolean", - "example": true - }, - "result": { - "description": "Google News results data", - "type": "object", - "properties": { - "newsResults": { - "type": "array", - "description": "News articles from Google News", - "items": { - "type": "object", - "properties": { - "position": { - "type": "number", - "description": "Position in news results (1-indexed)", - "example": 1 - }, - "title": { - "type": "string", - "description": "Title of the news article", - "example": "Major Climate Summit Reaches Historic Agreement" - }, - "link": { - "type": "string", - "description": "URL of the news article", - "example": "https://example.com/climate-summit-agreement" - }, - "snippet": { - "type": "string", - "description": "Text snippet describing the article", - "example": "World leaders agreed on new climate targets at the summit..." - }, - "source": { - "type": "string", - "description": "News source/publisher name", - "example": "The Guardian" - }, - "date": { - "type": "string", - "description": "Publication date", - "example": "2 hours ago" - }, - "page": { - "type": "number", - "description": "Page number this result appeared on (1-indexed)", - "example": 1 - }, - "thumbnail": { - "type": "string", - "description": "Thumbnail image URL (if available)", - "example": "https://example.com/images/climate-summit.jpg" - } - } - } - }, - "html": { - "type": "array", - "description": "Raw HTML from Google News pages (if requested)", - "items": { - "type": "string", - "format": "uri" - }, - "example": [ - "https://storage.cloro.dev/results/a12b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6/page-1.html" - ] - } - } - } - } - }, - "CopilotMonitorRequest": { - "required": [ - "prompt", - "country" - ], - "type": "object", - "properties": { - "prompt": { - "description": "The prompt to send to Copilot", - "type": "string", - "minLength": 1, - "maxLength": 10000, - "example": "What are the best laptops for programming?" - }, - "country": { - "description": "Country/region code for localized response", - "type": "string", - "example": "US" - }, - "include": { - "description": "Optional flags for including additional response formats", - "type": "object", - "properties": { - "html": { - "description": "Include a URL to the full HTML of the response", - "type": "boolean", - "default": false, - "example": true - }, - "markdown": { - "description": "Include markdown-formatted response in the result", - "type": "boolean", - "default": false, - "example": true - }, - "rawResponse": { - "description": "Include raw streaming response events", - "type": "boolean", - "default": false, - "example": true - } - }, - "default": { - "html": false, - "markdown": false, - "rawResponse": false - }, - "additionalProperties": false - }, - "state": { - "$ref": "#/components/schemas/StateParameter" - } - }, - "additionalProperties": false - }, - "CopilotMonitorResponse": { - "required": [ - "success", - "result" - ], - "type": "object", - "properties": { - "success": { - "type": "boolean", - "example": true - }, - "result": { - "description": "Copilot response data", - "type": "object", - "properties": { - "text": { - "type": "string", - "description": "Copilot's response text", - "example": "As an AI assistant, I can help you find great laptops for programming..." - }, - "html": { - "type": "string", - "format": "uri", - "description": "A URL to the full HTML of the response.", - "example": "https://storage.cloro.dev/results/c45a5081-808d-4ed3-9c86-e4baf16c8ab8/page-1.html" - }, - "sources": { - "type": "array", - "description": "Array of sources referenced in the response", - "items": { - "type": "object", - "properties": { - "position": { - "type": "number", - "description": "The position index of the source in the response", - "example": 1 - }, - "url": { - "type": "string", - "description": "The URL of the source", - "example": "https://example.com/article" - }, - "label": { - "type": "string", - "description": "The display label for the source", - "example": "Microsoft Docs" - }, - "description": { - "type": "string", - "description": "A description of the source content", - "example": "Development hardware recommendations" - } - } - }, - "example": [ - { - "position": 1, - "url": "https://docs.microsoft.com/", - "label": "Microsoft Docs", - "description": "Official development documentation" - } - ] - }, - "citationPills": { - "type": "array", - "description": "Inline citation pills extracted from the Copilot answer. Each entry is one (pill, source) pair: when a pill cites N sources (consecutive citation events grouped into a single chip), the array contains N entries sharing the same `citationPillId` but carrying per-source `label`, `url`, and `domain`. Group by `citationPillId` to recover the pill-level structure. Omitted from `result` when the answer carries no pills.", - "items": { - "type": "object", - "required": [ - "label", - "citationPillId", - "url", - "domain", - "position" - ], - "properties": { - "label": { - "type": "string", - "description": "Per-source title from the citation event (e.g. `\"Microsoft 365 Documentation\"`, `\"Productivity Best Practices\"`). Always present; may be an empty string when the event ships no title — read `domain` / `url` for source identity in that case. Entries grouped under the same `citationPillId` carry different per-source labels.", - "example": "Microsoft 365 Documentation" - }, - "citationPillId": { - "type": "integer", - "description": "1-based ordinal shared by all entries from the same chip. Group by `citationPillId` to reconstruct the visible chip; the per-source `label` differs across entries within a chip.", - "example": 1 - }, - "url": { - "type": "string", - "description": "Direct URL of the cited source.", - "example": "https://docs.microsoft.com/" - }, - "domain": { - "type": "string", - "description": "Host extracted from `url`, for grouping and display.", - "example": "docs.microsoft.com" - }, - "description": { - "type": "string", - "description": "Source description from the sources rail when Copilot ships one. Omitted when absent.", - "example": "Official development documentation" - }, - "position": { - "type": "integer", - "description": "1-based position of this source in the sibling `result.sources` array.", - "example": 1 - } - } - }, - "example": [ - { - "label": "Microsoft 365 Documentation", - "citationPillId": 1, - "url": "https://docs.microsoft.com/", - "domain": "docs.microsoft.com", - "description": "Official development documentation", - "position": 1 - }, - { - "label": "VS Code on GitHub", - "citationPillId": 1, - "url": "https://github.com/microsoft/vscode", - "domain": "github.com", - "description": "Visual Studio Code repository", - "position": 2 - } - ] - }, - "shoppingCards": { - "type": "array", - "description": "Array of shopping/product cards extracted from the response (when available)", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "Shopping card type", - "example": "shoppingProducts" - }, - "layout": { - "type": "string", - "description": "Layout style for the shopping card", - "example": "Carousel" - }, - "products": { - "type": "array", - "description": "Array of product information", - "items": { - "type": "object", - "properties": { - "product": { - "type": "object", - "description": "Product identifier information", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID" - }, - "groupId": { - "type": "string", - "description": "Product group ID" - }, - "brandGroupId": { - "type": "string", - "description": "Brand group ID (optional)" - } - } - }, - "position": { - "type": "integer", - "description": "1-indexed rank across all products in all shopping cards in the response (flat, not reset per card).", - "example": 1 - }, - "offerId": { - "type": "string", - "description": "Unique offer identifier" - }, - "url": { - "type": "string", - "description": "Product page URL" - }, - "name": { - "type": "string", - "description": "Product name" - }, - "description": { - "type": "string", - "description": "Product description" - }, - "images": { - "type": "array", - "description": "Product images with titles and URLs", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string", - "description": "Image title" - }, - "url": { - "type": "string", - "description": "Image URL" - } - } - } - }, - "specifications": { - "type": "array", - "description": "Product specifications (e.g., Color, Size)", - "items": { - "type": "object", - "properties": { - "displayName": { - "type": "string", - "description": "Specification name" - }, - "values": { - "type": "array", - "description": "Available values", - "items": { - "type": "string" - } - } - } - } - }, - "tags": { - "type": "array", - "description": "Product tags", - "items": { - "type": "string" - } - }, - "price": { - "type": "object", - "description": "Product pricing information", - "properties": { - "amount": { - "type": "number", - "description": "Price amount" - }, - "currency": { - "type": "string", - "description": "Currency code (optional)" - }, - "currencySymbol": { - "type": "string", - "description": "Currency symbol" - } - } - }, - "seller": { - "type": "string", - "description": "Seller name" - }, - "sellerLogoUrl": { - "type": "string", - "description": "Seller logo URL" - }, - "brandName": { - "type": "string", - "description": "Product brand name" - }, - "rating": { - "type": "object", - "description": "Product rating information", - "properties": { - "value": { - "type": "number", - "description": "Rating value" - }, - "count": { - "type": "integer", - "description": "Number of ratings" - } - } - }, - "canTrackPrice": { - "type": "boolean", - "description": "Whether price tracking is available" - } - } - } - } - } - } - }, - "map": { - "type": "array", - "description": "Array of business/place map entries extracted from the response (when available)", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Business name", - "example": "WonderWorks Pigeon Forge" - }, - "position": { - "type": "integer", - "description": "Position in results (1-indexed)", - "example": 1 - }, - "placeId": { - "type": "string", - "description": "Google Place ID", - "example": "ChIJEYpTsk__W4gR2sQLGzOjE3o" - }, - "location": { - "type": "object", - "description": "Business location", - "properties": { - "address": { - "type": "string", - "description": "Full street address", - "example": "100 Music Rd, Pigeon Forge, TN 37863" - }, - "latitude": { - "type": "number", - "description": "GPS latitude", - "example": 35.823257 - }, - "longitude": { - "type": "number", - "description": "GPS longitude", - "example": -83.5787498 - } - } - }, - "phoneNumber": { - "type": "string", - "description": "Contact phone number", - "example": "(865) 868-1800" - }, - "url": { - "type": "string", - "format": "uri", - "description": "Business website URL", - "example": "http://www.wonderworksonline.com/pigeon-forge/" - }, - "reviews": { - "type": "array", - "description": "Review aggregations from providers", - "items": { - "type": "object", - "properties": { - "count": { - "type": "integer", - "description": "Number of reviews", - "example": 10625 - }, - "rating": { - "type": "number", - "description": "Average rating", - "example": 4.3 - }, - "providerName": { - "type": "string", - "description": "Review provider name", - "example": "Google" - }, - "providerIconUrl": { - "type": "string", - "description": "Provider icon URL" - }, - "url": { - "type": "string", - "format": "uri", - "description": "Reviews page URL", - "example": "https://maps.google.com/?cid=8796553937077126362" - } - } - } - }, - "photos": { - "type": "array", - "description": "Business photos", - "items": { - "type": "object", - "properties": { - "url": { - "type": "string", - "format": "uri", - "description": "Photo URL" - }, - "altText": { - "type": "string", - "description": "Alt text for the photo" - }, - "providerName": { - "type": "string", - "description": "Photo provider name" - }, - "providerUrl": { - "type": "string", - "format": "uri", - "description": "Photo provider URL" - } + "description": "Merchant or brand video content — present for retail businesses", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "Video title", + "example": "Foot Locker Week of Greatness" + }, + "link": { + "type": "string", + "description": "Video URL", + "example": "https://www.youtube.com/watch?v=..." + }, + "platform": { + "type": "string", + "description": "Video platform — omitted when not available", + "example": "YouTube" + }, + "duration": { + "type": "string", + "description": "Video duration as displayed — omitted when not available", + "example": "2:34" } } - }, - "openState": { - "type": "string", - "description": "Current open/closed status", - "example": "Open · Closes 9 PM" - }, - "category": { - "type": "string", - "description": "Business category", - "example": "Amusement park" - }, - "price": { - "description": "Price level (if available)" - }, - "layerLabel": { - "type": "string", - "description": "Map layer grouping label", - "example": "Theme Parks" } }, - "example": { - "name": "WonderWorks Pigeon Forge", - "position": 1, - "placeId": "ChIJEYpTsk__W4gR2sQLGzOjE3o", - "location": { - "address": "100 Music Rd, Pigeon Forge, TN 37863", - "latitude": 35.823257, - "longitude": -83.5787498 - }, - "phoneNumber": "(865) 868-1800", - "url": "http://www.wonderworksonline.com/pigeon-forge/", - "reviews": [ - { - "count": 10625, - "rating": 4.3, - "providerName": "Google", - "providerIconUrl": null, - "url": "https://maps.google.com/?cid=8796553937077126362" - } - ], - "photos": [ - { - "url": "https://lh3.googleusercontent.com/gps-cs-s/example", - "altText": null, - "providerName": null, - "providerUrl": "https://maps.google.com" + "listenOn": { + "type": "array", + "description": "Music streaming platform links — present for musicians and musical acts", + "items": { + "type": "object", + "properties": { + "platform": { + "type": "string", + "description": "Streaming platform name", + "example": "Spotify" + }, + "link": { + "type": "string", + "description": "Link to the artist on the platform", + "example": "https://open.spotify.com/artist/..." + } } - ], - "openState": "Open · Closes 9 PM", - "category": "Amusement park", - "price": null, - "layerLabel": "Theme Parks" + } } } }, - "searchQueries": { + "html": { "type": "array", - "description": "Array of query fan-out — the web search queries Copilot ran while generating the response. Automatically included when at least one is available, no surcharge.", + "description": "Raw HTML from Google search page (if requested)", "items": { - "type": "string" + "type": "string", + "format": "uri" }, "example": [ - "best laptops for programming 2025", - "developer laptop reviews" + "https://storage.cloro.dev/results/b83e8dfd-c3a1-4b98-83b9-af91adc21e26/page-1.html" ] - }, - "markdown": { - "type": "string", - "description": "Copilot's response formatted in Markdown (included when include.markdown is true)", - "example": "As an AI assistant, I can help you find great laptops for programming..." - }, - "rawResponse": { - "type": "array", - "description": "Raw upstream provider stream captured during the request. Each item is one chunk from the provider's wire protocol (SSE event, batchexecute frame, etc.). Format is provider-specific, undocumented, and may change without notice — use it for debugging or to access data not yet surfaced in the structured fields above.", - "items": {} } } } } }, - "PerplexityMonitorRequest": { + "GoogleNewsMonitorRequest": { "required": [ - "prompt", + "query", "country" ], "type": "object", "properties": { - "prompt": { - "description": "The prompt to send to Perplexity", + "query": { + "description": "The search query to execute on Google News", "type": "string", "minLength": 1, "maxLength": 10000, - "example": "What are the best laptops for programming?" + "example": "climate change" }, "country": { - "description": "Country/region code for localized response", + "description": "ISO 3166-1 alpha-2 country code for localized news results", "type": "string", "example": "US" }, + "device": { + "description": "Device type for news results", + "type": "string", + "enum": [ + "desktop", + "mobile" + ], + "default": "desktop", + "example": "desktop" + }, + "pages": { + "description": "Number of news results pages to scrape (1-10)", + "type": "integer", + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 1 + }, "include": { - "description": "Optional flags for including additional response formats", + "description": "Optional flags for including additional response data", "type": "object", "properties": { "html": { - "description": "Include a URL to the full HTML of the response", - "type": "boolean", - "default": false, - "example": true - }, - "markdown": { - "description": "Include markdown-formatted response in the result", - "type": "boolean", - "default": false, - "example": true - }, - "rawResponse": { - "description": "Include raw streaming response events", + "description": "Include raw HTML response from Google News", "type": "boolean", "default": false, - "example": true + "example": false } }, "default": { - "html": false, - "markdown": false, - "rawResponse": false + "html": false }, "additionalProperties": false - }, - "state": { - "$ref": "#/components/schemas/StateParameter" } }, "additionalProperties": false }, - "PerplexityMonitorResponse": { + "GoogleNewsMonitorResponse": { "required": [ "success", "result" @@ -6323,337 +4871,68 @@ "example": true }, "result": { - "description": "Perplexity response data", + "description": "Google News results data", "type": "object", "properties": { - "text": { - "type": "string", - "description": "Perplexity's response text", - "example": "Based on current sources and information, here are the best laptops for programming..." - }, - "html": { - "type": "string", - "format": "uri", - "description": "A URL to the full HTML of the response.", - "example": "https://storage.cloro.dev/results/c45a5081-808d-4ed3-9c86-e4baf16c8ab8/page-1.html" - }, - "sources": { + "newsResults": { "type": "array", - "description": "Array of sources referenced in the response", + "description": "News articles from Google News", "items": { "type": "object", "properties": { "position": { "type": "number", - "description": "The position index of the source in the response", - "example": 1 - }, - "url": { - "type": "string", - "description": "The URL of the source", - "example": "https://example.com/article" - }, - "label": { - "type": "string", - "description": "The display label for the source", - "example": "Perplexity Search" - }, - "description": { - "type": "string", - "description": "A description of the source content", - "example": "Real-time web search results" - } - } - }, - "example": [ - { - "position": 1, - "url": "https://techcrunch.com/laptops", - "label": "TechCrunch", - "description": "Latest laptop reviews and recommendations" - }, - { - "position": 2, - "url": "https://www.youtube.com/watch?v=example", - "label": "Best Laptops 2026", - "description": "Video review of programming laptops" - }, - { - "position": 3, - "url": "https://wired.com/programming-laptops", - "label": "Wired", - "description": "Programming laptop buyer's guide" - } - ] - }, - "citationPills": { - "type": "array", - "description": "Inline citation pills extracted from the Perplexity answer. Each entry is one (pill, source) pair: when a pill cites N sources (Perplexity's `[1][2][3]` bracketed groups), the array contains N entries sharing the same `citationPillId` but carrying per-source `label`, `url`, and `domain`. Group by `citationPillId` to recover the pill-level structure. Omitted from `result` when the answer carries no pills.", - "items": { - "type": "object", - "required": [ - "label", - "citationPillId", - "url", - "domain", - "position" - ], - "properties": { - "label": { - "type": "string", - "description": "Per-source title from the sources rail (e.g. `\"Best Programming Laptops 2026 — TechCrunch\"`). Always present; may be an empty string when the rail has no title for this source — read `domain` / `url` for source identity in that case. Entries grouped under the same `citationPillId` carry different per-source labels.", - "example": "Best Programming Laptops 2026 — TechCrunch" - }, - "citationPillId": { - "type": "integer", - "description": "1-based ordinal shared by all entries from the same chip. Group by `citationPillId` to reconstruct the visible chip; the per-source `label` differs across entries within a chip.", - "example": 1 - }, - "url": { - "type": "string", - "description": "Direct URL of the cited source.", - "example": "https://techcrunch.com/laptops" - }, - "domain": { - "type": "string", - "description": "Host extracted from `url`, for grouping and display.", - "example": "techcrunch.com" - }, - "description": { - "type": "string", - "description": "Source description from the sources rail when Perplexity ships one. Omitted when absent.", - "example": "Latest laptop reviews and recommendations" - }, - "position": { - "type": "integer", - "description": "1-based position of this source in the sibling `result.sources` array.", + "description": "Position in news results (1-indexed)", "example": 1 - } - } - }, - "example": [ - { - "label": "Best Programming Laptops 2026 — TechCrunch", - "citationPillId": 1, - "url": "https://techcrunch.com/laptops", - "domain": "techcrunch.com", - "description": "Latest laptop reviews and recommendations", - "position": 1 - }, - { - "label": "Wired Laptop Buyer's Guide", - "citationPillId": 1, - "url": "https://wired.com/programming-laptops", - "domain": "wired.com", - "description": "Programming laptop buyer's guide", - "position": 3 - } - ] - }, - "markdown": { - "type": "string", - "description": "Perplexity's response formatted in Markdown (included when include.markdown is true)", - "example": "Based on current sources and information, here are the best laptops for programming..." - }, - "related_queries": { - "type": "array", - "description": "Suggested follow-up search queries", - "items": { - "type": "string" - }, - "example": [ - "best neighborhoods to stay in Lisbon", - "top-rated luxury hotels in Lisbon under €300", - "highest-rated traditional Portuguese restaurants in Baixa" - ] - }, - "videos": { - "type": "array", - "description": "Video content found in response", - "items": { - "$ref": "#/components/schemas/MediaItem" - } - }, - "images": { - "type": "array", - "description": "Image content found in response", - "items": { - "$ref": "#/components/schemas/MediaItem" - } - }, - "hotels": { - "type": "array", - "description": "Hotel listings (when travel intent detected)", - "items": { - "$ref": "#/components/schemas/HotelItem" - } - }, - "places": { - "type": "array", - "description": "General places and locations", - "items": { - "$ref": "#/components/schemas/PlaceItem" - } - }, - "shopping_cards": { - "type": "array", - "description": "Shopping product cards with detailed product information (when shopping intent detected)", - "items": { - "type": "object", - "properties": { - "tags": { - "type": "array", - "description": "Optional category tags for the shopping card", - "items": { - "type": "string" - }, - "example": [ - "running", - "athletic" - ] }, - "products": { - "type": "array", - "description": "Array of product objects", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string", - "description": "Product name", - "example": "Nike Pegasus 41" - }, - "id": { - "type": "string", - "description": "Product identifier", - "example": "nike-pegasus-41" - }, - "url": { - "type": "string", - "description": "Product page URL", - "example": "https://www.nike.com/t/pegasus-41" - }, - "price": { - "type": "string", - "description": "Current price", - "example": "$140.00" - }, - "merchant": { - "type": "string", - "description": "Merchant name", - "example": "Nike" - }, - "available": { - "type": "boolean", - "description": "Whether the product is currently available", - "example": true - }, - "imageUrls": { - "type": "array", - "description": "Product image URLs", - "items": { - "type": "string" - } - }, - "numReviews": { - "type": "number", - "description": "Number of reviews (0 when none)", - "example": 1284 - }, - "offers": { - "type": "array", - "description": "Shopping offers from individual merchants", - "items": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "Offer URL with Perplexity referral parameters" - }, - "price": { - "type": "string", - "description": "Offer price", - "example": "$140.00" - }, - "merchant_name": { - "type": "string", - "description": "Merchant name", - "example": "Nike" - }, - "product_name": { - "type": "string", - "description": "Product name as listed by the merchant", - "example": "Nike Pegasus 41 Running Shoes" - }, - "available": { - "type": "boolean", - "description": "Whether the offer is in stock", - "example": true - }, - "price_details": { - "type": "object", - "description": "Detailed price breakdown", - "properties": { - "display_price": { - "type": "string", - "description": "Formatted display price", - "example": "$140.00" - } - } - }, - "original_price": { - "type": "string", - "nullable": true, - "description": "Original price before discount; null when not on sale", - "example": null - } - } - } - }, - "position": { - "type": "integer", - "description": "1-indexed rank across all products in all shopping cards in the response (flat, not reset per card)", - "example": 1 - }, - "rating": { - "type": "number", - "description": "Product rating (0-5 scale)", - "example": 4.6 - }, - "original_price": { - "type": "string", - "nullable": true, - "description": "Original price before discount; null when not on sale" - }, - "description": { - "type": "string", - "description": "Product description", - "example": "Responsive cushioning for daily training runs." - }, - "variants": { - "type": "array", - "description": "Product variants (size, color, etc.)", - "items": { - "type": "object" - } - } - } - } + "title": { + "type": "string", + "description": "Title of the news article", + "example": "Major Climate Summit Reaches Historic Agreement" + }, + "link": { + "type": "string", + "description": "URL of the news article", + "example": "https://example.com/climate-summit-agreement" + }, + "snippet": { + "type": "string", + "description": "Text snippet describing the article", + "example": "World leaders agreed on new climate targets at the summit..." + }, + "source": { + "type": "string", + "description": "News source/publisher name", + "example": "The Guardian" + }, + "date": { + "type": "string", + "description": "Publication date", + "example": "2 hours ago" + }, + "page": { + "type": "number", + "description": "Page number this result appeared on (1-indexed)", + "example": 1 + }, + "thumbnail": { + "type": "string", + "description": "Thumbnail image URL (if available)", + "example": "https://example.com/images/climate-summit.jpg" } } } }, - "search_model_queries": { + "html": { "type": "array", - "description": "Internal search queries used to generate response", + "description": "Raw HTML from Google News pages (if requested)", "items": { - "$ref": "#/components/schemas/SearchModelQuery" - } - }, - "rawResponse": { - "type": "array", - "description": "Raw upstream provider stream captured during the request. Each item is one chunk from the provider's wire protocol (SSE event, batchexecute frame, etc.). Format is provider-specific, undocumented, and may change without notice — use it for debugging or to access data not yet surfaced in the structured fields above.", - "items": {} + "type": "string", + "format": "uri" + }, + "example": [ + "https://storage.cloro.dev/results/a12b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6/page-1.html" + ] } } } @@ -7295,212 +5574,6 @@ } } }, - "MediaItem": { - "type": "object", - "description": "Media content (video or image) found in response", - "properties": { - "title": { - "type": "string", - "description": "Media title", - "example": "Best hotels in Lisbon, reviewed | The Independent" - }, - "url": { - "type": "string", - "description": "Media URL", - "example": "https://www.independent.co.uk/travel/europe/portugal/lisbon/best-lisbon-portugal-hotels-b1987832.html" - }, - "thumbnail": { - "type": "string", - "description": "Thumbnail URL", - "example": "https://d2u1z1lopyfwlx.cloudfront.net/thumbnails/636fbd12-6dee-5f44-a76d-fe7f9cd20e40/75ce41cb-6767-5082-a330-ee97c5866886.jpg" - }, - "medium": { - "type": "string", - "description": "Media type", - "enum": [ - "video", - "image", - "map" - ], - "example": "image" - }, - "source": { - "type": "string", - "description": "Source platform", - "example": "web" - }, - "image_width": { - "type": "number", - "description": "Original image width", - "example": 5600 - }, - "image_height": { - "type": "number", - "description": "Original image height", - "example": 3733 - }, - "thumbnail_width": { - "type": "number", - "description": "Thumbnail width", - "example": 300 - }, - "thumbnail_height": { - "type": "number", - "description": "Thumbnail height", - "example": 200 - } - } - }, - "HotelItem": { - "type": "object", - "description": "Hotel listing with detailed information", - "properties": { - "name": { - "type": "string", - "description": "Hotel name", - "example": "Corpo Santo Lisbon Historical Hotel" - }, - "url": { - "type": "string", - "description": "Hotel page URL", - "example": "https://www.tripadvisor.com/Hotel_Review-g189158-d12659702-Reviews-Corpo_Santo_Lisbon_Historical_Hotel-Lisbon_District_Central_Portugal.html" - }, - "rating": { - "type": "number", - "description": "Hotel rating (0-5)", - "example": 4.9 - }, - "num_reviews": { - "type": "number", - "description": "Number of reviews", - "example": 4374 - }, - "address": { - "type": "array", - "description": "Address lines", - "items": { - "type": "string" - }, - "example": [ - "Largo do Corpo Santo, 25, Lisbon 1200-129 Portugal" - ] - }, - "phone": { - "type": "string", - "description": "Phone number", - "example": "+351 21 828 8000" - }, - "description": { - "type": "string", - "description": "Hotel description", - "example": "Located next to the riverside area, in one of the prime areas of the Lisbon Center..." - }, - "image_url": { - "type": "string", - "description": "Main hotel image URL", - "example": "https://media-cdn.tripadvisor.com/media/photo-o/30/28/6c/86/caption.jpg" - }, - "images": { - "type": "array", - "description": "Additional hotel image URLs", - "items": { - "type": "string" - } - }, - "lat": { - "type": "number", - "description": "Latitude", - "example": 38.707397 - }, - "lng": { - "type": "number", - "description": "Longitude", - "example": -9.142318 - }, - "price_level": { - "type": "string", - "description": "Price level indicator" - }, - "categories": { - "type": "array", - "description": "Hotel categories", - "items": { - "type": "string" - }, - "example": [ - "Hotel" - ] - } - } - }, - "PlaceItem": { - "type": "object", - "description": "General place or location information", - "properties": { - "name": { - "type": "string", - "description": "Place name", - "example": "Floresta Das Escadinhas" - }, - "url": { - "type": "string", - "description": "Place page URL", - "example": "https://www.tripadvisor.com/Restaurant_Review-g189158-d1520116-Reviews-Floresta_Das_Escadinhas-Lisbon_District_Central_Portugal.html" - }, - "rating": { - "type": "number", - "description": "Place rating (0-5)", - "example": 4.8 - }, - "address": { - "type": "array", - "description": "Address lines", - "items": { - "type": "string" - }, - "example": [ - "Rua de Santa Justa N°3, Lisbon 1100-483 Portugal" - ] - }, - "lat": { - "type": "number", - "description": "Latitude", - "example": 38.712717 - }, - "lng": { - "type": "number", - "description": "Longitude", - "example": -9.136362 - }, - "categories": { - "type": "array", - "description": "Place categories", - "items": { - "type": "string" - }, - "example": [ - "Healthy", - "Grill", - "Barbecue", - "Mediterranean", - "Portuguese", - "European" - ] - }, - "map_url": { - "type": "string", - "description": "Map URL", - "example": "https://google.com/maps/?q=find+best+hotels+and+restaurants+in+lisbon&ll=38.720914,-9.147162&z=15" - }, - "images": { - "type": "array", - "description": "Place image URLs", - "items": { - "type": "string" - } - } - } - }, "ShoppingCard": { "type": "object", "description": "Shopping product card with detailed product information", @@ -8056,27 +6129,6 @@ } } }, - "SearchModelQuery": { - "type": "object", - "description": "Internal search query used to generate response", - "properties": { - "query": { - "type": "string", - "description": "Actual search query used", - "example": "find best hotels and restaurants in lisbon" - }, - "engine": { - "type": "string", - "description": "Search engine type", - "example": "web" - }, - "limit": { - "type": "number", - "description": "Result limit", - "example": 8 - } - } - }, "StateParameter": { "description": "State code for sub-country geo-targeting (e.g., \"CA\"). Only valid with country \"US\".", "type": "string", diff --git a/pyproject.toml b/pyproject.toml index 055f0c3..8e78650 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 the cloro API — one API for Google Search and every AI answer engine (ChatGPT, Gemini, Perplexity, Copilot, AI Overview, AI Mode)." +description = "Official Python SDK for the cloro API: one API for Google Search and every AI answer engine (ChatGPT, Gemini, AI Overview, AI Mode)." readme = "README.md" requires-python = ">=3.8" license = { text = "MIT" } @@ -16,9 +16,7 @@ keywords = [ "serp api", "ai search", "chatgpt", - "perplexity", "gemini", - "copilot", "google search", "web scraping", "seo", diff --git a/src/cloro/__init__.py b/src/cloro/__init__.py index a5d3a1f..eedae3a 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 and every AI answer engine (ChatGPT, Gemini, -Perplexity, Copilot, AI Overview, AI Mode). Real-time, structured JSON. +AI Overview, AI Mode). Real-time, structured JSON. from cloro import Cloro diff --git a/src/cloro/_client.py b/src/cloro/_client.py index 6b07e39..0a16172 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 and every AI answer engine (ChatGPT, Gemini, - Perplexity, Copilot, AI Overview, AI Mode). Real-time, structured JSON. + AI Overview, AI Mode). 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 d3ec452..493f741 100644 --- a/src/cloro/_version.py +++ b/src/cloro/_version.py @@ -1 +1 @@ -__version__ = "0.2.0" +__version__ = "0.3.0" diff --git a/src/cloro/resources/async_tasks.py b/src/cloro/resources/async_tasks.py index cff2485..d098046 100644 --- a/src/cloro/resources/async_tasks.py +++ b/src/cloro/resources/async_tasks.py @@ -87,8 +87,8 @@ def create( """Enqueue a single task. ``POST /v1/async/task``. Args: - task_type: One of ``CHATGPT``, ``GEMINI``, ``PERPLEXITY``, ``COPILOT``, - ``AIMODE``, ``GOOGLE``, ``GOOGLE_NEWS``. + task_type: One of ``CHATGPT``, ``GEMINI``, ``AIMODE``, ``GOOGLE``, + ``GOOGLE_NEWS``. payload: Provider-specific body (e.g. ``{"prompt": ..., "country": ...}``, or ``{"query": ..., "country": ...}`` for Google Search). priority: 1-10, higher runs first (default 1). diff --git a/src/cloro/resources/monitor.py b/src/cloro/resources/monitor.py index 59836db..53bc67f 100644 --- a/src/cloro/resources/monitor.py +++ b/src/cloro/resources/monitor.py @@ -42,24 +42,6 @@ def gemini( {"prompt": prompt, "country": country, "include": include, **extra}, ) - def perplexity( - self, prompt: str, country: str, *, include: Optional[Dict[str, bool]] = None, **extra: Any - ) -> Any: - """Monitor Perplexity. ``POST /v1/monitor/perplexity``.""" - return self._run( - "/v1/monitor/perplexity", - {"prompt": prompt, "country": country, "include": include, **extra}, - ) - - def copilot( - self, prompt: str, country: str, *, include: Optional[Dict[str, bool]] = None, **extra: Any - ) -> Any: - """Monitor Microsoft Copilot. ``POST /v1/monitor/copilot``.""" - return self._run( - "/v1/monitor/copilot", - {"prompt": prompt, "country": country, "include": include, **extra}, - ) - def aimode( self, prompt: str, country: str, *, include: Optional[Dict[str, bool]] = None, **extra: Any ) -> Any: diff --git a/tests/test_client.py b/tests/test_client.py index afb59c3..925308c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -65,6 +65,12 @@ def handler(request: httpx.Request) -> httpx.Response: assert seen["url"].endswith("/v1/monitor/google") +def test_discontinued_engines_are_not_exposed(): + client = Cloro(api_key="sk_test") + assert not hasattr(client.monitor, "copilot") + assert not hasattr(client.monitor, "perplexity") + + def test_none_values_are_dropped_from_body(): seen = {}