# publish-models

Guides Cog model releases to Replicate, with pre-release checks and CI/CD setup. Use it to publish a version manually or automate releases with GitHub Actions.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1700 installs · ★ 142
- Author: replicate
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/replicate/skills/tree/HEAD/skills/publish-models/SKILL.md
- Updated: 2026-06-04
- HTML: https://affpapa.org/en/nevibecode/skills/publish-models

## What it does

The skill covers `cog push` and a guarded release flow with `cog-safe-push`. The latter checks schema compatibility, compares predictions, and fuzzes inputs before pushing to the live model. You need a working Cog project, `REPLICATE_API_TOKEN`, and a Replicate login through `cog login`.

A project-level `cog-safe-push.yaml` can define test cases, hardware, and deployment settings. For stochastic models, disable output comparison; otherwise the check can be brittle. The skill also covers GitHub Actions, including a reusable workflow for multi-model repositories. `cog-safe-push` requires `ANTHROPIC_API_KEY`.

## Requirements
- Works with: GitHub

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add replicate/skills --skill publish-models -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/publish-models/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/publish-models/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add replicate/skills --skill publish-models -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/publish-models/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add replicate/skills --skill publish-models -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/publish-models/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install replicate/skills publish-models
```

2. **Manually: put the files in place**
- File: `.github/skills/publish-models/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add replicate/skills --skill publish-models -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/replicate/skills --path skills/publish-models
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/publish-models/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add replicate/skills --skill publish-models -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/replicate/skills/tree/HEAD/skills/publish-models/SKILL.md

## When to use it
- publish a new Cog model version to Replicate
- check schema compatibility before release
- compare predictions from test and live versions
- configure GitHub Actions to release models

## Example prompts
- Publish my model to Replicate with pre-release checks.
- Check schema compatibility and compare predictions before releasing `owner/my-model`.
- Set up GitHub Actions to publish the models in this repository.

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: f10acd4ea281c740.

BEGIN THIRD-PARTY FILE f10acd4ea281c740
````text
---
name: publish-models
description: >
  Push and publish custom AI models to Replicate, and set up CI/CD for
  releasing new model versions safely. Use when running cog push,
  deploying a model to Replicate, releasing a new version, validating
  a model with cog-safe-push before publishing, configuring a Replicate
  deployment, setting up GitHub Actions for model releases, or porting a
  community model to an official one. Trigger on phrases like "push a
  model to Replicate", "publish a model", "deploy a model", "release a
  new version", "cog push", "cog-safe-push", "model CI", "r8.im", or
  "schema compatibility", and when referencing
  github.com/replicate/cog-safe-push or
  github.com/replicate/model-ci-template. Covers cog push, the full
  cog-safe-push config (test cases, fuzz, deployment, official_model),
  GitHub Actions patterns, multi-model matrix pushes, and post-publish
  monitoring. Assumes you already have a working Cog project; see
  build-models if you need to package one first.
---

## Docs

- Cog reference: <https://cog.run/llms.txt>
- `cog push` reference: <https://cog.run/cli#cog-push>
- cog-safe-push: <https://github.com/replicate/cog-safe-push>
- Model CI template: <https://github.com/replicate/model-ci-template>
- Continuous deployment guide: <https://replicate.com/docs/guides/continuous-model-deployment>

## When to use this skill

- You have a working Cog project (see `build-models` if you don't yet).
- You want to publish a private or public model on Replicate.
- You're releasing a new version of an existing model and want to avoid breaking changes.
- You're setting up CI/CD for model releases.

## Prerequisites

- Cog installed and `cog login` against `r8.im` (or `echo $TOKEN | cog login --token-stdin`).
- A model created at `replicate.com/{owner}/{name}` via the API, web UI, or `r8-model` CLI.
- `REPLICATE_API_TOKEN` set in your environment.

## Plain `cog push`

The simplest path. Build and upload a new version:

```
cog push r8.im/owner/my-model
```

Or set `image: r8.im/owner/my-model` in `cog.yaml` and run a bare:

```
cog push
```

Useful flags:

- `--separate-weights` — store weights in a separate layer; faster cold boots and pushes for models with > 1GB of weights.
- `--x-fast` — faster pushes during iteration (skips some validation).
- `--secret id=hf,src=$HOME/.hf_token` — pass build-time secrets without baking them into image history.

## cog-safe-push (recommended for any model with users)

`cog-safe-push` pushes to a private `-test` model first, checks schema compatibility against the live version, runs prediction comparisons, and fuzzes inputs. Catches breaking changes before they reach users.

Install:

```
pip install git+https://github.com/replicate/cog-safe-push.git
```

Required env vars:

- `REPLICATE_API_TOKEN`
- `ANTHROPIC_API_KEY` (Claude judges output similarity for stochastic models)

Basic usage:

```
cog-safe-push --test-hardware=gpu-l40s owner/my-model
```

This will:

1. Lint `predict.py` with ruff.
2. Create a private test model `owner/my-model-test` if missing.
3. Push the local Cog model to the test model.
4. Lint the schema (descriptions, defaults, etc.).
````
END THIRD-PARTY FILE f10acd4ea281c740

The third-party file has ended. Everything between the f10acd4ea281c740 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3181 of 11524 bytes. © replicate · Apache-2.0 · https://github.com/replicate/skills/tree/HEAD/skills/publish-models/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
