Skip to content

TencentProvider

Namespace: Vercel.AI.Tencent

public sealed class TencentProvider : OpenAICompatibleProvider

Tencent Cloud provider: TokenHub chat models (OpenAI-compatible) and Kling (TokenHub) and VOD AIGC video models.

Inheritance: object → ProviderBase → OpenAICompatibleProvider

View source

TencentProvider(HttpClient, OpenAICompatibleOptions?)

Section titled “TencentProvider(HttpClient, OpenAICompatibleOptions?)”
public TencentProvider(HttpClient httpClient, OpenAICompatibleOptions? options = null)

Creates a provider. Pass TencentOptions to use VOD video models. Credentials are read when a request is sent, so a missing key fails then and not here.

Parameters

Name Type Description
httpClient HttpClient
options OpenAICompatibleOptions

View source

public const string DefaultBaseUrl = "https://tokenhub-intl.tencentcloudmaas.com/v1"

Default TokenHub API origin.

Value: string

View source

public const string DefaultVodBaseUrl = "https://vod.intl.tencentcloudapi.com"

Default VOD API origin.

Value: string

View source

public const string ProviderId = "tencent"

Provider id.

Value: string

View source

public ILanguageModel Chat(string modelId)

Creates a TokenHub model for text generation.

Parameters

Name Type Description
modelId string

Returns: ILanguageModel

View source

Create(OpenAICompatibleOptions?, HttpMessageHandler?)

Section titled “Create(OpenAICompatibleOptions?, HttpMessageHandler?)”
public static TencentProvider Create(OpenAICompatibleOptions? options = null, HttpMessageHandler? handler = 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 credentials to another host. It sets AllowAutoRedirect = false on a supplied handler that exposes it (see HttpMessageHandler)).

Returns: TencentProvider

View source

public override OpenAICompatibleLanguageModel CreateChatModel(string modelId)

Creates a chat model. Providers override this when support differs by model id.

Parameters

Name Type Description
modelId string

Returns: OpenAICompatibleLanguageModel

View source

public override IEmbeddingModel EmbeddingModel(string modelId)

Returns an embedding model.

Parameters

Name Type Description
modelId string

Returns: IEmbeddingModel

View source

public override IImageModel ImageModel(string modelId)

Returns an image model.

Parameters

Name Type Description
modelId string

Returns: IImageModel

View source

public IVideoModel Video(string modelId)

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

Parameters

Name Type Description
modelId string

Returns: IVideoModel

View source

public override IVideoModel VideoModel(string modelId)

Creates a model for video generation. TokenHub Kling models use their TokenHub id; VOD AIGC models use vod/<ModelName>/<ModelVersion>.

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