replicate
БесплатноБез исполняемых скриптовНе проверенRun machine learning models in the cloud via API. Access thousands of open-source models for image generation, language, audio, and video. Fine-tune models on…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Replicate
Overview
Replicate runs open-source and proprietary models behind one HTTP API: image, video, audio and language models, billed per second of compute (or per output for some official models). You call owner/name for official models, or owner/name:version to pin a community model to an exact version. You can also fine-tune supported models (such as FLUX) and publish your own models packaged with Cog. Clients: replicate on PyPI (1.0.x) and npm (1.x). Model IDs, versions and input fields vary per model, so open the model's API tab on replicate.com before copying inputs.
Instructions
Install and authenticate
pip install replicate # Python 3.8+
npm install replicate # Node 18+
export REPLICATE_API_TOKEN="r8_your_token_from_replicate_com_account"
Create tokens at replicate.com/account/api-tokens and keep them in the environment, never in source.
Run a model
Since replicate 1.0.0, run() returns FileOutput objects instead of URL strings for models that output files. Use .read(), iterate the object, or .url; use_file_output=False restores plain URLs.
import replicate
outputs = replicate.run(
"black-forest-labs/flux-schnell",
input={"prompt": "A futuristic cityscape at sunset, digital art", "num_outputs": 1},
)
for i, image in enumerate(outputs):
with open(f"city_{i}.webp", "wb") as f:
f.write(image.read())
print(image.url)
run() first asks the API to hold the request for up to 60 seconds (wait=1..60; wait=False skips this), then keeps polling until the prediction ends, and raises replicate.exceptions.ModelError if the prediction fails; e.prediction.logs shows why.
import Replicate from "replicate";
import { writeFile } from "node:fs/promises";
const replicate = new Replicate(); // reads REPLICATE_API_TOKEN
const [image] = await replicate.run("black-forest-labs/flux-schnell", {
input: { prompt: "A watercolor painting of a robot" },
});
await writeFile("robot.webp", image);
Language models and streaming
for event in replicate.stream(
"meta/meta-llama-3-70b-instruct",
input={"prompt": "Explain machine learning to a 5-year-old", "max_tokens": 500, "temperature": 0.7},
):
print(str(event), end="", flush=True)
Language-model input names differ between models (max_tokens vs max_new_tokens, system_prompt); read the model page. Older models such as Llama 2 may be unavailable.
Background predictions and polling
import time, replicate
prediction = replicate.predictions.create(
model="black-forest-labs/flux-schnell", # official model: no version needed
input={"prompt": "A cat in space"},
)
while prediction.status not in ("succeeded", "failed", "canceled"):
time.sleep(2)
prediction.reload()
if prediction.status == "succeeded":
print(prediction.output) # list of URLs when read from the prediction object
else:
print(prediction.error)
For community models pass version="<64-character version id>" instead of model=. Cancel with prediction.cancel().
Webhooks
prediction = replicate.predictions.create(
model="black-forest-labs/flux-schnell",
input={"prompt": "A mountain landscape"},
webhook="https://hooks.shopfront.dev/replicate",
webhook_events_filter=["completed"], # start | output | logs | completed
)
Verify every delivery: Replicate signs it with webhook-id, webhook-timestamp and webhook-signature headers. Sign {id}.{timestamp}.{raw body} with the base64 part of the whsec_... key returned by GET https://api.replicate.com/v1/webhooks/default/secret, compare in constant time, and reject old timestamps. The Python client has replicate.webhooks.validate, and the Node client validateWebhook, for this.
Fine-tuning FLUX
SDXL fine-tuning inputs from older guides no longer apply; the supported route is the FLUX trainer.
import replicate
trainer = replicate.models.get("replicate/fast-flux-trainer")
training = replicate.trainings.create(
model="replicate/fast-flux-trainer",
version=trainer.latest_version.id,
destination="jdoe/mug-style-flux", # model you own; create it first at replicate.com/create
input={
"input_images": "https://assets.jdoe-studio.com/mug-photos.zip", # zip of training images (the guide uses about 20)
"trigger_word": "MUGSTYLE", # made-up string, not a real word
"lora_type": "style", # or "subject"
"training_steps": 1000,
},
)
training.reload()
print(training.status)
When it succeeds, run jdoe/mug-style-flux with a prompt containing the trigger word. Training is billed per second on H100s, typically a couple of dollars.
Deploy a custom model with Cog
Install Cog with Homebrew (brew install replicate/tap/cog) or from the release page with its checksum verified, and have Docker running.
# cog.yaml
build:
p
Установить replicate в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл replicate?
Run machine learning models in the cloud via API. Access thousands of open-source models for image generation, language, audio, and video. Fine-tune models on custom data and deploy custom models with Cog packaging format.
Как установить скилл replicate?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл replicate запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic