Sign inSign up

jjaniec/magika-http

By jjaniec

•Updated about 1 month ago

HTTP wrapper for google/magika, multi-arch support and periodic rebuilds

Image
Machine learning & AI
Web servers
1

2.9K

jjaniec/magika-http repository overview

⁠magika-http

HTTP wrapper for Google Magika⁠ — AI-powered file-type detection.

Send any file to this service over HTTP and get back accurate content-type information powered by Magika's deep-learning model (~99% accuracy across 200+ content types).

Source: github.com/jjaniec/magika-http⁠


⁠Tags

TagDescription
latestMost recent build
<magika-version> (e.g. 1.0.2)Build pinned to that Magika release

Images are rebuilt automatically every Sunday at midnight UTC to pick up OS and dependency updates.


⁠Quick start

docker run -p 8080:8080 jjaniec/magika-http
⁠Scan a file
curl -X POST http://localhost:8080/scan \
  -F "file=@/path/to/your/file"
{
  "ok": true,
  "label": "python",
  "mime_type": "text/x-python",
  "group": "code",
  "description": "Python source",
  "extensions": ["py", "pyi"],
  "is_text": true,
  "score": 0.997,
  "scan_duration_ms": 3.142
}
⁠Health check
curl http://localhost:8080/healthz
{
  "status": "ok",
  "model_ready": true,
  "model_version": "standard_v3_3",
  "magika_version": "1.0.2"
}

⁠Endpoints

MethodPathDescription
GET/healthzHealth check — confirms the model is loaded and ready
POST/scanIdentify the content type of an uploaded file
GET/docsInteractive Swagger UI
GET/redocReDoc API documentation

⁠Environment variables

VariableDefaultDescription
PORT8080Port the server listens on
HOST0.0.0.0Host the server binds to
OTEL_SERVICE_NAMEmagika-httpOpenTelemetry service name
OTEL_EXPORTER_OTLP_ENDPOINT(empty)OTLP gRPC collector endpoint. When unset, spans are printed to stdout
OTEL_SDK_DISABLEDfalseSet to true to disable all OpenTelemetry tracing (suppresses console output when no collector is configured)
⁠With OpenTelemetry export
docker run -p 8080:8080 \
  -e OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 \
  -e OTEL_SERVICE_NAME=magika-http \
  jjaniec/magika-http

⁠OpenTelemetry instrumentation

  • Auto-instrumentation — every HTTP request produces a span (method, route, status code, latency)
  • magika.scan span — emitted on every /scan call with attributes:
    • file.name, file.size_bytes
    • magika.scan_duration_ms — inference time in milliseconds
    • magika.result.label, magika.result.mime_type, magika.result.score

Tag summary

Content type

Image

Digest

sha256:daefa82fd…

Size

138.5 MB

Last updated

about 1 month ago

docker pull jjaniec/magika-http