Stability AI

Lightweight, dependency-free, in-memory Stability AI API fake (v1 generation + v2beta stable-image). Images are deterministic tiny PNGs derived from the prompt hash.

Default port: 4862

Quick start

import { StabilityAiServer } from "./services/stability-ai/src/server.js";

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

REST usage:

const res = await fetch("http://127.0.0.1:4862/v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image", {
  method: "POST",
  headers: { Authorization: "Bearer sk-parlel-stability", "Content-Type": "application/json" },
  body: JSON.stringify({ text_prompts: [{ text: "a cat" }] }),
});
// => { artifacts: [{ base64, seed, finishReason: "SUCCESS" }] }

Access via MCP / preview URL

Implemented operations

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
v1 text-to-image✅ Supported
v2beta stable-image/generate/core (json + bytes)✅ Supported
engines/list, user/account✅ Supported
Deterministic tiny PNG output✅ Supported
Real diffusion image generation✓ By design — Intentionally unsupported (hash-derived PNG)
image-to-image / upscale / inpaint / control⟳ Roadmap
Real credit balance / billing◐ Static account info
CLIP guidance / sampler params◐ Accepted, not applied

Error codes & shapes

Errors use { "id", "name", "errors": ["..."] }.

StatusWhen
401missing/invalid Authorization
400missing text_prompts or bad JSON
404unknown endpoint

Manifest

See services/stability-ai/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.

STABILITY_API_KEY=sk-parlel-stability
STABILITY_BASE_URL=http://parlel-bridge:4862
<!-- parlel:testenv:end -->