npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

stability-ai-provider

v0.1.0

Published

Stability AI provider for the Vercel AI SDK

Readme

Stability AI Provider for Vercel AI SDK

A custom Vercel AI SDK provider for Stability AI image generation models.

Installation

npm install stability-ai-provider ai
# or
bun add stability-ai-provider ai
# or
pnpm add stability-ai-provider ai

Setup

Set your Stability AI API key as an environment variable:

export STABILITYAI_API_KEY="your-api-key"

Or pass it directly when creating the provider:

import { createStabilityAI } from "stability-ai-provider";

const stabilityai = createStabilityAI({
  apiKey: "your-api-key",
});

Usage

Basic Image Generation

import { stabilityai } from "stability-ai-provider";
import { generateImage } from "ai";

const { image } = await generateImage({
  model: stabilityai.image("sd3.5-large"),
  prompt: "A serene mountain landscape at sunset with vibrant colors",
});

console.log(image.base64); // Base64-encoded image data

With Options

import { stabilityai } from "stability-ai-provider";
import { generateImage } from "ai";

const { images } = await generateImage({
  model: stabilityai.image("sd3.5-large"),
  prompt: "A cyberpunk city at night",
  n: 2, // Generate 2 images
  aspectRatio: "16:9",
  seed: 12345, // For reproducible results
  providerOptions: {
    "stability-ai": {
      stylePreset: "neon-punk",
      cfgScale: 8,
      steps: 50,
      negativePrompt: "blurry, low quality",
    },
  },
});

Custom Provider Instance

import { createStabilityAI } from "stability-ai-provider";
import { generateImage } from "ai";

const stabilityai = createStabilityAI({
  apiKey: process.env.MY_STABILITY_KEY,
  headers: {
    "X-Custom-Header": "value",
  },
});

const { image } = await generateImage({
  model: stabilityai.image("core"),
  prompt: "A beautiful forest",
});

Supported Models

| Model ID | Description | |----------|-------------| | sd3.5-large | Stable Diffusion 3.5 Large - Highest quality | | sd3.5-large-turbo | Stable Diffusion 3.5 Large Turbo - Fast generation | | sd3.5-medium | Stable Diffusion 3.5 Medium - Balanced | | sd3-large | Stable Diffusion 3 Large | | sd3-large-turbo | Stable Diffusion 3 Large Turbo | | sd3-medium | Stable Diffusion 3 Medium | | core | Stable Image Core - General purpose |

Provider Options

Pass these in providerOptions["stability-ai"]:

| Option | Type | Default | Description | |--------|------|---------|-------------| | stylePreset | string | - | Style preset (see below) | | cfgScale | number | 7 | Prompt adherence (1-35) | | steps | number | 50 | Inference steps (10-150) | | outputFormat | string | "png" | Output format: "png", "jpeg", "webp" | | negativePrompt | string | - | What to avoid in generation |

Style Presets

Available style presets:

  • enhance - General enhancement
  • anime - Anime style
  • photographic - Photorealistic
  • digital-art - Digital art style
  • comic-book - Comic book style
  • fantasy-art - Fantasy art
  • line-art - Line art
  • analog-film - Film photography look
  • neon-punk - Neon/cyberpunk style
  • isometric - Isometric view
  • low-poly - Low polygon style
  • origami - Paper craft style
  • modeling-compound - Clay/modeling look
  • cinematic - Cinematic style
  • 3d-model - 3D rendered look
  • pixel-art - Pixel art style
  • tile-texture - Seamless texture

API Reference

createStabilityAI(options?)

Creates a new Stability AI provider instance.

Options:

  • apiKey?: string - API key (defaults to STABILITYAI_API_KEY env var)
  • baseURL?: string - Custom API base URL
  • headers?: Record<string, string> - Custom headers
  • fetch?: typeof fetch - Custom fetch implementation

stabilityai.image(modelId, settings?)

Creates an image model instance.

Parameters:

  • modelId: string - The model ID to use
  • settings?: StabilityAIImageSettings - Default settings for this model

Requirements

  • Node.js 18+
  • Stability AI API key
  • ai package (peer dependency)

License

MIT