Connect Replicate to Claude Code
Find a model on Replicate, run it, and poll the prediction until the output is ready. Add Toolspoke to Claude Code once and it can use 11 Replicate actions. Your Replicate credential stays in Toolspoke, and you choose which actions Claude Code may call.
Set it up in Claude Code
Three steps, the first one once for every toolkit you will ever add.
Add Toolspoke to Claude Code
Run it in your project, then /mcp to sign in
claude mcp add --transport http toolspoke https://toolspoke.com/mcpThe sign-in opens in your browser, and Toolspoke asks you to approve it.
Install Replicate and connect it
Add Replicate to a project in your Toolspoke workspace.
API token. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.
- API token
- replicate.com → Account settings → API tokens. Sent as `Authorization: Bearer r8_…`, which is the scheme Replicate's OpenAPI document declares, paste only the token, not the word Token or Bearer.
Choose what Claude Code may do
All 11 actions start on. Switch off any of the 2 actions that change something in Replicate, and Claude Code gets a refusal if it tries.
What you can ask Claude Code for
A few of the Replicate actions that only read, so they are safe to try first.
- Read the account this token belongs to: `username`, `type` (user or organization), display name and avatar
- Browse Replicate's public models, newest version first by default
- Read one model by owner and name
- List the published versions of one model, newest first
What Claude Code can do in Replicate
9 actions read and 2 write.
Reads
Get account
Read the account this token belongs to: `username`, `type` (user or organization), display name and avatar. Free, it runs no model and starts no prediction. Use it to confirm which account is about to be billed before running anything, and note that it returns no balance or spend figure, because Replicate exposes none through the API. This is the connection test for exactly those reasons: it costs nothing, creates nothing and needs no arguments.
List models
Browse Replicate's public models, newest version first by default. Free. The answer is trimmed to the fields worth reading, owner, name, description, visibility, run count and URL, because the untrimmed record for every model carries a full `openapi_schema` and a page of them is tens of thousands of tokens an agent will not read. Call get_model once you have a candidate; that is where the input schema lives. There is no text search here: Replicate serves search as an HTTP `QUERY` request this connector cannot express, so narrow by browsing list_collections instead, or pass an `owner/name` you already know straight to get_model. Paging is Replicate's own: the raw response carries a `next` URL rather than a cursor parameter, and this connector has no way to follow it.
Get model
Read one model by owner and name. Free. This is the call worth making before create_prediction: the response carries `latest_version`, and inside it `openapi_schema`, which is the authoritative list of what that model's `input` object accepts and requires. Every model on Replicate declares its own parameters and rejects parameters belonging to another, so guessing from a similar model is how a prediction fails. `default_example` shows a real call that worked. Take `latest_version.id` from here to pin a version, or pass `owner/name` alone to create_prediction to use whatever is newest.
List model versions
List the published versions of one model, newest first. Free. A version id is a 64-character hash and it is what pins a prediction to code that will not change under it, the model's owner can push a new version at any time, and a prediction that named only `owner/name` runs the new one. Read the ids here, then read one with get_model_version to see the input schema that version declares.
Get model version
Read one pinned version of a model, including the `openapi_schema` describing exactly what `input` that version accepts. Free. Use it when a prediction has to be reproducible: the schema a model declares changes between versions, so a body built against the newest version can be rejected by an older one and vice versa. Pass the same version id to create_prediction.
List collections
List Replicate's curated model collections, "text-to-image", "super-resolution" and the rest, with their slugs and descriptions. Free. This is the practical way to find a model on this connector, because the text search Replicate offers is an HTTP `QUERY` request that cannot be declared here. Pick a slug and read it with get_collection.
Get collection
Read one curated collection and the models in it. Free. Each entry carries owner, name, description and run count, trimmed the same way list_models is trimmed, so use get_model afterwards for the input schema of whichever one looks right. `run_count` is the most useful signal in here: a model nobody runs is usually a model that no longer works.
Get prediction
Check a prediction started by create_prediction and read its result. Free, polling is not billed; the compute already running is. `status` is starting, processing, succeeded, failed, canceled or aborted, and the last four are terminal. Poll about every two seconds at first and back off towards ten. A succeeded prediction carries `output`, whose shape is the model's own: a string, a URL, a list of URLs, or an object. `metrics.predict_time` is the number the per-second bill is computed from. Output file URLs are deleted an hour after the prediction was created, so download anything worth keeping rather than storing the URL. `logs` carries the model's own stderr, which is where a failure usually explains itself.
List predictions
List predictions made by this account, newest first. Free. This is how to find a submission whose id was lost, a create_prediction call that timed out ambiguously should be looked for here rather than repeated, because Replicate accepts no idempotency key and a repeat is a second charge. Narrow with created_after and created_before; there is no way to page further, because Replicate returns a `next` URL rather than a cursor parameter and this connector cannot follow it. Every record carries the `input` it was given and the `output` it produced, which is why the payload is kept out of the audit log.
Writes
Create prediction
Run a model. This is the operation that costs money, and it is the only one here that does: Replicate bills either per second of the hardware the model runs on, from about $0.000025 a second on a small CPU to about $0.0122 a second on eight H100s, or per output for many image, video and language models, where a single image is commonly $0.025 to $0.09 and a second of video $0.09 to $0.25. Read the model's page for which of the two it uses before running anything in a loop. Nothing but an id and `status: starting` comes back: poll get_prediction until the status is terminal, then read `output`. `version` accepts three forms, "owner/name" for an official model, "owner/name:versionid", or a bare 64-character version id, and pinning a version is what stops the model changing under you. `input` must match the model's own schema exactly, which get_model returns as `openapi_schema`; a parameter belonging to a different model is rejected rather than ignored. Output files are deleted after one hour, so copy anything worth keeping. Submissions take no idempotency key, so a call that times out ambiguously must not be blindly repeated, look for it with list_predictions instead. Webhooks are not offered here on purpose; polling is.
Cancel prediction
Stop a prediction that is still starting or processing, so it stops costing money. Free to call. A prediction that has already reached a terminal status is unaffected. This destroys nothing recoverable: a canceled prediction has produced no output to lose, and the record of it stays readable through get_prediction. Note that cancelling an official model may still be charged for the compute already used, so it limits a runaway rather than refunding one. The response is the prediction record, which carries the input it was given.
Replicate in Claude Code: questions
Does Claude Code see my Replicate credential?
No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.
Can I stop Claude Code from changing things in Replicate?
Yes. Each of the 11 actions can be switched off for a project. Turn off the 2 that change something and Claude Code can only read.
Will 11 actions crowd Claude Code's context?
No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the Replicate action it needs when it needs it. Adding more toolkits does not add more tools to its list.
Can I add it once for every project?
Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.
What does it cost?
Tool calls are free on every plan, and a Replicate call does not run in a sandbox, so it bills nothing.
Replicate in your other apps
Try Replicate in Claude Code
Free to start, and tool calls cost nothing on any plan.