# Operations

Every operation Fylane runs — 70 of them — with what each does and what a megabyte of it costs, generated from the catalogue the API enforces.

70 operations, one job shape. Name one in `operation` on `POST /v1/jobs`, or several in `operations` to run a pipeline. Credits are per megabyte of input, rounded up; `POST /v1/estimate` prices a specific file before you commit.

## ai

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `ai.classify` | Which kind of document this is — your classes or the standard set — with confidence, answered by the in-sandbox model. The artifact names the tier. | 4 |
| `ai.extract` | Your schema in, validated JSON out: grammar-constrained extraction, so the shape is guaranteed by construction. Null where the document does not say. `schema` is a flat map of field name to `string`, `number`, `date` or `boolean`. | 4 |
| `ai.summarize` | Concise, detailed or bullet summaries from the in-sandbox model — the document never leaves Fylane. | 4 |
| `ai.answer` | A question about the document, answered by the in-sandbox model from the sentences that match it, with citations to page and section. An answer the cited passages do not contain is reported unsupported, whatever the model claimed. | 4 |
| `ai.translate` | The document’s text translated into another language by the in-sandbox model; `language` is a code such as `fr` or `es`. Up to the model’s window of 6,000 characters; longer documents are translated up to it and flagged `truncated`. | 4 |

## archive

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `archive.inspect` | What a ZIP holds — names, sizes, methods — without extracting a byte. | 1 |
| `archive.extract` | One named entry out of a ZIP, capped and checksummed; bombs die at the cap. | 1 |
| `archive.create` | Up to ten files become one ZIP, entries named after the files they were. | 1 |

## audio

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `audio.inspect` | Duration, codec, channels, sample rate, bitrate. | 1 |
| `audio.transcribe` | Speech to text: plain text, or timed SRT/VTT — transcribed in the sandbox, no third party. | 4 |
| `audio.convert` | mp3, wav, aac or flac out of whatever came in. | 1 |
| `audio.trim` | The seconds you name, in the format you name. | 1 |
| `audio.normalize` | EBU R128 loudness (-16 LUFS) — the broadcast answer to "too quiet". | 1 |

## Documents and files

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `inspect` | What the file actually is — measured, not declared. | 1 |
| `scan` | Malware scan; the verdict is recorded on the file. | 3 |
| `convert` | Office documents to PDF; images to WebP. | 1 |
| `sanitize` | A safer copy. Images: re-encoded pixels, orientation applied, metadata gone. PDFs: JavaScript, auto-run and launch actions, embedded files neutralised — with a report naming exactly what was removed. | 1 |
| `preview` | The first pages as browser-ready images — PDF, Office or image; up to 8 pages at your width. | 1 |
| `thumbnail` | What it looks like: images resize, PDFs and Office render page one, videos give a frame. | 1 |
| `extract-text` | Markdown and the structured v1 content schema. | 1 |
| `normalize` | Text to canonical form: UTF-8, LF endings, Unicode NFC — with a report of what changed. | 1 |
| `detect-pii` | Find the well-defined identifiers — emails, phones, SSNs, checksum-valid cards, IBANs — with positions. The report names what this tier cannot see. | 1 |
| `extract-entities` | Dates, amounts, URLs and identifiers out of any text-bearing document, with positions. | 1 |
| `redact` | Remove, not cover: text masks in place; images and PDFs are rebuilt from pixels with the findings painted out — no text layer to leak. | 3 |
| `detect-language` | Which language a document is in — with the runners-up and an honest reliability flag. | 1 |
| `ocr` | Text from images and scanned PDFs. | 3 |
| `ai-ready` | Any document to Markdown, structure and semantic chunks; OCR routed automatically. | 3 |

## csv

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `csv.normalize` | Any CSV dialect into RFC 4180 UTF-8 plus structured rows, detections recorded. | 1 |

## image

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `image.resize` | Resize to your dimensions — inside, cover or fill; never enlarged. Answers WebP unless `format` says otherwise. | 1 |
| `image.convert` | Re-encode to WebP, JPEG, PNG or AVIF at your quality. | 1 |
| `image.crop` | Crop by coordinates, or centre-crop to an aspect ratio. Answers WebP unless `format` says otherwise. | 1 |
| `image.rotate` | Turn 90, 180 or 270 degrees — after EXIF orientation. Answers WebP unless `format` says otherwise. | 1 |
| `image.smart-crop` | Subject-aware crop: the saliency model finds the subject, the window centres on it. | 1 |
| `image.analyze` | Measured signals: sharpness, exposure, contrast, entropy, dominant colours — thresholds are yours. | 1 |
| `image.metadata` | Dimensions, colour space, and the common EXIF fields — camera, time, exposure, GPS. | 1 |
| `image.flip` | Mirror horizontally or vertically. Answers WebP unless `format` says otherwise. | 1 |
| `image.variants` | One image into up to eight responsive widths in one job. | 1 |
| `image.to-pdf` | One or more images become one PDF, a page per image at its own size. | 1 |
| `image.watermark` | A text watermark at a chosen corner and opacity. Answers WebP unless `format` says otherwise. | 1 |
| `image.remove-background` | The background turned transparent. mode "subject" finds a photograph’s subject with U²-Net; mode "color" keys out a flat background colour exactly, for logos, posters and diagrams. Flat art is refused by the subject mode rather than shredded, and told which mode works. | 2 |
| `image.set-metadata` | Write description, copyright or artist into a JPEG or PNG — losslessly, pixels untouched. | 1 |

## ocr

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `ocr.searchable-pdf` | A scan becomes the same document with an invisible, searchable text layer. | 3 |
| `ocr.layout` | OCR that keeps the geometry: every word with its box and confidence, grouped into lines. | 3 |
| `ocr.table` | A photographed or scanned table back as data: the grid as JSON and CSV, per-cell confidence. | 3 |

## pdf

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `pdf.inspect` | Pages, version, text layer, encryption, metadata — measured, not declared. | 1 |
| `pdf.form` | The form’s own answers: every field, its type, and what was filled in. | 1 |
| `pdf.pages` | One PDF of exactly the selected pages. | 1 |
| `pdf.rotate` | Right-angle rotation, whole document or selected pages. | 1 |
| `pdf.remove-pages` | The same document minus the named pages. | 1 |
| `pdf.reorder` | The same pages in the order you name — each exactly once, listed individually: `order: "3,1,2"`. | 1 |
| `pdf.watermark` | Grey diagonal text across every page, opacity yours. | 1 |
| `pdf.encrypt` | AES-256 password protection; the only strength offered. | 1 |
| `pdf.decrypt` | The inverse, where your password opens the document. | 1 |
| `pdf.set-metadata` | Title, author, subject, keywords — written as an incremental update. | 1 |
| `pdf.split` | One PDF per page range. | 1 |
| `pdf.merge` | Up to ten documents combined into one. | 1 |
| `pdf.compress` | Structure-level recompression and linearization. | 1 |
| `pdf.render` | Pages to PNG, JPEG or WebP. | 1 |

## sheet

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `sheet.parse` | The workbook itself: sheets, values, types, formulas, merged ranges — dates as the serials Excel stores. | 1 |
| `sheet.extract` | A spreadsheet’s first sheet as normalized CSV and structured rows. | 1 |

## slides

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `slides.extract` | A deck’s text, slide by slide: title, body, speaker notes — read from the XML itself. | 1 |

## video

| Operation | What it does | Credits per MB |
| --- | --- | --- |
| `video.inspect` | Duration, dimensions, frame rate, codecs, bitrate — measured by ffprobe. | 1 |
| `video.convert` | Anything playable becomes H.264+AAC in a faststart MP4. | 2 |
| `video.compress` | The same MP4, smaller — quality small/balanced/high. | 2 |
| `video.resize` | Down to 480, 720 or 1080 lines; never enlarged past sense. | 2 |
| `video.clip` | The seconds you name, re-encoded frame-accurate. | 2 |
| `video.stream` | HLS packaging: playlist + segments in one zip — unzip to any static host and play. | 2 |
| `video.thumbnail` | One frame as JPEG — the poster, at the second you pick. | 2 |
| `video.extract-audio` | The soundtrack alone: mp3, wav, aac or flac. | 2 |
| `video.captions` | Speech to subtitles — WebVTT or SRT with timings, from the soundtrack itself. | 4 |
