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

    Variable createHerokuProviderConst

    createHerokuProvider: (
        options?: HerokuAIOptions,
    ) => {
        chat: (model: string) => HerokuChatLanguageModel;
        embedding: (model: string) => HerokuEmbeddingModel;
        image: (model: string) => HerokuImageModel;
    } = createHerokuAI

    Type Declaration

      • (
            options?: HerokuAIOptions,
        ): {
            chat: (model: string) => HerokuChatLanguageModel;
            embedding: (model: string) => HerokuEmbeddingModel;
            image: (model: string) => HerokuImageModel;
        }
      • Creates a configurable Heroku AI provider for the Vercel AI SDK.

        This helper lets you override API keys or base URLs when the default environment variables (INFERENCE_KEY, INFERENCE_URL, EMBEDDING_KEY, EMBEDDING_URL) are not sufficient.

        Browser Compatibility: In browser environments, process.env is not available. You must provide API keys via the options parameter (e.g., chatApiKey, embeddingsApiKey, imageApiKey).

        Parameters

        • options: HerokuAIOptions = {}

          Optional configuration overrides for the provider

        Returns {
            chat: (model: string) => HerokuChatLanguageModel;
            embedding: (model: string) => HerokuEmbeddingModel;
            image: (model: string) => HerokuImageModel;
        }

        An object with methods to access chat and embedding models

        • chat: (model: string) => HerokuChatLanguageModel

          Creates a chat language model instance for the specified Heroku model.

          When chat API key is missing or model is unsupported

          const chatModel = heroku.chat("claude-4-sonnet");

          const { text } = await generateText({
          model: chatModel,
          prompt: "Explain quantum computing"
          });
        • embedding: (model: string) => HerokuEmbeddingModel

          Creates an embedding model instance for the specified Heroku model.

          When embeddings API key is missing or model is unsupported

          const embeddingModel = heroku.embedding("cohere-embed-multilingual");

          const { embedding } = await embed({
          model: embeddingModel,
          value: "Text to embed"
          });
        • image: (model: string) => HerokuImageModel

          Creates an image generation model instance for the specified Heroku model.

          When the image API key is missing or the model identifier is invalid

          const imageModel = heroku.image("stable-image-ultra");

          const { images } = await generateImage({
          model: imageModel,
          prompt: "A scenic view of mountains during sunrise"
          });

        When API keys are missing or URLs are invalid

        import { heroku } from "heroku-ai-provider";

        const { text } = await generateText({
        model: heroku.chat("claude-4-sonnet"),
        prompt: "What is the capital of France?"
        });
        import { createHerokuAI } from "heroku-ai-provider";

        const customHeroku = createHerokuAI({ chatApiKey: "my-key" });

        const { embedding } = await embed({
        model: customHeroku.embedding("cohere-embed-multilingual"),
        value: "Hello, world!"
        });

    Use createHerokuAI instead.