Replicate

Lightweight, dependency-free, in-memory Replicate HTTP API fake for testing code that uses the real replicate Node.js SDK (and the language-agnostic Replicate REST API).

Default port: 4856

Quick start

import { ReplicateServer } from "./services/replicate/src/server.js";

const server = new ReplicateServer(4856);
await server.start();
// ... run your app/tests ...
await server.stop();

Point the real replicate client at it via baseUrl:

import Replicate from "replicate";

const replicate = new Replicate({
  auth: "r8_parlel",
  baseUrl: "http://127.0.0.1:4856",
});

const output = await replicate.run("stability-ai/sdxl:version", {
  input: { prompt: "a cat" },
});
// output => deterministic array derived from the input hash

All generated output is deterministic: prediction outputs are derived from a hash of the input so tests are repeatable.

Access via MCP / preview URL

Implemented operations

All /v1/* routes require Authorization: Token <key> (or Bearer). Any non-empty token is accepted.

Service & inspection operations (parlel extensions)

Surface coverage

This emulator faithfully replicates the API surface most application code and agents exercise. Anything below the supported lines is either an intentional design choice for a fast, zero-cost local emulator (✓ By design) or a candidate for a future release (⟳ Roadmap) — never a silent inaccuracy.

Legend: ✅ fully supported · ◐ accepted (stored, not strictly enforced) · ✓ by design · ⟳ on the roadmap.

FeatureStatus
predictions.create / get / cancel✅ Supported
models.get✅ Supported
Deterministic, reproducible output✅ Supported
Real model inference / GPU compute✓ By design — Deterministic stub output — repeatable assertions, no API spend
Webhooks / streaming output URLs⟳ Roadmap — poll-only
Training / fine-tunes / deployments⟳ Roadmap
Token validity / quota enforcement✓ By design — Never throttles — local tests run at full speed, zero cost

Error codes & shapes

Errors use the Replicate envelope: { "detail": "...", "status": <code> }.

StatusWhen
401missing/invalid Authorization
404unknown prediction or endpoint
422malformed request body

Manifest

See services/replicate/manifest.json:

<!-- parlel:testenv:start -->

Configuration — test.env

Copy these into your test.env (used by the bridge sidecar flow). Tokens are Parlel's seeded test credentials — any non-empty value is accepted by the emulator, so you rarely need to change them. Swap in real credentials only when pointing at the live service in prod.env.

REPLICATE_API_TOKEN=r8_parlel
REPLICATE_BASE_URL=http://parlel-bridge:4856
<!-- parlel:testenv:end -->