/** * Shared factory for API-key-paste "login" flows. * * Several providers (Cerebras, Synthetic, Moonshot, Together, NanoGPT, ZenMux) * don't actually implement OAuth — they just ask the user to paste an API key, * optionally validate it, and return the trimmed key. */ import type { OAuthController } from "./oauth/types.js"; type ChatCompletionsValidation = { kind: "chat-completions"; provider: string; baseUrl: string; model: string; }; type AnthropicMessagesValidation = { kind: "anthropic-messages"; provider: string; baseUrl: string; model: string; }; type ModelsEndpointValidation = { kind: "models-endpoint"; provider: string; modelsUrl: string | (() => string); headers?: Record | (() => Record | undefined); }; export type ApiKeyLoginConfig = { /** Display name used in error messages, e.g. "Cerebras", "NanoGPT". */ providerLabel: string; /** URL opened in browser for the user to grab their key, or omitted to skip onAuth. */ authUrl?: string; /** Instructions shown with the onAuth callback, or omitted to skip onAuth. */ instructions?: string; /** Prompt message shown when asking for the key paste. */ promptMessage: string; /** Placeholder string for the prompt (e.g. "sk-...", "csk-..."). */ placeholder: string; /** Validation strategy, or `null` to skip validation. */ validation: ChatCompletionsValidation | AnthropicMessagesValidation | ModelsEndpointValidation | null; /** Value returned for an empty key; also allows an empty prompt response. */ emptyKeyFallback?: string; }; export declare function createApiKeyLogin(config: ApiKeyLoginConfig): (options: OAuthController) => Promise; export {};