/** PI request protocols a custom provider may speak (PI docs/models.md §Supported APIs). */ export declare const CUSTOM_PROVIDER_APIS: readonly ["anthropic-messages", "openai-completions", "openai-responses", "google-generative-ai"]; export type CustomProviderApi = typeof CUSTOM_PROVIDER_APIS[number]; /** aistatus auth styles (node_modules/aistatus AUTH_STYLES): how the gateway presents the key. */ export type GatewayAuthStyle = 'anthropic' | 'openai' | 'google'; export interface CustomProviderModelSpec { id: string; contextWindow?: number; maxTokens?: number; reasoning?: boolean; } export interface CustomProviderInput { name: string; api: CustomProviderApi; /** Real upstream endpoint. Stored in gateway.yaml, never in the PI catalog. */ upstreamUrl: string; /** Upstream key. `undefined` keeps whatever is already stored; `''` clears it. */ apiKey?: string; models: CustomProviderModelSpec[]; headers?: Record; compat?: Record; } export type CustomProviderIssue = 'name-required' | 'name-charset' | 'name-reserved' | 'api-invalid' | 'upstream-required' | 'upstream-scheme' | 'models-required' | 'model-id-required' | 'model-id-duplicate'; /** Same charset the profile loader enforces on a PI provider name (domain/agents/profile-manager). */ export declare const CUSTOM_PROVIDER_NAME_RE: RegExp; /** * Written as the PI-side `apiKey` so PI counts the provider as authenticated and lists its models. * The real upstream secret lives in the gateway route; the gateway does not check inbound keys. */ export declare const GATEWAY_PLACEHOLDER_KEY = "cortex-gateway"; export declare function gatewayAuthStyle(api: CustomProviderApi): GatewayAuthStyle; /** * Gateway endpoint section a custom provider's route belongs to. The mode is always the provider * name; the endpoint follows the protocol, because an Anthropic-protocol endpoint can also serve * the Claude backend, whose mode URL is fixed at `/m//anthropic`. Other protocols have no * such caller, so their route sits in a section named after the provider. */ export declare function gatewayEndpoint(api: CustomProviderApi, name: string): string; /** * PI's baseUrl for a custom provider: the gateway's mode route, so every call is accounted and * throttled like any other route. */ export declare function customProviderBaseUrl(gatewayUrl: string, name: string, api: CustomProviderApi): string; export interface ValidateCustomProviderOpts { /** Provider ids PI already owns — a custom definition may not shadow one. */ reservedNames?: string[]; } export declare function validateCustomProvider(input: CustomProviderInput, opts?: ValidateCustomProviderOpts): CustomProviderIssue[]; /** Normalize free-form input: trim strings, drop empty optional maps, keep declared model fields. */ export declare function normalizeCustomProvider(input: CustomProviderInput): CustomProviderInput; /** The `providers.` object written into PI's models.json. Carries no upstream secret. */ export declare function buildModelsJsonEntry(input: CustomProviderInput, gatewayUrl: string): Record; export declare function readEntryModels(entry: Record): CustomProviderModelSpec[];