DeepInfraProvider
Namespace: Vercel.AI.DeepInfra
public sealed class DeepInfraProvider : OpenAICompatibleProviderDeepInfra provider. OpenAI Chat Completions compatible at https://api.deepinfra.com/v1/openai.
Inheritance: object → ProviderBase → OpenAICompatibleProvider
Constructors
Section titled “Constructors”DeepInfraProvider(HttpClient, OpenAICompatibleOptions?)
Section titled “DeepInfraProvider(HttpClient, OpenAICompatibleOptions?)”public DeepInfraProvider(HttpClient httpClient, OpenAICompatibleOptions? options = null)Creates a provider.
Parameters
| Name | Type | Description |
|---|---|---|
httpClient |
HttpClient | |
options |
OpenAICompatibleOptions |
Fields
Section titled “Fields”ApiKeyVariable
Section titled “ApiKeyVariable”public const string ApiKeyVariable = "DEEPINFRA_API_KEY"Environment variable for the API key.
Value: string
DefaultBaseUrl
Section titled “DefaultBaseUrl”public const string DefaultBaseUrl = "https://api.deepinfra.com/v1/openai"Default API origin.
Value: string
ProviderId
Section titled “ProviderId”public const string ProviderId = "deepinfra"Provider id.
Value: string
Methods
Section titled “Methods”Create(OpenAICompatibleOptions?, HttpMessageHandler?)
Section titled “Create(OpenAICompatibleOptions?, HttpMessageHandler?)”public static DeepInfraProvider Create(OpenAICompatibleOptions? options = null, HttpMessageHandler? handler = null)Creates a provider. Pass a handler from tests.
Parameters
| Name | Type | Description |
|---|---|---|
options |
OpenAICompatibleOptions | |
handler |
HttpMessageHandler |
Returns: DeepInfraProvider
FixReasoningUsage(JsonElement)
Section titled “FixReasoningUsage(JsonElement)”public static JsonElement FixReasoningUsage(JsonElement usage)DeepInfra leaves reasoning tokens out of completion_tokens for some models (for example Gemini and Gemma).
When reasoning exceeds completion tokens, the reasoning tokens are added to the completion and total counts.
Parameters
| Name | Type | Description |
|---|---|---|
usage |
JsonElement |
Returns: JsonElement
ImageModel(string)
Section titled “ImageModel(string)”public override IImageModel ImageModel(string modelId)Returns an image model.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: IImageModel
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product