cog
Containers for machine learning
Decision gist · record as of 2026-08-14
Yes, if you are packaging ML models for production and want to avoid Dockerfile complexity and CUDA version mismatches. Cog is actively maintained, has low install friction, permissive licensing, and no known vulnerabilities. The main prerequisite is Docker; if you already have it, Cog is a straightforward way to standardize model containerization. Not necessary if you are building inference servers manually or using a higher-level ML platform that handles containerization for you.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Docker must be installed and running.
- Cog is a CLI tool that orchestrates Docker; it does not run without it.
- Low install friction with a pure-Python wheel.
License · maintenance · safety
permissive license (permissive) — Apache License 2.0 is permissive; you can use, modify, and redistribute Cog and derivative works freely provided you include license notices and state changes. No commercial restrictions.
last release 2026-08-14 (0 days) · last repo commit 2026-08-13 · 9,458 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,146,426 downloads/mo, #3,254 on PyPI
Alternatives
Verify before relying
# Install Cog (requires Docker)
pip install cog
# Create cog.yaml and run.py, then:
from cog import BaseRunner, Input
class Runner(BaseRunner):
def run(self, text: str = Input()) -> str:
return f"Processed: {text}"
# Run locally
# cog run -i text="hello"
# Or build and serve
# cog build -t my-model
# cog serve- Whether coglet (a runtime dependency) is an internal Cog module or an external package with its own maintenance status.
- Performance characteristics of the auto-generated Rust/Axum HTTP server under load.
- Compatibility with GPU setups beyond NVIDIA (e.g., AMD ROCm, Apple Metal).
What it is and what it does
Cog is a CLI tool that abstracts away the complexity of containerizing machine learning models for production deployment. You define your model environment and inference logic in simple YAML and Python files, and Cog generates a Docker image with all the best practices baked in: correct CUDA/cuDNN/PyTorch/TensorFlow combinations, efficient layer caching, sensible environment defaults, and automatic OpenAPI schema generation from your Python type hints.
The generated container includes a high-performance HTTP inference server that exposes your model's inputs and outputs as a REST API. You can run it locally for testing, build it as a standalone Docker image for your own infrastructure, or deploy directly to Replicate. Cog handles the glue between research code and production deployment, eliminating the need for researchers to write Dockerfiles or coordinate with engineers on CUDA compatibility.
Use it for
- Package a PyTorch or TensorFlow model with GPU support and deploy it as a REST API without writing a Dockerfile.
- Generate an OpenAPI schema and HTTP server from Python type annotations to serve inference requests.
- Resolve CUDA/cuDNN/framework version conflicts automatically instead of debugging dependency hell manually.
- Test a containerized model locally with `cog run` before building and shipping the Docker image.
- Deploy the same model container to your own Kubernetes cluster or to Replicate's hosted platform.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are packaging ML models for production and want to avoid Dockerfile complexity and CUDA version mismatches.
Cog is actively maintained, has low install friction, permissive licensing, and no known vulnerabilities. The main prerequisite is Docker; if you already have it, Cog is a straightforward way to standardize model containerization. Not necessary if you are building inference servers manually or using a higher-level ML platform that handles containerization for you.
Install
cog on PyPI
Before you install
Low install friction with a pure-Python wheel. The package is actively maintained with a recent release and 9458 GitHub stars. It requires Docker as a system dependency, which is the primary prerequisite for use rather than a Python-level friction point.
Docker must be installed and running. Cog is a CLI tool that orchestrates Docker; it does not run without it.
License in practice
Apache License 2.0 is permissive; you can use, modify, and redistribute Cog and derivative works freely provided you include license notices and state changes. No commercial restrictions.
Quickstart
# Install Cog (requires Docker)
pip install cog
# Create cog.yaml and run.py, then:
from cog import BaseRunner, Input
class Runner(BaseRunner):
def run(self, text: str = Input()) -> str:
return f"Processed: {text}"
# Run locally
# cog run -i text="hello"
# Or build and serve
# cog build -t my-model
# cog serve
Verify before relying
- Whether coglet (a runtime dependency) is an internal Cog module or an external package with its own maintenance status.
- Performance characteristics of the auto-generated Rust/Axum HTTP server under load.
- Compatibility with GPU setups beyond NVIDIA (e.g., AMD ROCm, Apple Metal).
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagestyping_extensionspyyamlstructlogrequestscoglet |
| Maintenance | Actively maintained 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,146,426 / month, #3,254 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13 |
Evidence: cog-0.22.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “docker for machine learning”
- cogCog packages machine learning models into production-ready Docker…
- sagemaker-trainingIntegrates training scripts into Docker containers for use with…
- datarobot-drumDRUM is a command-line tool for developing, testing, and deploying…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also sagemaker-serve · tensorflow-serving-api · cogapp · sagemaker-containers · docker-compose · truss · tensorflow · sagemaker-training · prefect-docker · replicate