Skip to content

BlackForestLabsProvider

Namespace: Vercel.AI.BlackForestLabs

public sealed class BlackForestLabsProvider : OpenAICompatibleProvider

BlackForestLabs provider.

Inheritance: object → ProviderBase → OpenAICompatibleProvider

View source

BlackForestLabsProvider(HttpClient, OpenAICompatibleOptions?, int?, int?)

Section titled “BlackForestLabsProvider(HttpClient, OpenAICompatibleOptions?, int?, int?)”
public BlackForestLabsProvider(HttpClient httpClient, OpenAICompatibleOptions? options = null, int? pollIntervalMillis = null, int? pollTimeoutMillis = null)

Creates a provider. The poll settings apply to every image and video model it creates.

Parameters

Name Type Description
httpClient HttpClient
options OpenAICompatibleOptions
pollIntervalMillis int?
pollTimeoutMillis int?

View source

public const string DefaultBaseUrl = "https://api.bfl.ai/v1"

Default API origin.

Value: string

View source

public const string ProviderId = "black-forest-labs"

Provider id.

Value: string

View source

public HttpClient HttpClient { get; }

HTTP client used for submit, poll, and download requests.

Value: HttpClient

View source

public int? PollIntervalMillis { get; }

Poll interval in milliseconds between status checks. Null uses 500ms for images and 2s for video.

Value: int?

View source

public int? PollTimeoutMillis { get; }

Overall timeout in milliseconds for polling before giving up. Null uses 60s for images and 10 minutes for video.

Value: int?

View source

Create(OpenAICompatibleOptions?, HttpMessageHandler?, int?, int?)

Section titled “Create(OpenAICompatibleOptions?, HttpMessageHandler?, int?, int?)”
public static BlackForestLabsProvider Create(OpenAICompatibleOptions? options = null, HttpMessageHandler? handler = null, int? pollIntervalMillis = null, int? pollTimeoutMillis = null)

Creates a provider.

Parameters

Name Type Description
options OpenAICompatibleOptions Provider options.
handler HttpMessageHandler Optional message handler. The provider follows redirects by hand so a status poll cannot send the API key to another host. For that reason it sets AllowAutoRedirect = false on a supplied HttpClientHandler or (on .NET 5 and later) SocketsHttpHandler, including one wrapped in DelegatingHandlers. This changes the handler you pass, and it throws if the handler has already sent a request. Any other handler type that exposes a public settable bool AllowAutoRedirect property is changed by reflection. Any remaining handler is left as is. It must not follow redirects on its own.
pollIntervalMillis int? Poll interval in milliseconds between status checks.
pollTimeoutMillis int? Overall polling timeout in milliseconds.

Returns: BlackForestLabsProvider

View source

public override IEmbeddingModel EmbeddingModel(string modelId)

Returns an embedding model.

Parameters

Name Type Description
modelId string

Returns: IEmbeddingModel

View source

public IImageModel Image(string modelId)

Creates an image model. Same as ImageModel(string).

Parameters

Name Type Description
modelId string

Returns: IImageModel

View source

public override IImageModel ImageModel(string modelId)

Returns an image model.

Parameters

Name Type Description
modelId string

Returns: IImageModel

View source

public override ILanguageModel LanguageModel(string modelId)

Returns a language model.

Parameters

Name Type Description
modelId string

Returns: ILanguageModel

View source

public IVideoModel Video(string modelId)

Creates a video model. Same as VideoModel(string).

Parameters

Name Type Description
modelId string

Returns: IVideoModel

View source

public override IVideoModel VideoModel(string modelId)

Returns a video model.

Parameters

Name Type Description
modelId string

Returns: IVideoModel

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product