KlingAIProvider
Namespace: Vercel.AI.KlingAI
public sealed class KlingAIProvider : OpenAICompatibleProviderKlingAI provider. It supports video generation only.
Inheritance: object → ProviderBase → OpenAICompatibleProvider
Constructors
Section titled “Constructors”KlingAIProvider(HttpClient, OpenAICompatibleOptions?)
Section titled “KlingAIProvider(HttpClient, OpenAICompatibleOptions?)”public KlingAIProvider(HttpClient httpClient, OpenAICompatibleOptions? options = null)Creates a provider. Pass KlingAIOptions to use the legacy access key and secret key. The 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 |
Fields
Section titled “Fields”DefaultBaseUrl
Section titled “DefaultBaseUrl”public const string DefaultBaseUrl = "https://api-singapore.klingai.com"Default API origin.
Value: string
ProviderId
Section titled “ProviderId”public const string ProviderId = "klingai"Provider id.
Value: string
Methods
Section titled “Methods”Create(OpenAICompatibleOptions?, HttpMessageHandler?)
Section titled “Create(OpenAICompatibleOptions?, HttpMessageHandler?)”public static KlingAIProvider 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. 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. |
Returns: KlingAIProvider
EmbeddingModel(string)
Section titled “EmbeddingModel(string)”public override IEmbeddingModel EmbeddingModel(string modelId)Returns an embedding model.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: IEmbeddingModel
ImageModel(string)
Section titled “ImageModel(string)”public override IImageModel ImageModel(string modelId)Returns an image model.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: IImageModel
LanguageModel(string)
Section titled “LanguageModel(string)”public override ILanguageModel LanguageModel(string modelId)Returns a language model.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: ILanguageModel
ResolveApiKey()
Section titled “ResolveApiKey()”protected override string? ResolveApiKey()Resolves the bearer token on every call. An API key is sent as is. A legacy access key and secret key sign a fresh JWT.
Returns: string
Video(string)
Section titled “Video(string)”public IVideoModel Video(string modelId)Creates a video model. Same as VideoModel(string).
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: IVideoModel
VideoModel(string)
Section titled “VideoModel(string)”public override IVideoModel VideoModel(string modelId)Returns a video model.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: IVideoModel
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product