Constructor for the Heroku Chat Language Model.
The Heroku chat model identifier (e.g., "claude-4-sonnet")
Your Heroku AI API key for chat completions
The base URL for the Heroku chat completions API
ReadonlyspecificationThe language model must specify which language model interface version it implements.
ReadonlyproviderName of the provider for logging purposes.
ReadonlymodelProvider-specific model ID for logging purposes.
ReadonlysupportedSupported URL patterns by media type for the provider.
The keys are media type patterns or full media types (e.g. */* for everything, audio/*, video/*, or application/pdf).
and the values are arrays of regular expressions that match the URL paths.
The matching should be against lower-case URLs.
Matched URLs are supported natively by the model and are not downloaded.
Generate a chat completion using the Heroku AI API.
This method implements the AI SDK v5 LanguageModelV2 interface for non-streaming chat completions, including tool calling and conversation history.
Configuration options for the chat completion
Completion content, usage metadata, and any provider warnings
Generate a streaming chat completion using the Heroku AI API.
This method implements the AI SDK v5 LanguageModelV2 interface for streaming chat completions and returns a readable stream of structured parts.
Heroku chat language model implementation compatible with AI SDK v5.
This class provides chat completion capabilities using Heroku's AI infrastructure, specifically designed to work seamlessly with the Vercel AI SDK's chat functions. Supports both streaming and non-streaming responses, tool calling, and all standard AI SDK features.
HerokuChatLanguageModel Implements the LanguageModelV2 interface from @ai-sdk/provider.
Example
Basic usage with AI SDK:
Example
Advanced usage with tools:
Example
Direct model usage: