Skip to content

DeepInfraImageModel

Namespace: Vercel.AI.DeepInfra

public sealed class DeepInfraImageModel : IImageModel

DeepInfra image model. Generation posts to /inference/{model}. Edits post multipart to the OpenAI-compatible /openai/images/edits route.

Inheritance: object

Implements: IImageModel

View source

DeepInfraImageModel(DeepInfraProvider, string, Func<DateTimeOffset>?)

Section titled “DeepInfraImageModel(DeepInfraProvider, string, Func<DateTimeOffset>?)”
public DeepInfraImageModel(DeepInfraProvider provider, string modelId, Func<DateTimeOffset>? clock = null)

Creates an image model. <code class=“paramref”>clock</code> sets the response timestamp and defaults to UTC now.

Parameters

Name Type Description
provider DeepInfraProvider
modelId string
clock Func<DateTimeOffset>

View source

public int MaxImagesPerCall { get; }

DeepInfra accepts one image per call.

Value: int

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

DoGenerateAsync(ImageCallOptions, CancellationToken)

Section titled “DoGenerateAsync(ImageCallOptions, CancellationToken)”
public Task<ImageGenerationResult> DoGenerateAsync(ImageCallOptions options, CancellationToken cancellationToken)

Generates images. Maps to doGenerate on an image model.

Parameters

Name Type Description
options ImageCallOptions
cancellationToken CancellationToken

Returns: Task<ImageGenerationResult>

View source

public static string? ReadError(string? body)

Reads detail.error, then the shared OpenAI-compatible error message.

Parameters

Name Type Description
body string

Returns: string

View source

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