replicate/cog v0.21.0
replicate/cog
Captured source
source ↗published Jun 16, 2026seen 1wcaptured 1whttp 200method plain
v0.21.0
Repository: replicate/cog
Tag: v0.21.0
Published: 2026-06-16T20:30:15Z
Prerelease: no
Release notes:
New features
- Server-Sent Event prediction streams. HTTP prediction requests can now ask for
Accept: text/event-streamto receivestart,output,log,metric, and terminalcompletedevents for predictors that explicitly opt in with@streaming/@cog.streaming. Reconnecting clients can replay retained in-flight prediction events withPUT /predictions/{id}. (#3019) - JSON-native union inputs. Cog now supports union-typed predictor inputs in generated schemas and HTTP request handling, allowing compatible JSON-native values to be resolved correctly. (#3048)
Improvements
- Example models now live in the Cog repository. The example models from
replicate/cog-exampleshave moved into this repository underexamples/, with updatedrun.py/BaseRunnerexamples for common workflows including images, training, notebooks, streaming, concurrency, context, and Replicate API usage. (#3055) - Experimental warning for `cog weights`. Every
cog weightssubcommand now prints a warning that the weights workflow is experimental and should not be relied on in production workflows yet. (#3025) - Static schema parser target resolution. The static Python schema parser now uses
run()as the primary prediction entry point while preserving legacypredict()fallback behavior, and resolves inherited and imported targets more consistently. (#3027)
Bug fixes
- `cog.Secret` inputs now work with coglet-backed predictions. Predictors that annotate inputs as
Secret,Optional[Secret], orSecret | Nonenow receivecog.types.Secretvalues at runtime again, restoring behavior that regressed in the Rust/coglet runtime rewrite. (#3057) - `cog doctor --fix` now shows available remediation text. Findings without an auto-fix now display their remediation message instead of incorrectly saying no auto-fix is available. (#3031)
- Cog-managed weight uploads now send the correct layer media type. Weight layer uploads now propagate the Cog weight media type during registry finalization while preserving regular image-layer behavior. (#3033)
- Predictor validation now handles PEP 563 string annotations. Predictor files using
from __future__ import annotationsno longer reject validsetup() -> Nonemethods or accept invalidrun() -> Nonemethods becauseNoneannotations were stored as strings. (#3034) - `cog serve` now mounts weights like `cog run`. Models served locally now receive configured weights consistently with local prediction runs. (#3044)
- Omitted optional inputs now resolve to `None` at the HTTP edge. Optional predictor inputs omitted from HTTP requests are now passed as
Noneinstead of being treated inconsistently by request handling. (#3051)
Notability
notability 3.0/10Routine version update of Cog packaging tool.