Cog is Replicate’s open-source tool for packaging machine learning models into standard, production-ready Docker containers. With more than 9,400 stars on GitHub and active maintenance through 2026, it has become the default answer to a familiar problem: a model that works in a notebook but is painful to ship.
Cog replaces hand-written Dockerfiles with a short declarative configuration. You list the system packages, Python version and dependencies your model needs, point Cog at a Python class that loads the model and defines typed inputs and outputs, and it generates the container image, resolves compatible CUDA and cuDNN versions, and wraps the model in a standard HTTP API built on FastAPI. The same container runs locally, on your own infrastructure, or on Replicate’s platform unchanged, and input/output schemas are validated automatically from your type annotations.
Cog is free and open source under the Apache License 2.0. Running models on Replicate’s hosted platform is billed by usage, but Cog itself and self-hosted containers cost nothing beyond your own infrastructure.
Cog is for ML engineers and researchers who need to deploy a model as a reliable API without becoming Docker specialists. Teams standardizing model delivery across many projects will appreciate that every model arrives in the same shape, with the same interface conventions and deployment story.