### Install all-the-public-replicate-models Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Install the package using npm. ```sh npm install all-the-public-replicate-models ``` -------------------------------- ### Load Lite Model Metadata (JS) Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Import and log basic public Replicate model metadata. This is a smaller subset, approximately 375KB. ```javascript import models from 'all-the-public-replicate-models/lite' console.log(models) ``` -------------------------------- ### Load Full Model Metadata (JS) Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Import and log all public Replicate model metadata. This includes approximately 17MB of data. ```javascript import models from 'all-the-public-replicate-models' console.log(models) ``` -------------------------------- ### Load Model Stats (JS) Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Import historical daily run counts for models and log the last 5 entries for a specific model. The stats are updated daily. ```javascript import stats from 'all-the-public-replicate-models/stats' console.log(stats["black-forest-labs/flux-schnell"].slice(-5)) /* [ { date: '2025-01-03', totalRuns: 176951005, dailyRuns: 1071498 }, { date: '2025-01-04', totalRuns: 178025758, dailyRuns: 1074753 }, { date: '2025-01-05', totalRuns: 179119496, dailyRuns: 1093738 }, { date: '2025-01-06', totalRuns: 180272877, dailyRuns: 1153381 }, { date: '2025-01-07', totalRuns: 181445133, dailyRuns: 1172256 } ] */ ``` -------------------------------- ### Dump All Model Metadata with CLI Source: https://context7.com/replicate/all-the-public-replicate-models/llms.txt Use the CLI aliases (`all-the-public-replicate-models`, `all-the-replicate-models`, `replicate-models`) to output all model metadata as JSON to stdout. This enables piping the data to other command-line tools for further processing. ```bash # Dump all model metadata to stdout npx all-the-public-replicate-models ``` ```bash # Save all model data to a local file npx all-the-public-replicate-models > models.json ``` ```bash # Use replicate-models shorthand alias npx replicate-models | jq 'length' # 12000 ``` -------------------------------- ### Import Lite Model Metadata Source: https://context7.com/replicate/all-the-public-replicate-models/llms.txt Imports a lightweight array containing only the seven most useful fields per model. Find all text-to-image models and inspect the keys of a lite model. ```js import models from 'all-the-public-replicate-models/lite'; // Find all text-to-image models const textToImage = models.filter(m => m.description?.toLowerCase().includes('text-to-image') ); console.log(`Text-to-image models: ${textToImage.length}`); // Each lite model has only 7 fields const liteModel = models[0]; console.log(Object.keys(liteModel)); // [ 'url', 'owner', 'name', 'description', 'run_count', 'cover_image_url', 'github_url' ] ``` -------------------------------- ### Import Historical Run Count Statistics Source: https://context7.com/replicate/all-the-public-replicate-models/llms.txt Imports a dictionary keyed by "owner/name" with daily run-count snapshots for the last 31 days. Look up a specific model's recent stats and find fastest-growing models. ```js import stats from 'all-the-public-replicate-models/stats'; // Look up a specific model's recent stats const fluxStats = stats["black-forest-labs/flux-schnell"]; // Get the last 5 days console.log(fluxStats.slice(-5)); // [ // { date: '2025-01-03', totalRuns: 176951005, dailyRuns: 1071498 }, // { date: '2025-01-04', totalRuns: 178025758, dailyRuns: 1074753 }, // { date: '2025-01-05', totalRuns: 179119496, dailyRuns: 1093738 }, // { date: '2025-01-06', totalRuns: 180272877, dailyRuns: 1153381 }, // { date: '2025-01-07', totalRuns: 181445133, dailyRuns: 1172256 } // ] // Find fastest-growing models over the past week const recentGrowth = Object.entries(stats) .map(([nwo, history]) => { const lastWeek = history.slice(-7); const totalDailyRuns = lastWeek.reduce((sum, d) => sum + d.dailyRuns, 0); return { nwo, totalDailyRuns }; }) .sort((a, b) => b.totalDailyRuns - a.totalDailyRuns) .slice(0, 5); console.log("Fastest growing models this week:", recentGrowth); // [ // { nwo: 'black-forest-labs/flux-schnell', totalDailyRuns: 7838124 }, // { nwo: 'black-forest-labs/flux-dev', totalDailyRuns: 2341000 }, // ... // ] ``` -------------------------------- ### Save Model Metadata to File (CLI) Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Use the CLI tool to redirect the output of all model metadata to a JSON file named 'models.json'. ```command npx all-the-public-replicate-models > models.json ``` -------------------------------- ### Import Full Model Metadata Source: https://context7.com/replicate/all-the-public-replicate-models/llms.txt Imports the complete array of all public Replicate models with full metadata. Inspect a single model's structure. ```js import models from 'all-the-public-replicate-models'; // models is an array of model objects console.log(`Total models: ${models.length}`); // Total models: 12000+ // Inspect a single model's structure const model = models[0]; console.log({ owner: model.owner, // e.g. "stability-ai" name: model.name, // e.g. "stable-diffusion" url: model.url, // e.g. "https://replicate.com/stability-ai/stable-diffusion" description: model.description, // e.g. "A latent text-to-image diffusion model..." run_count: model.run_count, // e.g. 52341829 cover_image_url: model.cover_image_url, github_url: model.github_url, latest_version: model.latest_version, // Full OpenAPI schema, inputs/outputs default_example: model.default_example // A sample prediction object }); ``` -------------------------------- ### Dump Model Metadata to JSON (CLI) Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Use the CLI tool to output all model metadata as a JSON object to standard output. ```command $ npx all-the-public-replicate-models ``` -------------------------------- ### Filter and Sort Model Data with jq (CLI) Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Pipe the CLI output to jq to filter for 'whisper' models, sort them by run count, and display their URL and run count. ```command npx all-the-public-replicate-models | jq -r 'map(select(.name | contains("whisper"))) | sort_by(.run_count) | reverse | .[] | "\(.url) \(.run_count)"' ``` -------------------------------- ### Filter Replicate Models with CLI and jq Source: https://context7.com/replicate/all-the-public-replicate-models/llms.txt Combine the CLI output with `jq` to filter and sort model data. This allows for complex queries directly in the shell, such as finding models by name, owner, or run count. ```bash # Find all whisper models sorted by run count (descending) npx all-the-public-replicate-models | jq -r ' map(select(.name | contains("whisper"))) | sort_by(.run_count) | reverse | .[] | "\(.url) \(.run_count)" ' # https://replicate.com/openai/whisper 3790120 # https://replicate.com/m1guelpf/whisper-subtitles 38020 # https://replicate.com/hnesk/whisper-wordtimestamps 28889 ``` ```bash # Extract only name + description for all models npx all-the-public-replicate-models | jq '[.[] | {name: .name, owner: .owner, description: .description}]' ``` ```bash # Find models with over 1 million runs npx all-the-public-replicate-models | jq '[.[] | select(.run_count > 1000000)] | length' ``` -------------------------------- ### Find Top 10 Models by Run Count (JS) Source: https://github.com/replicate/all-the-public-replicate-models/blob/main/README.md Import all model metadata and use lodash-es to find and log the top 10 models sorted by their run count. ```javascript import models from 'all-the-public-replicate-models' import {chain} from 'lodash-es' const mostRun = chain(models).orderBy('run_count', 'desc').take(10).value() console.log({mostRun}) ``` -------------------------------- ### Query Replicate Models with lodash-es Source: https://context7.com/replicate/all-the-public-replicate-models/llms.txt Use lodash-es to chain operations like sorting, filtering, and mapping on the Replicate models array. This is useful for exploring the catalog and finding specific models based on criteria like run count or owner. ```javascript import models from 'all-the-public-replicate-models'; import { chain } from 'lodash-es'; // Top 10 most-run models overall const top10 = chain(models) .orderBy('run_count', 'desc') .take(10) .map(m => ({ url: m.url, run_count: m.run_count })) .value(); console.log("Top 10 models by run count:"); console.log(top10); // [ // { url: 'https://replicate.com/stability-ai/stable-diffusion', run_count: 52341829 }, // ... // ] // Find all models owned by a specific organization const blackForestModels = chain(models) .filter({ owner: 'black-forest-labs' }) .orderBy('run_count', 'desc') .value(); console.log(`black-forest-labs has ${blackForestModels.length} public models`); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.