{
  "openapi": "3.0.1",
  "info": {
    "title": "AI for Every Row: Bulk LLM to Classify & Summarize Datasets",
    "description": "Run an LLM (GPT, Gemini and more) on every row of a dataset or JSON list, for AI enrichment and sentiment analysis: classify, tag, score, summarize or extract fields, chained after any scraper with datasetId. Answers validated against your schema or labels; $2 per 1,000 valid rows plus model tokens.",
    "version": "0.1",
    "x-build-id": "o4LDQeubekbT04cD1"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/humble-echidna~ai-rows/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-humble-echidna-ai-rows",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/humble-echidna~ai-rows/runs": {
      "post": {
        "operationId": "runs-sync-humble-echidna-ai-rows",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/humble-echidna~ai-rows/run-sync": {
      "post": {
        "operationId": "run-sync-humble-echidna-ai-rows",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "rows": {
            "title": "Rows (JSON array)",
            "type": "array",
            "description": "Your rows as a JSON array of objects, e.g. [{\"id\": \"r1\", \"text\": \"Boils fast, handle stays cool.\"}]; a plain string is the row {\"text\": ...}. The default is three made-up product reviews. Ignored when datasetId is set. At most 20,000 rows per run.",
            "default": [
              {
                "id": "r1",
                "product": "Steel kettle",
                "text": "Boils fast and the handle stays cool. Exactly what I wanted for the price."
              },
              {
                "id": "r2",
                "product": "Steel kettle",
                "text": "Started leaking from the base after two weeks, and support never answered my emails."
              },
              {
                "id": "r3",
                "product": "Desk lamp",
                "text": "Lovely warm light and easy to assemble, but the switch feels flimsy."
              }
            ]
          },
          "datasetId": {
            "title": "Or: rows from a dataset (chain after another actor)",
            "type": "string",
            "description": "Default empty. One of your Apify datasets, picked here or given by id, e.g. a review, lead or job scraper's results; to chain this actor after another in an integration, `{{resource.defaultDatasetId}}`. Each item is one row (rows is ignored). Reads at most 20,000 items per run, read-only, only the fields named in textFields and keepFields."
          },
          "textFields": {
            "title": "Text fields (the only fields sent to the model)",
            "type": "array",
            "description": "The row fields whose values the model reads, e.g. `text`, `title`, `description`; dotted paths like `review.body` work. Only these leave the row: names, emails and every other field are never sent. Each goes as \"field: value\". Default `text`. At most 20.",
            "default": [
              "text"
            ],
            "items": {
              "type": "string"
            }
          },
          "labels": {
            "title": "Labels to choose from (classify)",
            "type": "array",
            "description": "Classification: the model picks exactly one of these for each row, returned as data.label, e.g. positive, negative, mixed (the default). Used only when fields and schema are empty. At most 200 labels; for a label plus other fields, use schema.",
            "default": [
              "positive",
              "negative",
              "mixed"
            ],
            "items": {
              "type": "string"
            }
          },
          "fields": {
            "title": "Or: fields to get (plain English)",
            "type": "string",
            "description": "Default empty. What to get from each row, comma-separated or one per line, e.g. `summary, topics, language`. Add a hint after a colon: `summary: one sentence, under 20 words`. Each becomes a camelCase key in data holding text, a number, true/false, a list of texts or null. Overrides labels; ignored when schema is set. At most 50 fields."
          },
          "schema": {
            "title": "Or: JSON Schema for one record",
            "type": "object",
            "description": "Default empty. A JSON Schema for the object to return per row, with \"type\": \"object\" at the top, e.g. {\"type\": \"object\", \"properties\": {\"label\": {\"enum\": [\"bug\", \"feature\", \"question\"]}, \"score\": {\"type\": \"number\"}}}. Every answer is validated against it; one that doesn't match is returned with valid false and errors, and not charged. Overrides fields and labels."
          },
          "instructions": {
            "title": "Instructions for the model (what to do with each row)",
            "type": "string",
            "description": "Default empty. The task in your words, applied to every row, e.g. `Classify the industry of each company from its description` or `Summarize each article for a newsletter`. At most 4,000 characters."
          },
          "model": {
            "title": "Model (OpenRouter id)",
            "type": "string",
            "description": "The model that reads each row, as an OpenRouter model id. Default `openai/gpt-4.1-mini`. Cheaper for big batches of short rows: `openai/gpt-4.1-nano` or `google/gemini-2.5-flash-lite`. It must support structured outputs. Its tokens are billed to your Apify account by Apify's OpenRouter actor, at its prices.",
            "default": "openai/gpt-4.1-mini"
          },
          "keepFields": {
            "title": "Fields to copy to the output (for joins)",
            "type": "array",
            "description": "Default empty. Row fields copied unchanged into each result's kept object, so you can join results back, e.g. `id`, `url`, `placeId`. They are not sent to the model (unless also in textFields). Every result also has sourceIndex, the row's position. At most 20.",
            "items": {
              "type": "string"
            }
          },
          "onlyNew": {
            "title": "Only new rows (skip rows already processed)",
            "type": "boolean",
            "description": "Default false. When true, rows whose text this same setup (schema or fields or labels, instructions, model, textFields) already answered validly in an earlier run are skipped and not charged, so a scheduled run after a scraper only pays for new rows. Remembered per text hash in your account.",
            "default": false
          },
          "maxRows": {
            "title": "Max rows per run",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Send at most this many rows to the model, in input order (with onlyNew, the first new rows), e.g. 100 for a test. From 1 to 20000; leave empty (the default) for every row. The run also stops cleanly at the maximum cost per run you set in the run options."
          },
          "maxTokensPerRow": {
            "title": "Max tokens of text per row",
            "minimum": 100,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on each row's text sent to the model, in tokens (about 4 characters each). Default 4000. A longer text keeps its start and has truncated true. From 100 to 100000. Lower it to cut token cost on long texts.",
            "default": 4000
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}