If you have been running models on Replicate using Cog, this guide shows how to convert your Cog model to aDocumentation Index
Fetch the complete documentation index at: https://fal.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
fal.App. The core idea is similar: both platforms package a model with its dependencies and expose a predict/generate interface. The main differences are that fal uses a Python class instead of a cog.yaml + predict.py pattern, and fal builds containers from a requirements list or Dockerfile rather than relying on Cog’s build system.
For a broader overview of deploying existing Docker containers on fal (regardless of where they came from), see Deploy an Existing Server. If you are comparing fal to other platforms, see Migrate from Modal or Migrate from RunPod.
Concept Mapping
| Replicate (Cog) | fal | Notes |
|---|---|---|
cog.yaml | requirements = [...] or ContainerImage | Environment definition |
class Predictor(BasePredictor) | class MyApp(fal.App) | App class |
def setup(self) | def setup(self) | One-time model loading |
def predict(self, ...) | @fal.endpoint("/") | Request handler |
cog.Path (file output) | fal.toolkit.Image / fal.toolkit.File | Media outputs uploaded to CDN automatically |
Input(...) type hints | Pydantic BaseModel | fal uses standard Pydantic for input validation |
cog push | fal deploy | Single CLI command |
| Replicate API client | fal_client.subscribe(...) | HTTP + queue based |
| Webhooks | webhook_url parameter | Both support webhook delivery |
Migration Path: Cog Predictor to fal.App
The most common Cog pattern is aPredictor class with setup() and predict() methods. On fal, setup() stays the same, and predict() becomes an @fal.endpoint method with Pydantic input/output models.
- Replicate (Cog)
- fal
cog.yaml is replaced by class attributes (machine_type, requirements). The cog.Path output is replaced by fal.toolkit.Image, which automatically uploads the image to the fal CDN and returns a URL. Inputs use standard Pydantic models instead of Cog’s Input() type hints. Imports happen inside setup() so they run on the remote runner, not on your local machine (see Serialization and Build for why).
Using Your Existing Cog Dockerfile
If you have a complexcog.yaml with system packages, CUDA configuration, or custom build steps, you can extract the Dockerfile that Cog generates and use it directly with fal. Run cog debug to output the generated Dockerfile:
- Remove the
COPY . /src,EXPOSE, andCMDlines at the end - fal handles these - Remove the Cog wheel installation (
cog-0.0.1.dev-py3-none-any.whl) since fal does not use the Cog runtime - Replace the Cog requirements with your actual pip packages
requirements list approach is simpler and avoids dealing with Cog’s generated Dockerfile. Use the Dockerfile approach only when you have system-level dependencies or a specific CUDA version that cannot be expressed through pip packages. See Custom Container Images for the full guide.
cog debug is a hidden debugging command with no stability guarantees from the Cog team. The generated Dockerfile format may change between Cog versions.