Cog

Cog

โ˜… 4 ๐Ÿ”– 2500 saves ๐Ÿ’ฐ Free GitHub

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.

Overview

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.

Key Features

  • Declarative cog.yaml configuration instead of fragile, hand-maintained Dockerfiles
  • Automatic resolution of CUDA, cuDNN and PyTorch/TensorFlow version combinations
  • Type-annotated Python predictors generate validated HTTP APIs and OpenAPI schemas automatically
  • Consistent container format that runs the same locally, on-premises and on Replicate
  • Built-in handling of file inputs and outputs, streaming and structured data types
  • Huge ecosystem: thousands of public models on Replicate are packaged with Cog

๐Ÿ’ณ Pricing

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.

Who Is It For

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.

๐Ÿš€ Visit Cog Official Site

๐Ÿšฉ Report an issue