/** * The OrcaRouter provider: one endpoint, one Bearer header, whichever adapter supplied the key. * * WHAT THIS IS NOT. It is not a new HTTP client for inference. Every model call in this package * already goes through an OpenAI- or Anthropic-shaped path, and OrcaRouter is OpenAI-compatible, so * the provider's job is to answer three questions -- where is the endpoint, which key, which model -- * and to leave the request bytes alone. * * THE PROXY'S PROVIDER PRESET IS THE SAME OBJECT. `src/proxy/server.ts` forwards verbatim and takes * its upstream from `TOKEN_OPTIMIZER_PROXY_UPSTREAM`; this module is what resolves that value when * the user names OrcaRouter, so the CLI, the launcher and the dashboard cannot disagree about the * endpoint. * * A 401 IS TERMINAL HERE. There is no refresh grant to attempt: the key is durable and the only * recovery is a new authorization, so a 401 marks the exact account generation for reauthentication * and returns a plain instruction. Retrying would send the same dead credential forever. */ import { type OrcaRouterOrigins } from './endpoints.js'; import { type CredentialResult } from './credentials.js'; import { type CatalogRequest, type CatalogResult } from './catalog.js'; export interface OrcaProviderIdentity { readonly id: 'orcarouter'; readonly label: 'OrcaRouter'; /** The value a user puts in a provider dropdown. */ readonly wireApi: 'openai'; } export declare const ORCAROUTER_PROVIDER: OrcaProviderIdentity; export interface OrcaProviderConfig { readonly origins: OrcaRouterOrigins; readonly credential: CredentialResult | null; /** False when no key is held, so callers can explain rather than send an unauthenticated request. */ readonly ready: boolean; } export declare function resolveProvider(env?: NodeJS.ProcessEnv): Promise; /** * Headers for a request to the relay. * * `Authorization: Bearer` only. The key is never placed in a query string, a body, or a header that * a proxy would log by default. */ export declare function authorizationHeaders(credential: CredentialResult): Record; export interface ProviderRequestOptions { readonly model: string; readonly path: '/chat/completions' | '/responses' | '/embeddings'; readonly body: unknown; readonly env?: NodeJS.ProcessEnv; readonly fetchImpl?: typeof fetch; readonly signal?: AbortSignal; } export interface ProviderResponse { readonly ok: boolean; readonly status: number; readonly json: unknown; } export declare class OrcaProviderError extends Error { readonly status: number | null; readonly needsReauth: boolean; constructor(message: string, options?: { status?: number | null; needsReauth?: boolean; }); } /** * Send one request through the relay. * * Deliberately the only place a provider request is assembled, so the base URL and the header cannot * drift between entry points. It returns the parsed body rather than a typed response: the callers * here (summarization, the proxy's own forwarding, diagnostics) each read a different shape. */ export declare function sendProviderRequest(options: ProviderRequestOptions): Promise; /** Model discovery for whichever entry point is asking. */ export declare function discoverModels(request: CatalogRequest, env?: NodeJS.ProcessEnv): Promise; //# sourceMappingURL=provider.d.ts.map