Appearance
Type Alias: AiConnection
ts
type AiConnection =
| {
apiKey: AiCredential;
baseUrl?: string;
provider: "anthropic" | "google" | "typesafe";
}
| {
api?: AiOpenAiApi;
apiKey: AiCredential;
baseUrl?: string;
organization?: string;
project?: string;
provider: "openai";
}
| {
api?: AiOpenAiApi;
apiKey: AiCredential;
apiVersion?: string;
baseUrl?: string;
provider: "azure";
resourceName?: string;
}
| {
auth: | {
apiKey: AiCredential;
type: "api-key";
}
| {
accessKeyId: AiCredential;
secretAccessKey: AiCredential;
sessionToken?: AiCredential;
type: "sigv4";
};
baseUrl?: string;
provider: "bedrock";
region: string;
}
| {
apiKey?: AiCredential;
apiKeyHeader?: string;
baseUrl: string;
headers?: Record<string, string>;
name: string;
provider: "openai-compatible";
queryParams?: Record<string, string>;
supportsStructuredOutputs?: boolean;
};Where a model request goes and how it is authenticated, by provider: Anthropic's, Google's (Gemini) and TypeSafe's (Jev) own APIs; OpenAI's, with its organization, project and API; an Azure OpenAI resource, by name or base URL; Amazon Bedrock in a region, with a Bedrock API key or SigV4 keys the host signs with; any server that speaks OpenAI's Chat Completions. A base URL, when given, must be one of the install's hosts; without one, the vendor's own API.
Union Members
Type Literal
ts
{
apiKey: AiCredential;
baseUrl?: string;
provider: "anthropic" | "google" | "typesafe";
}Type Literal
ts
{
api?: AiOpenAiApi;
apiKey: AiCredential;
baseUrl?: string;
organization?: string;
project?: string;
provider: "openai";
}Type Literal
ts
{
api?: AiOpenAiApi;
apiKey: AiCredential;
apiVersion?: string;
baseUrl?: string;
provider: "azure";
resourceName?: string;
}api?
ts
optional api?: AiOpenAiApi;apiKey
ts
apiKey: AiCredential;apiVersion?
ts
optional apiVersion?: string;v1 (the default) or a dated version.
baseUrl?
ts
optional baseUrl?: string;provider
ts
provider: "azure";resourceName?
ts
optional resourceName?: string;One of resourceName (<resource>.openai.azure.com) and baseUrl.
Type Literal
ts
{
auth: | {
apiKey: AiCredential;
type: "api-key";
}
| {
accessKeyId: AiCredential;
secretAccessKey: AiCredential;
sessionToken?: AiCredential;
type: "sigv4";
};
baseUrl?: string;
provider: "bedrock";
region: string;
}Type Literal
ts
{
apiKey?: AiCredential;
apiKeyHeader?: string;
baseUrl: string;
headers?: Record<string, string>;
name: string;
provider: "openai-compatible";
queryParams?: Record<string, string>;
supportsStructuredOutputs?: boolean;
}apiKey?
ts
optional apiKey?: AiCredential;apiKeyHeader?
ts
optional apiKeyHeader?: string;With apiKey: the header that carries it as it is; authorization: Bearer without.
baseUrl
ts
baseUrl: string;headers?
ts
optional headers?: Record<string, string>;Headers besides the key, which never carry a credential.
name
ts
name: string;Names the server in usage, ollama or openrouter.
provider
ts
provider: "openai-compatible";queryParams?
ts
optional queryParams?: Record<string, string>;supportsStructuredOutputs?
ts
optional supportsStructuredOutputs?: boolean;The server holds a model to a JSON Schema: decisions need it.