import type { BaseChatModel, BaseChatModelParams } from '@langchain/core/language_models/chat_models'; import type { ChatOpenRouterInput } from '@langchain/openrouter'; /** * Build a native `ChatOpenRouter` (`@langchain/openrouter`). It is NOT a `ChatOpenAI` subclass: it * talks to the OpenRouter REST API through the global `fetch` with no SDK client in between, and * `_llmType()` reports `openrouter`. * * OpenRouter's own options are therefore native TOP-LEVEL fields of the `llm` block, forwarded by * the `...restConfig` spread below: `provider` (routing preferences), `models` (the fallback list), * `route`, `plugins`, `transforms`, `trace`, `minP`, `topA`, `repetitionPenalty`, `seed`, * `logitBias`, `topLogprobs`, `sessionId`. Write them beside `model`, not under `configuration`. * * Migration note — the OpenAI-client knobs a `configuration` block used to carry are gone, because * there is no client to give them to. `configuration.baseURL` still works (mapped to the native * `baseURL`), and the two attribution headers are still honoured as a fallback for * `siteUrl`/`siteName`. What has no injection point at all is transport: `fetch`, `fetchOptions`, * `timeout`, `defaultQuery`, `dangerouslyAllowBrowser`, and any other `defaultHeaders` entry. That * is an upstream surface gap, not something this module can restore — per-provider transport would * need a `fetch` option added to `@langchain/openrouter`. * * `maxRetries` is NOT in that list: it is an ordinary chat-model parameter rather than a transport * option, so it is settable here, and this factory sets it from GTH_MAX_RETRIES. It bounds the * retries on the two request paths that go through the model's `AsyncCaller` — the non-streaming * generate and the streaming-chunks path. * * A third path does not, and the asymmetry is upstream's: `ChatOpenRouter`'s stream-EVENTS method * issues its request outside the caller, so nothing retries on it for any error class. It is closed * to us today — reaching it needs a LangGraph stream-event handler that this project never * registers, since that handler only exists on the v3 stream protocol and nothing here asks for v3. * If that changes, the fix belongs upstream rather than here. * * The replacement is PROCESS-WIDE rather than per-provider, and it is verified working: run node * with `--use-env-proxy` (or set `NODE_USE_ENV_PROXY=1`) together with `HTTP_PROXY`/`HTTPS_PROXY`, * and the global `fetch` this model calls routes through the proxy — measured end to end against a * local proxy, with a no-proxy control that stayed direct. */ export declare function processJsonConfig(llmConfig: ChatOpenRouterInput & BaseChatModelParams & Record): Promise; export declare function init(configFileName: string, force?: boolean, model?: string): void;