rholshausen
04/21/2026, 1:34 AMrholshausen
04/21/2026, 1:44 AMMatt (pactflow.io / pact-js / pact-go)
rholshausen
05/05/2026, 6:41 AMMagika is entirely local β no external services, no network calls.
Here's what's happening under the hood:
β’ Google's Magika file type detection library is powered by, which is a Rust wrapper around Microsoft's ONNX Runtime. This means inference runs on a locally bundled ONNX model, entirely in-process. ort Docsort
β’ Magika uses the high-performance ONNX Runtime for model inference and Tokio for asynchronous parallel processing β both of which operate purely on local CPU resources. Google Open Source
β’ The API works by creating athat can identify files from their path or from content read directly from memory β there's no remote endpoint involved anywhere in that flow. Lib.rsSession
The model weights are bundled into the crate itself (that's what the/sync.shtooling in the repo is for β baking a new model into the library when one is released). When you callgenoridentify_file, it feeds bytes into the local ONNX model and returns results without touching the network.identify_content
So you're safe to use it in air-gapped or privacy-sensitive environments. The only "AI" involved is a small neural network running locally via ONNX Runtime.
rholshausen
05/05/2026, 6:42 AMrholshausen
05/05/2026, 6:46 AMHow it actually reads files: Magika's deep learning system processes three sequences of 512 bytes β from the start, middle, and end of each file. So it reads ~1.5KB total, regardless of file size. This is what allows it to distinguish things like JSON vs JSONL, C vs C++, or JavaScript vs TypeScript, where magic bytes alone are useless.
Matt (pactflow.io / pact-js / pact-go)