KlingAIAuth
Namespace: Vercel.AI.KlingAI
public static class KlingAIAuthResolves the bearer token for KlingAI API requests. KlingAI accepts a single API key sent as a bearer token, or a legacy access key / secret key pair that signs a short-lived JWT.
Inheritance: object
Fields
Section titled “Fields”AccessKeyEnvironmentVariable
Section titled “AccessKeyEnvironmentVariable”public const string AccessKeyEnvironmentVariable = "KLINGAI_ACCESS_KEY"Environment variable that holds the legacy access key.
Value: string
ApiKeyEnvironmentVariable
Section titled “ApiKeyEnvironmentVariable”public const string ApiKeyEnvironmentVariable = "KLINGAI_API_KEY"Environment variable that holds the API key.
Value: string
SecretKeyEnvironmentVariable
Section titled “SecretKeyEnvironmentVariable”public const string SecretKeyEnvironmentVariable = "KLINGAI_SECRET_KEY"Environment variable that holds the legacy secret key.
Value: string
Methods
Section titled “Methods”GenerateAuthToken(string?, string?)
Section titled “GenerateAuthToken(string?, string?)”public static string GenerateAuthToken(string? accessKey = null, string? secretKey = null)Signs a JWT (HS256) from a legacy access key / secret key pair. The token is valid for 30 minutes. A missing key falls back to its environment variable.
Parameters
| Name | Type | Description |
|---|---|---|
accessKey |
string | |
secretKey |
string |
Returns: string
ResolveAuthToken(string?, string?, string?)
Section titled “ResolveAuthToken(string?, string?, string?)”public static string ResolveAuthToken(string? apiKey = null, string? accessKey = null, string? secretKey = null)Resolves the bearer token. Explicit values win over environment variables, and the API key wins over the access key / secret key pair:
apiKey, then accessKey with secretKey, then KLINGAI_API_KEY, then KLINGAI_ACCESS_KEY with KLINGAI_SECRET_KEY.
Parameters
| Name | Type | Description |
|---|---|---|
apiKey |
string | |
accessKey |
string | |
secretKey |
string |
Returns: string
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product