{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Dataset Enricher - Bulk LLM Classify, Tag & Summarise",
    "description": "Run one AI prompt over every row of an Apify dataset, CSV/Excel/JSON file or pasted rows: classify, tag, score sentiment, summarise, translate or extract into typed fields you define. Cheap LLM via Apify's OpenRouter, billed at cost to your account. $0.70 per 1,000 rows plus tokens.",
    "version": "0.1",
    "x-build-id": "W4d4ZtRGXUZ0NEHA9"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/actor-forge~ai-dataset-enricher/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-actor-forge-ai-dataset-enricher",
        "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/actor-forge~ai-dataset-enricher/runs": {
      "post": {
        "operationId": "runs-sync-actor-forge-ai-dataset-enricher",
        "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/actor-forge~ai-dataset-enricher/run-sync": {
      "post": {
        "operationId": "run-sync-actor-forge-ai-dataset-enricher",
        "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",
        "required": [
          "prompt"
        ],
        "properties": {
          "rows": {
            "title": "Rows (JSON)",
            "type": "array",
            "description": "Rows pasted as a JSON array of objects. You can also (or instead) pick a dataset or give a file URL below."
          },
          "datasetId": {
            "title": "Dataset",
            "type": "string",
            "description": "An Apify dataset to enrich, e.g. the output of a reviews, jobs or leads scraper. Picking it here gives this run read access to it."
          },
          "fileUrl": {
            "title": "File URL (CSV, JSON, Excel)",
            "type": "string",
            "description": "A public CSV/TSV, JSON, JSON Lines or XLSX file (first row = column names, up to 50 MB)."
          },
          "prompt": {
            "title": "What should the AI do with each row?",
            "type": "string",
            "description": "Plain-English instruction applied to every row, e.g. \"Classify the review's sentiment and main topic\", \"Write a 20-word summary\", \"Translate the title to English\", \"Extract the company name and job seniority\" or \"Is this lead a B2B SaaS company? Answer true/false with a reason\"."
          },
          "outputSchema": {
            "title": "Output fields",
            "type": "object",
            "description": "The fields to add, as {\"field\": \"description or type\"} (types number, integer, boolean and array are converted), or a full JSON Schema (also sent as a structured-output schema). Empty: the model returns any JSON object."
          },
          "inputFields": {
            "title": "Fields sent to the model",
            "type": "array",
            "description": "Only send these fields of each row (dot paths allowed), to save tokens and keep private columns out of the prompt. Empty: the whole row.",
            "items": {
              "type": "string"
            }
          },
          "outputMode": {
            "title": "Output",
            "enum": [
              "merge",
              "enrichedOnly"
            ],
            "type": "string",
            "description": "Merge: the original row plus the new fields. Enriched only: just the new fields and _rowIndex.",
            "default": "merge"
          },
          "outputPrefix": {
            "title": "Prefix for new fields",
            "type": "string",
            "description": "Optional prefix such as ai_ so new fields never overwrite existing columns.",
            "default": ""
          },
          "model": {
            "title": "AI model",
            "type": "string",
            "description": "Any OpenRouter model id (openrouter.ai/models), e.g. google/gemini-2.5-flash-lite (default: cheap and fast), openai/gpt-5-nano, openai/gpt-4o-mini or google/gemini-2.5-flash (smarter). Tokens are billed to your Apify account at OpenRouter rates.",
            "default": "google/gemini-2.5-flash-lite"
          },
          "maxLlmCostUsd": {
            "title": "Max AI token cost per run (USD)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Hard cap on the AI token charges this run may cause on your Apify account (estimated, including the 10× free-plan rate when it applies). The worst case of each row (its prompt plus maxOutputTokens) is reserved before the call; the run stops cleanly when the next row would pass the cap. Separate from this actor's per-row fee, which the run's maximum total charge limits.",
            "default": 0.1
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Process at most this many rows.",
            "default": 1000
          },
          "maxInputTokensPerRow": {
            "title": "Max input tokens per row",
            "minimum": 100,
            "maximum": 50000,
            "type": "integer",
            "description": "Rows larger than this (≈3 characters per token) are skipped with a free row; select fewer fields to fit.",
            "default": 2000
          },
          "maxOutputTokens": {
            "title": "Max output tokens per row",
            "minimum": 20,
            "maximum": 16000,
            "type": "integer",
            "description": "max_tokens for each reply. A few labels need ~50; a summary ~150; long extractions more.",
            "default": 400
          },
          "estimateOnly": {
            "title": "Estimate cost only",
            "type": "boolean",
            "description": "Read the rows and report the expected AI token cost and this actor's fee without calling the model (one free row).",
            "default": false
          },
          "allowPersonalData": {
            "title": "Allow personal contact data",
            "type": "boolean",
            "description": "Off (default): the model is told not to output private individuals' personal contact details and personal-looking email addresses in its output are replaced. Switch on only if you have a lawful basis.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}