{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Context Distiller: Cut Tokens from HTML, JSON & Logs",
    "description": "Prune HTML, JSON, logs or prose and return query-focused, token-budgeted text for AI agents, with a safe telegraphic compression mode that never drops negations, numbers or code. Standby HTTP for sub-second warm calls. $0.0025 per payload or $0.005 per URL.",
    "version": "0.1",
    "x-build-id": "6TpVhlES5qzwf7tl1"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/geeky_goth_gamer~ai-context-distiller/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-geeky_goth_gamer-ai-context-distiller",
        "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/geeky_goth_gamer~ai-context-distiller/runs": {
      "post": {
        "operationId": "runs-sync-geeky_goth_gamer-ai-context-distiller",
        "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/geeky_goth_gamer~ai-context-distiller/run-sync": {
      "post": {
        "operationId": "run-sync-geeky_goth_gamer-ai-context-distiller",
        "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": {
          "url": {
            "title": "Source URL",
            "type": "string",
            "description": "Optional. One public http(s) page to fetch and distill. Do not also pass text, html or json. Only standard web ports (80, 443, 8080, 8443) are allowed. Private, loopback and metadata addresses are rejected."
          },
          "text": {
            "title": "Inline text",
            "type": "string",
            "description": "Optional. Raw prose, Markdown, CSV or log text to distill (max 2,000,000 characters). Pass this instead of url, html or json. contentType can force the format; otherwise it is auto-detected."
          },
          "html": {
            "title": "Inline HTML",
            "type": "string",
            "description": "Optional. Raw HTML to prune into compact Markdown (scripts, nav, footers, cookie banners and hidden nodes are stripped). Pass this instead of url, text or json."
          },
          "json": {
            "title": "Inline JSON",
            "type": "object",
            "description": "Optional. An API payload to prune (null/empty fields dropped, repeated objects collapsed to a Markdown table, optional keepFields). Pass this instead of url, text or html. A JSON string is also accepted by the HTTP API."
          },
          "contentType": {
            "title": "Content type",
            "enum": [
              "auto",
              "html",
              "json",
              "logs",
              "markdown",
              "csv",
              "text"
            ],
            "type": "string",
            "description": "How to parse the source. \"auto\" (default) sniffs HTML, JSON, CSV, logs or prose. Set this when auto-detection would be wrong.",
            "default": "auto"
          },
          "query": {
            "title": "Query / question",
            "type": "string",
            "description": "Optional. Rank sections by lexical relevance to this question (BM25 plus exact phrase, number and entity boosts). Phrases in \"double quotes\" get an exact-match bonus. Combined with maxTokens to keep only the highest-signal slices."
          },
          "focusTerms": {
            "title": "Focus terms",
            "type": "array",
            "description": "Optional. Extra terms or entities that should be boosted when ranking sections (max 50).",
            "items": {
              "type": "string"
            }
          },
          "maxTokens": {
            "title": "Max tokens (0 = no cap)",
            "minimum": 0,
            "maximum": 128000,
            "type": "integer",
            "description": "Maximum cl100k_base tokens in distilledText. Highest-scoring sections are kept until this budget is filled. 0 means no cap (return everything after pruning and compression). Default 4000.",
            "default": 4000
          },
          "keepFields": {
            "title": "JSON fields to keep",
            "type": "array",
            "description": "Optional. Dot-paths to extract from a JSON payload, e.g. [\"items.*.name\", \"items.*.price\", \"meta.requestId\"]. Use * for every array (or object) item. Other fields are dropped.",
            "items": {
              "type": "string"
            }
          },
          "sectionIds": {
            "title": "Section IDs to return",
            "type": "array",
            "description": "Optional. After a first call (which returns an outline of section ids, headings and token counts), pass sectionIds to pull only those sections. In Standby mode you can send cacheId plus sectionIds to POST /slice without resending the payload.",
            "items": {
              "type": "string"
            }
          },
          "compression": {
            "title": "Compression mode",
            "enum": [
              "none",
              "light",
              "telegraphic"
            ],
            "type": "string",
            "description": "\"none\" (default) keeps the pruned text as-is. \"light\" drops verbose filler phrases and hedges. \"telegraphic\" also drops predictable articles and copulas so a language model can fill the grammar. Never drops or alters negations, logical qualifiers, numbers, dates, URLs, emails, identifiers, headings, quotes, tables or code.",
            "default": "none"
          },
          "includeOutline": {
            "title": "Include section outline",
            "type": "boolean",
            "description": "When on (default), the result includes an outline of section ids, headings and token counts so an agent can inspect the index first and request only the sections it needs.",
            "default": true
          },
          "maxFileSizeMb": {
            "title": "Max download size (MB)",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Larger URL responses are rejected and the call is not billed.",
            "default": 5
          },
          "timeoutSeconds": {
            "title": "URL timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Download time limit when url is set.",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}