All 46 Dependencies

Every package Cog depends on, ranked by repo health score.

Cog is an open-source command-line tool, built and maintained by Replicate, that packages machine learning models into standard, production-ready Docker containers. Instead of hand-writing a Dockerfile and fighting CUDA, cuDNN, PyTorch, and TensorFlow version mismatches, you describe your model's environment in a short `cog.yaml` file and Cog generates an optimized, multi-stage Dockerfile for you — picking the right Nvidia base image, pinning the right Python version, and layering dependencies efficiently for fast rebuilds.

On the model side, you define a `predict.py` (or the newer `BaseRunner` class) using plain, typed Python: a `setup()` method that loads weights once, and a `predict()`/`run()` method that takes typed `Input` arguments and returns typed outputs like `Path` or `str`. From those type annotations, Cog automatically derives an OpenAPI schema and validates every request and response against it, so there's no API to hand-write and no schema to keep in sync.

Every image Cog builds embeds a self-contained HTTP inference server, so running the container immediately exposes a RESTful `/predictions` endpoint — `docker run` is enough to get a working model API on any machine with Docker (and a GPU, if the model needs one). Under the hood this server is written in Rust (the `coglet` crate, bridged into the Python process via `coglet-python`), giving the request-handling path native performance while keeping the model-authoring experience in familiar Python.

Cog is fully standalone software: the resulting Docker image is vanilla Docker with no proprietary runtime, so it can be deployed to your own infrastructure, any cloud, or a Kubernetes cluster — pushing to Replicate's hosted platform is entirely optional. It's Apache 2.0 licensed, has no paid tier or feature gate, and is developed in the open with an active release cadence and a large community of contributors.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search