Heroku AI SDK Provider - v0.4.3
    Preparing search index...

    Class HerokuImageModel

    Heroku image generation model implementation compatible with AI SDK v5.

    This model integrates the Heroku Inference Image Generation API with the Vercel AI SDK. It currently supports the stable-image-ultra model.

    • Images are returned in base64 by default.
    • Custom aspect ratios and deterministic seeds are not yet supported.
    • Additional provider options can be supplied under the heroku key.
    import { generateImage } from "ai";
    import { heroku } from "heroku-ai-provider";

    const { images } = await generateImage({
    model: heroku.image("stable-image-ultra"),
    prompt: "A watercolor painting of a lighthouse at dusk"
    });

    console.log(images[0]); // base64 encoded PNG

    Implements

    • ImageModelV2
    Index

    Constructors

    Properties

    specificationVersion: "v2" = ...

    The image model must specify which image model interface version it implements. This will allow us to evolve the image model interface and retain backwards compatibility. The different implementation versions can be handled as a discriminated union on our side.

    provider: "heroku" = ...

    Name of the provider for logging purposes.

    modelId: string

    Provider-specific model ID for logging purposes.

    maxImagesPerCall: 10

    Limit of how many images can be generated in a single API call. Can be set to a number for a fixed limit, to undefined to use the global limit, or a function that returns a number or undefined, optionally as a promise.

    Methods

    • Generates an array of images.

      Parameters

      • options: {
            prompt: string;
            n: number;
            size: `${number}x${number}` | undefined;
            aspectRatio: `${number}:${number}` | undefined;
            seed: number | undefined;
            providerOptions: SharedV2ProviderOptions;
            abortSignal?: AbortSignal;
            headers?: Record<string, string | undefined>;
        }

      Returns Promise<
          {
              images: string[];
              warnings: ImageModelV2CallWarning[];
              providerMetadata?: ImageModelV2ProviderMetadata;
              response: {
                  timestamp: Date;
                  modelId: string;
                  headers: Record<string, string>
                  | undefined;
              };
          },
      >