/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { OpenAiModelConfig } from "./OpenAI_ModelSchema"; /** * Hostnames (or hostname suffixes) accepted for OpenAI `base_url` without * the explicit `trustedBaseUrl` opt-out. Includes Azure OpenAI tenants. */ export declare const OPENAI_ALLOWED_HOSTS: readonly string[]; type OpenAIClientClass = new (config: any) => any; export declare function loadOpenAISDK(): Promise; /** * Override the client returned by {@link getClient} so runtime tests can * capture the requests the OpenAI run-fns build without a live SDK, API key, * or network call. Pass `undefined` to restore normal SDK-backed creation. * This lives in the runtime module (not a `vi.mock` of `openai`) so it works * identically whether the provider resolves to `src` or the bundled `dist`, * and is immune to duplicate SDK copies across the workspace defeating * module-level mocks. */ declare function setOpenAIClientForTests(client: unknown): void; /** * @internal Symbols exported only for use by `@workglow/test`. Not part of the * stable public API. Surfaced on the `ai-runtime` barrel (via `export *`) and * merged into the `/ai` barrel's `_testOnly`. */ export declare const _testOnly: { readonly setOpenAIClientForTests: typeof setOpenAIClientForTests; }; export declare function getClient(model: OpenAiModelConfig | undefined): Promise; export declare function getModelName(model: OpenAiModelConfig | undefined): string; /** * Resolves the `reasoning` object for reasoning-capable models (GPT-5.6 * sol/terra/luna and the o-series). Native `provider_config.reasoning` wins; * otherwise map `model.effort`. Returns `undefined` when neither is set. */ export declare function getReasoningConfig(model: OpenAiModelConfig | undefined): { effort?: string; mode?: string; } | undefined; /** * Resolves the Responses `prompt_cache_key`. Uses an explicit * `provider_config.prompt_cache_key` override when set, otherwise derives a * stable key from the request's cache-relevant prefix (model + system * instructions + tools) so requests sharing that prefix converge on one key and * hit the cache. GPT-5.6 bills cache writes, so a stable key (not a random one) * is the cost-correct default. */ export declare function resolvePromptCacheKey(model: OpenAiModelConfig | undefined, params: { model?: unknown; instructions?: unknown; tools?: unknown; }): string; /** * Applies the per-request Responses fields common to every OpenAI text run-fn: * the model's `reasoning` config and a stable `prompt_cache_key`. Mutates and * returns `params` so callers can inline it into the create call. Call this * last, after model/instructions/tools/temperature are populated, so the cache * key sees the full prefix and the reasoning default can see the temperature. * * When the caller pinned a `temperature` but expressed no reasoning preference, * reasoning is forced off. The two are not independently selectable on the * reasoning families: `gpt-5.6-luna` answers `temperature` alone with * `400 Unsupported parameter: 'temperature' is not supported with this model`, * yet accepts `{reasoning: {effort: "none"}, temperature: 0}`. A caller asking * for a specific temperature is asking for controlled sampling, so honouring * that request — rather than failing it — is the useful reading. An explicit * `reasoning` in the model config always wins. */ export declare function finalizeResponsesRequest(model: OpenAiModelConfig | undefined, params: Record): Record; export {};