@braintrust/proxy
Version:
A proxy server that load balances across AI providers.
803 lines (801 loc) • 99.3 kB
text/typescript
import { ExperimentLogPartialArgs } from '@braintrust/core';
import { MeterProvider } from '@opentelemetry/api';
import { z } from 'zod';
import { MetricReader, MeterProvider as MeterProvider$1, ResourceMetrics, MetricData } from '@opentelemetry/sdk-metrics';
export { NOOP_METER_PROVIDER } from '@opentelemetry/api/build/src/metrics/NoopMeterProvider';
interface ModelResponse {
stream: ReadableStream<Uint8Array> | null;
response: Response;
}
declare function parseAuthHeader(headers: Record<string, string | string[] | undefined>): string | null;
declare function parseNumericHeader(headers: Record<string, string | string[] | undefined>, headerKey: string): number | null;
declare function isObject(value: any): value is {
[key: string]: any;
};
declare function getTimestampInSeconds(): number;
declare function flattenChunksArray(allChunks: Uint8Array[]): Uint8Array;
declare function flattenChunks(allChunks: Uint8Array[]): string;
declare function isEmpty(a: any): a is null | undefined;
declare function getRandomInt(max: number): number;
declare class ProxyBadRequestError extends Error {
message: string;
constructor(message: string);
}
declare function parseFileMetadataFromUrl(url: string): {
filename: string;
contentType?: string;
url: URL;
} | undefined;
declare const writeToReadable: (response: string) => ReadableStream<any>;
declare const APISecretSchema: z.ZodUnion<[z.ZodObject<{
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
org_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
secret: z.ZodString;
type: z.ZodEnum<["perplexity", "anthropic", "google", "replicate", "together", "ollama", "groq", "lepton", "fireworks", "cerebras", "xAI", "js"]>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
models: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
customModels: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
format: z.ZodEnum<["openai", "anthropic", "google", "window", "js", "converse"]>;
flavor: z.ZodEnum<["chat", "completion"]>;
multimodal: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
input_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_read_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_write_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
o1_like: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning_budget: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
experimental: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
deprecated: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
parent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
endpoint_types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["openai", "anthropic", "google", "mistral", "bedrock", "vertex", "together", "fireworks", "perplexity", "xAI", "groq", "azure", "databricks", "lepton", "cerebras", "ollama", "replicate", "js"]>, "many">>>;
locations: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
max_input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
max_output_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}>>>>;
excludeDefaultModels: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
additionalHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
supportsStreaming: z.ZodDefault<z.ZodBoolean>;
}, "strict", z.ZodTypeAny, {
supportsStreaming: boolean;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
}, {
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
supportsStreaming?: boolean | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
type: "anthropic" | "google" | "js" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "lepton" | "cerebras" | "ollama" | "replicate";
secret: string;
id?: string | null | undefined;
name?: string | null | undefined;
org_name?: string | null | undefined;
metadata?: {
supportsStreaming: boolean;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
} | null | undefined;
}, {
type: "anthropic" | "google" | "js" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "lepton" | "cerebras" | "ollama" | "replicate";
secret: string;
id?: string | null | undefined;
name?: string | null | undefined;
org_name?: string | null | undefined;
metadata?: {
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
supportsStreaming?: boolean | undefined;
} | null | undefined;
}>, z.ZodObject<{
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
org_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
secret: z.ZodString;
type: z.ZodLiteral<"openai">;
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
models: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
customModels: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
format: z.ZodEnum<["openai", "anthropic", "google", "window", "js", "converse"]>;
flavor: z.ZodEnum<["chat", "completion"]>;
multimodal: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
input_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_read_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_write_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
o1_like: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning_budget: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
experimental: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
deprecated: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
parent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
endpoint_types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["openai", "anthropic", "google", "mistral", "bedrock", "vertex", "together", "fireworks", "perplexity", "xAI", "groq", "azure", "databricks", "lepton", "cerebras", "ollama", "replicate", "js"]>, "many">>>;
locations: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
max_input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
max_output_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}>>>>;
excludeDefaultModels: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
additionalHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
supportsStreaming: z.ZodDefault<z.ZodBoolean>;
api_base: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString, z.ZodNull]>;
organization_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strict", z.ZodTypeAny, {
supportsStreaming: boolean;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
api_base?: string | null | undefined;
organization_id?: string | null | undefined;
}, {
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
supportsStreaming?: boolean | undefined;
api_base?: string | null | undefined;
organization_id?: string | null | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
type: "openai";
secret: string;
id?: string | null | undefined;
name?: string | null | undefined;
org_name?: string | null | undefined;
metadata?: {
supportsStreaming: boolean;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
api_base?: string | null | undefined;
organization_id?: string | null | undefined;
} | null | undefined;
}, {
type: "openai";
secret: string;
id?: string | null | undefined;
name?: string | null | undefined;
org_name?: string | null | undefined;
metadata?: {
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
supportsStreaming?: boolean | undefined;
api_base?: string | null | undefined;
organization_id?: string | null | undefined;
} | null | undefined;
}>, z.ZodObject<{
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
org_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
secret: z.ZodString;
type: z.ZodLiteral<"azure">;
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
models: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
customModels: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
format: z.ZodEnum<["openai", "anthropic", "google", "window", "js", "converse"]>;
flavor: z.ZodEnum<["chat", "completion"]>;
multimodal: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
input_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_read_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_write_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
o1_like: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning_budget: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
experimental: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
deprecated: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
parent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
endpoint_types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["openai", "anthropic", "google", "mistral", "bedrock", "vertex", "together", "fireworks", "perplexity", "xAI", "groq", "azure", "databricks", "lepton", "cerebras", "ollama", "replicate", "js"]>, "many">>>;
locations: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
max_input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
max_output_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}>>>>;
excludeDefaultModels: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
additionalHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
supportsStreaming: z.ZodDefault<z.ZodBoolean>;
api_base: z.ZodString;
api_version: z.ZodDefault<z.ZodString>;
deployment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
auth_type: z.ZodDefault<z.ZodEnum<["api_key", "entra_api"]>>;
no_named_deployment: z.ZodDefault<z.ZodBoolean>;
}, "strict", z.ZodTypeAny, {
supportsStreaming: boolean;
api_base: string;
api_version: string;
auth_type: "api_key" | "entra_api";
no_named_deployment: boolean;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
deployment?: string | null | undefined;
}, {
api_base: string;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
supportsStreaming?: boolean | undefined;
api_version?: string | undefined;
deployment?: string | null | undefined;
auth_type?: "api_key" | "entra_api" | undefined;
no_named_deployment?: boolean | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
type: "azure";
secret: string;
id?: string | null | undefined;
name?: string | null | undefined;
org_name?: string | null | undefined;
metadata?: {
supportsStreaming: boolean;
api_base: string;
api_version: string;
auth_type: "api_key" | "entra_api";
no_named_deployment: boolean;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
deployment?: string | null | undefined;
} | null | undefined;
}, {
type: "azure";
secret: string;
id?: string | null | undefined;
name?: string | null | undefined;
org_name?: string | null | undefined;
metadata?: {
api_base: string;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
supportsStreaming?: boolean | undefined;
api_version?: string | undefined;
deployment?: string | null | undefined;
auth_type?: "api_key" | "entra_api" | undefined;
no_named_deployment?: boolean | undefined;
} | null | undefined;
}>, z.ZodObject<{
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
org_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
secret: z.ZodString;
type: z.ZodLiteral<"bedrock">;
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
models: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
customModels: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
format: z.ZodEnum<["openai", "anthropic", "google", "window", "js", "converse"]>;
flavor: z.ZodEnum<["chat", "completion"]>;
multimodal: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
input_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_token: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
output_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_read_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
input_cache_write_cost_per_mil_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
o1_like: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
reasoning_budget: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
experimental: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
deprecated: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
parent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
endpoint_types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["openai", "anthropic", "google", "mistral", "bedrock", "vertex", "together", "fireworks", "perplexity", "xAI", "groq", "azure", "databricks", "lepton", "cerebras", "ollama", "replicate", "js"]>, "many">>>;
locations: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
max_input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
max_output_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}>>>>;
excludeDefaultModels: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
additionalHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
supportsStreaming: z.ZodDefault<z.ZodBoolean>;
region: z.ZodString;
access_key: z.ZodString;
session_token: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strict", z.ZodTypeAny, {
supportsStreaming: boolean;
region: string;
access_key: string;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: number | null | undefined;
input_cost_per_mil_tokens?: number | null | undefined;
output_cost_per_mil_tokens?: number | null | undefined;
input_cache_read_cost_per_mil_tokens?: number | null | undefined;
input_cache_write_cost_per_mil_tokens?: number | null | undefined;
displayName?: string | null | undefined;
o1_like?: boolean | null | undefined;
reasoning?: boolean | null | undefined;
reasoning_budget?: boolean | null | undefined;
experimental?: boolean | null | undefined;
deprecated?: boolean | null | undefined;
parent?: string | null | undefined;
endpoint_types?: ("openai" | "anthropic" | "google" | "js" | "mistral" | "bedrock" | "vertex" | "together" | "fireworks" | "perplexity" | "xAI" | "groq" | "azure" | "databricks" | "lepton" | "cerebras" | "ollama" | "replicate")[] | null | undefined;
locations?: string[] | null | undefined;
description?: string | null | undefined;
max_input_tokens?: number | null | undefined;
max_output_tokens?: number | null | undefined;
}> | null | undefined;
excludeDefaultModels?: boolean | null | undefined;
additionalHeaders?: Record<string, string> | null | undefined;
session_token?: string | null | undefined;
}, {
region: string;
access_key: string;
models?: string[] | null | undefined;
customModels?: Record<string, {
format: "openai" | "anthropic" | "google" | "window" | "js" | "converse";
flavor: "chat" | "completion";
multimodal?: boolean | null | undefined;
input_cost_per_token?: number | null | undefined;
output_cost_per_token?: num