# magika

> Fast and accurate AI powered file content types detection

- Type: agent or tool
- Field: Developer Tools
- Repository: https://github.com/google/magika
- GitHub stars: 18858
- Licence: Apache-2.0
- Language: Rust
- Last push: 2026-11-24
- Page: https://imutechz.in/agents/magika

## What it is
Magika is an AI-powered file content type detection tool from Google. It uses a small deep learning model (a few MB) to identify file types in milliseconds on a single CPU, trained on roughly 100M samples across 200+ content types. It is available as a Rust command line tool, a Python API, and bindings for Rust, JavaScript/TypeScript and Go.

## Features
- Deep learning model of a few MB for file type detection
- Inference of about 5ms per file on a single CPU
- Trained on 100M samples across 200+ content types
- Command line tool in Rust plus Python API and bindings
- Recursive scanning of directories with -r
- Can process thousands of files at once

## Best for
- Detecting file types for security scanning and routing
- Classifying textual and binary content types
- Batch or recursive file identification on a single CPU
- Embedding file type detection in Python or Rust applications

## Pros
- Achieves 99% average precision and recall on the test set
- Fast inference of about 5ms per file after model load
- Small model footprint of a few MB
- Available as CLI, Python API and multiple language bindings

## Cons
- Model loading is a one-off overhead before inference
- GoLang bindings are listed as work in progress

## Install
```
pip install --pre -U magika
```

Tags: file-type-detection, machine-learning, security, cli, python, rust, content-types
