{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Token Saver — Deterministic Tools for AI Agents",
    "description": "Cut LLM token spend: 80+ deterministic text, web and data operations (HTML to Markdown, chunking, PII redaction, JSON repair, extraction, dedupe, math, dates) for AI agents, with per-call token-savings estimates.",
    "version": "0.1",
    "x-build-id": "xzjRrqAD3ApcYvMib"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/michiganpublictech~ai-token-saver/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-michiganpublictech-ai-token-saver",
        "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/michiganpublictech~ai-token-saver/runs": {
      "post": {
        "operationId": "runs-sync-michiganpublictech-ai-token-saver",
        "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/michiganpublictech~ai-token-saver/run-sync": {
      "post": {
        "operationId": "run-sync-michiganpublictech-ai-token-saver",
        "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": {
          "operation": {
            "title": "Operation",
            "enum": [
              "extract_headings",
              "extract_images",
              "extract_links",
              "extract_main_content",
              "extract_metadata",
              "extract_tables",
              "fetch_url",
              "html_to_markdown",
              "html_to_text",
              "change_case",
              "chunk_text",
              "classify_by_rules",
              "clean_text",
              "compress_context",
              "count_tokens",
              "deduplicate",
              "detect_language",
              "diff_text",
              "extractive_summary",
              "keywords",
              "near_duplicates",
              "normalize_whitespace",
              "readability",
              "regex_extract",
              "sentiment",
              "slugify",
              "split_sentences",
              "strip_markdown",
              "text_stats",
              "truncate_to_tokens",
              "extract_code_blocks",
              "extract_dates",
              "extract_emails",
              "extract_entities",
              "extract_json",
              "extract_key_values",
              "extract_money",
              "extract_numbers",
              "extract_phone_numbers",
              "extract_urls",
              "detect_secrets",
              "redact_pii",
              "restore_pii",
              "scan_prompt_injection",
              "coerce_to_schema",
              "convert_format",
              "dedupe_records",
              "diff_json",
              "flatten_json",
              "fuzzy_match",
              "infer_json_schema",
              "json_query",
              "json_to_pydantic",
              "json_to_typescript",
              "merge_json",
              "normalize_records",
              "pivot",
              "repair_json",
              "sample_records",
              "statistics",
              "table_query",
              "unflatten_json",
              "validate_json_schema",
              "compound_interest",
              "convert_units",
              "loan_payment",
              "math_eval",
              "percent_change",
              "round_numbers",
              "convert_timezone",
              "cron_explain",
              "cron_next_runs",
              "date_add",
              "date_diff",
              "duration_parse_format",
              "format_datetime",
              "parse_datetime",
              "unix_time",
              "semver_compare",
              "validate",
              "encode_decode",
              "explain_operation",
              "generate_uuid",
              "hash_text",
              "list_operations",
              "random_sample"
            ],
            "type": "string",
            "description": "Operation to run, e.g. html_to_markdown, chunk_text, redact_pii, repair_json, table_query, math_eval, cron_next_runs. Call list_operations (free) for one-line summaries or explain_operation for options. Leave empty when using pipeline."
          },
          "input": {
            "title": "Input text",
            "type": "string",
            "description": "Text, HTML, Markdown or JSON text the operation works on (single mode; also $input of a pipeline). Max 5 MB."
          },
          "url": {
            "title": "URL",
            "type": "string",
            "description": "Public http(s) URL for fetch_url (or the first step of a pipeline). Fetched with SSRF protection; robots.txt respected by default."
          },
          "data": {
            "title": "Data (JSON)",
            "type": "object",
            "description": "JSON input for data operations (validate_json_schema, table_query, convert_format...). To pass an array, wrap it: {\"items\": [...]} — or put JSON text in Input text."
          },
          "options": {
            "title": "Options",
            "type": "object",
            "description": "Operation options as JSON, e.g. {\"maxTokens\": 500} for chunk_text. Unknown options are rejected with a hint; see explain_operation."
          },
          "inputs": {
            "title": "Batch inputs",
            "type": "array",
            "description": "Batch mode: run `operation` with the same options on each item (strings, or JSON values for data operations). Each successful item is charged. Max 10,000."
          },
          "pipeline": {
            "title": "Pipeline",
            "type": "array",
            "description": "Pipeline mode: steps [{\"operation\": ..., \"options\": {...}, \"input\": \"$prev\"}]. Each step gets the previous result by default; references: $input, $prev, $steps[0].field. One charge per executed step. Leave Operation empty."
          },
          "pipelineOutput": {
            "title": "Pipeline output",
            "enum": [
              "last",
              "all"
            ],
            "type": "string",
            "description": "last: one item with the final step's result (default, leanest). all: one item per step.",
            "default": "last"
          },
          "includeStats": {
            "title": "Include token-savings stats",
            "type": "boolean",
            "description": "Add stats (input/output token estimates, LLM-equivalent tokens, estimated tokens and USD saved, ms) to each item.",
            "default": true
          },
          "compactOutput": {
            "title": "Compact output",
            "type": "boolean",
            "description": "Drop null fields from results to save your agent tokens.",
            "default": true
          },
          "llmPricing": {
            "title": "LLM pricing for savings estimates",
            "type": "object",
            "description": "USD per million tokens of the model your agent would otherwise use: {\"inputPerMTok\": 3, \"outputPerMTok\": 15}. Only affects usd_saved_est.",
            "default": {
              "inputPerMTok": 3,
              "outputPerMTok": 15
            }
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "fetch_url obeys robots.txt (RFC 9309). Disable only for sites you are entitled to fetch.",
            "default": true
          },
          "failOnSeverity": {
            "title": "Fail run at severity",
            "enum": [
              "none",
              "critical",
              "high",
              "medium",
              "low"
            ],
            "type": "string",
            "description": "CI gate shared by our Actors. This Actor emits no scored findings, so it has no effect here.",
            "default": "none"
          },
          "disabledRules": {
            "title": "Disabled rules",
            "type": "array",
            "description": "ATS rule IDs whose warnings to suppress (see RULES.md). Requires the custom_rules feature (Pro plan and above).",
            "items": {
              "type": "string"
            }
          },
          "licenseKey": {
            "title": "License key",
            "type": "string",
            "description": "Optional. Enterprise / prepaid license key. Store users don't need one."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}