/** * Budget export to a gateway (ADR-508 §2.2). * * LiteLLM virtual-key budget fields, as docs.litellm.ai documents them * (checked 2026-10-29: /docs/proxy/users and /docs/proxy/budget_fallbacks): * budget_limits [{ budget_duration: "24h", max_budget: 10 }, ...] stacked windows * model_max_budget { "": { budget_limit: 0.01, time_period: "1d" } } * budget_fallbacks { "": ["", ...] } LiteLLM >= v1.92.0 * Durations use LiteLLM's grammar: "30s", "30m", "30h", "30d". * * meta-llm documents no budget API, so it is refused with a pointer to * ADR-508 rather than guessed at. */ import { type BudgetFile } from './budget-file.js'; export declare const ADR_POINTER = "v3/docs/adr/ADR-508-cost-ladder-gateway-budgets.md"; export declare const GATEWAYS: readonly ["litellm", "meta-llm"]; export interface LiteLLMKeyBody { budget_limits: { budget_duration: string; max_budget: number; }[]; model_max_budget?: Record; budget_fallbacks?: Record; } /** Why a gateway cannot be exported to, or undefined when it can. */ export declare function gatewayRefusal(gateway: unknown): string | undefined; /** * The LiteLLM `/key/generate` budget fields for a budget. Every window becomes * one `budget_limits` entry. `model_max_budget` (the ladder's window, on the * named model) and `budget_fallbacks` (model → [fallbackModel]) are added only * when `model` is given: the file names no primary model, and ruflo never * invents a gateway model name. */ export declare function toLiteLLMKeyBody(budget: BudgetFile, model?: string): LiteLLMKeyBody; /** The body as YAML (LiteLLM key settings) or as the `/key/generate` JSON body. */ export declare function formatBody(body: LiteLLMKeyBody, format: 'yaml' | 'json'): string; /** * The `/key/generate` URL for a proxy URL, or the reason it is refused: * HTTPS only, except a loopback host (`localhost`, `127.0.0.1`, `[::1]`); * no credentials in the URL; no query or fragment; no path starting with `//`. * The result always keeps the given scheme and host. */ export declare function keyGenerateUrl(proxy: unknown): { url?: URL; error?: string; }; /** The master key from the environment variable `--key-env` names (never from argv), or why there is none. */ export declare function keyFromEnv(name: unknown, env?: NodeJS.ProcessEnv): { key?: string; error?: string; }; /** A key shown masked: its first 4 characters and its length. */ export declare const maskKey: (key: string) => string; export interface ApplyResult { ok: boolean; status: number; generatedKey?: string; error?: string; } /** * POSTs the budget fields to the proxy's `/key/generate`. Only the budget * fields are sent; redirects are refused (one could leave HTTPS or loopback); * 15 s timeout. */ export declare function applyToLiteLLM(url: URL, masterKey: string, body: LiteLLMKeyBody, fetchImpl?: typeof fetch): Promise; //# sourceMappingURL=litellm.d.ts.map