/** * Every AI provider BlazeResolver can call for triage and fixes. Nothing needs naming: paste keys and it works out * which provider each one belongs to. * * API_KEYS=sk-ant-...,gsk_...,nvapi-... any mix of providers, comma-separated (or API_KEY, API_KEY_1, API_KEY_2, ...) * * How a key is identified, cheapest first: * 1. Its own variable name: ANTHROPIC_API_KEY, OPENAI_API_KEY, ... (plus common aliases like GOOGLE_API_KEY, HF_TOKEN). * Each also takes {PREFIX}_API_KEYS (comma-separated) and {PREFIX}_API_KEY_1..N. * 2. Its format: most providers use a distinctive prefix (sk-ant-, gsk_, nvapi-, AIza, xai-, pplx-, hf_, ...). * 3. For the few formats that say nothing (Mistral, Together, Cohere, ...), with BLAZE_KEY_PROBE=on: on first use, * the likely providers are asked whether the key is theirs (a model-list request, no tokens spent), and the answer * is cached. Off by default, since that shows the key to providers it may not belong to; such keys are otherwise * skipped with a warning and need a named variable (MISTRAL_API_KEY, ...) or BLAZE_PROVIDER. * * Every configured provider is used, in priority order, as automatic failover: a provider that errors is skipped for a * minute and the next one answers. Several keys for one provider rotate round-robin; a rate-limited key cools down. * BLAZE_PROVIDER pins a single provider. BLAZE_MODEL overrides the model on the providers that serve it (a Claude model * name never goes to Groq), and puts the provider that owns that model first. */ export type Complete = (system: string, user: string) => Promise; type Env = Record; export declare class ProviderError extends Error { readonly status: number; constructor(message: string, status: number); } interface CompleteOptions { apiKey?: string; maxTokens?: number; timeoutMs?: number; env?: Env; } /** * One `Complete` per key, round-robin, moving to the next key on an auth, rate-limit or server error. * A single key skips the wrapper so behavior (and errors) match calling that one function directly. */ export declare function withKeyRotation(keys: string[], build: (key: string) => Complete): Complete | undefined; /** Every provider BlazeResolver knows, in priority order. */ export declare function listProviders(): { name: string; envPrefix: string; }[]; /** The provider a key belongs to, judging by its format alone; undefined when the format says nothing. */ export declare function identifyKey(key: string): string | undefined; /** * Keys for one provider: its own variables, plus universal keys that are its format or whose format says nothing. * Universal keys recognizably belonging to another provider are never sent to this one. */ export declare function resolveApiKeys(prefix: string, env?: Env): string[]; /** * Keys that certainly belong to one provider: its own variables, plus universal keys whose format says they're its. * Unlike resolveApiKeys, a universal key of unknown format is never included, so no key is sent anywhere on a guess. */ export declare function providerKeys(name: string, env?: Env): string[]; /** * The model behind triage and fixes, from whatever keys are configured — no provider needs naming (see the top of * this file). Returns undefined when there are none; callers then fall back to rules. */ export declare function resolveComplete(opts?: CompleteOptions): Complete | undefined; /** What resolveComplete would use, in order, with keys masked. For startup logs and `blazeresolver providers`. */ export declare function describeProviders(env?: Env): string[]; export declare const anthropicComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const openaiComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const azureOpenAIComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const geminiComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const xaiComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const mistralComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const deepseekComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const qwenComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const groqComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const nvidiaComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const cerebrasComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const fireworksComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const togetherComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const deepinfraComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const sambanovaComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const hyperbolicComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const novitaComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const moonshotComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const zhipuComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const cohereComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const ai21Complete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const basetenComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const perplexityComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const githubModelsComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const huggingfaceComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const openrouterComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export declare const ollamaComplete: ({ apiKey, maxTokens, timeoutMs, env }?: CompleteOptions) => Complete | undefined; export {}; //# sourceMappingURL=providers.d.ts.map