import { z } from 'zod';
import { FetchAdapter } from '../adapter.ts';
export declare const AIGatewayPricingSchema: z.ZodObject<{
    input: z.ZodNumber;
    output: z.ZodNumber;
    cached_input: z.ZodOptional<z.ZodNumber>;
    unit: z.ZodString;
    currency: z.ZodString;
}, z.core.$strip>;
export type AIGatewayPricing = z.infer<typeof AIGatewayPricingSchema>;
export declare const AIGatewayModelProviderSchema: z.ZodObject<{
    env: z.ZodOptional<z.ZodArray<z.ZodString>>;
    api: z.ZodOptional<z.ZodString>;
    doc: z.ZodOptional<z.ZodString>;
    logo_url: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type AIGatewayModelProvider = z.infer<typeof AIGatewayModelProviderSchema>;
export declare const AIGatewayModelSchema: z.ZodObject<{
    id: z.ZodString;
    name: z.ZodString;
    created: z.ZodOptional<z.ZodNumber>;
    api: z.ZodOptional<z.ZodString>;
    family: z.ZodOptional<z.ZodString>;
    context_window: z.ZodOptional<z.ZodNumber>;
    max_output_tokens: z.ZodOptional<z.ZodNumber>;
    input_modalities: z.ZodOptional<z.ZodArray<z.ZodString>>;
    output_modalities: z.ZodOptional<z.ZodArray<z.ZodString>>;
    attachment: z.ZodOptional<z.ZodBoolean>;
    reasoning: z.ZodOptional<z.ZodBoolean>;
    tool_call: z.ZodOptional<z.ZodBoolean>;
    temperature: z.ZodOptional<z.ZodBoolean>;
    knowledge: z.ZodOptional<z.ZodString>;
    open_weights: z.ZodOptional<z.ZodBoolean>;
    recommended: z.ZodOptional<z.ZodBoolean>;
    default_for: z.ZodOptional<z.ZodArray<z.ZodString>>;
    rank: z.ZodOptional<z.ZodNumber>;
    provider: z.ZodOptional<z.ZodObject<{
        env: z.ZodOptional<z.ZodArray<z.ZodString>>;
        api: z.ZodOptional<z.ZodString>;
        doc: z.ZodOptional<z.ZodString>;
        logo_url: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
    pricing: z.ZodOptional<z.ZodObject<{
        input: z.ZodNumber;
        output: z.ZodNumber;
        cached_input: z.ZodOptional<z.ZodNumber>;
        unit: z.ZodString;
        currency: z.ZodString;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type AIGatewayModel = z.infer<typeof AIGatewayModelSchema>;
export declare const AIGatewayModelsSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
    id: z.ZodString;
    name: z.ZodString;
    created: z.ZodOptional<z.ZodNumber>;
    api: z.ZodOptional<z.ZodString>;
    family: z.ZodOptional<z.ZodString>;
    context_window: z.ZodOptional<z.ZodNumber>;
    max_output_tokens: z.ZodOptional<z.ZodNumber>;
    input_modalities: z.ZodOptional<z.ZodArray<z.ZodString>>;
    output_modalities: z.ZodOptional<z.ZodArray<z.ZodString>>;
    attachment: z.ZodOptional<z.ZodBoolean>;
    reasoning: z.ZodOptional<z.ZodBoolean>;
    tool_call: z.ZodOptional<z.ZodBoolean>;
    temperature: z.ZodOptional<z.ZodBoolean>;
    knowledge: z.ZodOptional<z.ZodString>;
    open_weights: z.ZodOptional<z.ZodBoolean>;
    recommended: z.ZodOptional<z.ZodBoolean>;
    default_for: z.ZodOptional<z.ZodArray<z.ZodString>>;
    rank: z.ZodOptional<z.ZodNumber>;
    provider: z.ZodOptional<z.ZodObject<{
        env: z.ZodOptional<z.ZodArray<z.ZodString>>;
        api: z.ZodOptional<z.ZodString>;
        doc: z.ZodOptional<z.ZodString>;
        logo_url: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
    pricing: z.ZodOptional<z.ZodObject<{
        input: z.ZodNumber;
        output: z.ZodNumber;
        cached_input: z.ZodOptional<z.ZodNumber>;
        unit: z.ZodString;
        currency: z.ZodString;
    }, z.core.$strip>>;
}, z.core.$strip>>>;
export type AIGatewayModels = z.infer<typeof AIGatewayModelsSchema>;
export declare const AIGatewayModelsResponseSchema: z.ZodObject<{
    success: z.ZodBoolean;
    data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
        id: z.ZodString;
        name: z.ZodString;
        created: z.ZodOptional<z.ZodNumber>;
        api: z.ZodOptional<z.ZodString>;
        family: z.ZodOptional<z.ZodString>;
        context_window: z.ZodOptional<z.ZodNumber>;
        max_output_tokens: z.ZodOptional<z.ZodNumber>;
        input_modalities: z.ZodOptional<z.ZodArray<z.ZodString>>;
        output_modalities: z.ZodOptional<z.ZodArray<z.ZodString>>;
        attachment: z.ZodOptional<z.ZodBoolean>;
        reasoning: z.ZodOptional<z.ZodBoolean>;
        tool_call: z.ZodOptional<z.ZodBoolean>;
        temperature: z.ZodOptional<z.ZodBoolean>;
        knowledge: z.ZodOptional<z.ZodString>;
        open_weights: z.ZodOptional<z.ZodBoolean>;
        recommended: z.ZodOptional<z.ZodBoolean>;
        default_for: z.ZodOptional<z.ZodArray<z.ZodString>>;
        rank: z.ZodOptional<z.ZodNumber>;
        provider: z.ZodOptional<z.ZodObject<{
            env: z.ZodOptional<z.ZodArray<z.ZodString>>;
            api: z.ZodOptional<z.ZodString>;
            doc: z.ZodOptional<z.ZodString>;
            logo_url: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>;
        pricing: z.ZodOptional<z.ZodObject<{
            input: z.ZodNumber;
            output: z.ZodNumber;
            cached_input: z.ZodOptional<z.ZodNumber>;
            unit: z.ZodString;
            currency: z.ZodString;
        }, z.core.$strip>>;
    }, z.core.$strip>>>>;
    message: z.ZodOptional<z.ZodString>;
    error: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type AIGatewayModelsResponse = z.infer<typeof AIGatewayModelsResponseSchema>;
export declare const AIGatewayChatMessageSchema: z.ZodObject<{
    role: z.ZodEnum<{
        system: "system";
        developer: "developer";
        user: "user";
        assistant: "assistant";
        tool: "tool";
    }>;
    content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
        type: z.ZodString;
    }, z.core.$catchall<z.ZodUnknown>>>, z.ZodNull]>>;
    name: z.ZodOptional<z.ZodString>;
    tool_call_id: z.ZodOptional<z.ZodString>;
    tool_calls: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
}, z.core.$strip>;
export type AIGatewayChatMessage = z.infer<typeof AIGatewayChatMessageSchema>;
export type AIGatewayReasoning = 'off' | 'low' | 'medium' | 'high' | '1024' | '4096' | '8192';
export interface AIGatewayCompletionAdapterRequest {
    api?: string;
    maxTokens?: number;
    messages: AIGatewayChatMessage[];
    model: string;
    reasoning?: AIGatewayReasoning;
    systemPrompt?: string;
}
export declare const AIGatewayResponseSchemaSchema: z.ZodObject<{
    name: z.ZodOptional<z.ZodString>;
    description: z.ZodOptional<z.ZodString>;
    strict: z.ZodOptional<z.ZodBoolean>;
    schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<{
        '~standard': unknown;
    }, {
        '~standard': unknown;
    }>]>;
}, z.core.$strip>;
export declare const AIGatewayChatCompletionParamsSchema: z.ZodObject<{
    model: z.ZodString;
    input: z.ZodOptional<z.ZodUnknown>;
    contents: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
    messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
        role: z.ZodEnum<{
            system: "system";
            developer: "developer";
            user: "user";
            assistant: "assistant";
            tool: "tool";
        }>;
        content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
            type: z.ZodString;
        }, z.core.$catchall<z.ZodUnknown>>>, z.ZodNull]>>;
        name: z.ZodOptional<z.ZodString>;
        tool_call_id: z.ZodOptional<z.ZodString>;
        tool_calls: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
    }, z.core.$strip>>>;
    prompt: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
    temperature: z.ZodOptional<z.ZodNumber>;
    top_p: z.ZodOptional<z.ZodNumber>;
    max_tokens: z.ZodOptional<z.ZodNumber>;
    stream: z.ZodOptional<z.ZodBoolean>;
    stop: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
    response_format: z.ZodOptional<z.ZodUnknown>;
    response_schema: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
        name: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        strict: z.ZodOptional<z.ZodBoolean>;
        schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<{
            '~standard': unknown;
        }, {
            '~standard': unknown;
        }>]>;
    }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<{
        '~standard': unknown;
    }, {
        '~standard': unknown;
    }>]>>;
}, z.core.$catchall<z.ZodUnknown>>;
export type AIGatewayChatCompletionParams = z.infer<typeof AIGatewayChatCompletionParamsSchema>;
export declare function buildAIGatewayCompletionParams({ api, maxTokens, messages, model, reasoning, systemPrompt, }: AIGatewayCompletionAdapterRequest): AIGatewayChatCompletionParams;
export type AIGatewayResponseSchemaInput = z.infer<typeof AIGatewayResponseSchemaSchema> | Record<string, unknown> | {
    '~standard': unknown;
};
export type AIGatewayProviderFamily = 'openai' | 'anthropic' | 'google' | 'unknown';
/**
 * Identify which provider family a model id maps to. Used to translate `response_schema`
 * into the right native structured-output primitive at request time.
 *
 * Recognises both the canonical `provider/model` form (e.g. `openai/gpt-4.1-mini`) and bare
 * model ids whose prefix unambiguously identifies a family (`gpt-`, `o1`/`o3`, `claude-`,
 * `gemini-`). Unknown ids fall through to schema-injected prompt fallback.
 */
export declare function getAIGatewayProviderFamily(model: string): AIGatewayProviderFamily;
/**
 * Translate a `response_schema` request param into the provider-native structured-output
 * primitive for the target model. Returns the rewritten params (with `response_schema`
 * removed) and the resolved `family` so callers can attach a parser that matches the
 * provider response shape.
 *
 * For models with no native support, the schema is injected into a system message and the
 * caller is responsible for JSON-parsing the textual reply (fallback path).
 */
export declare function applyAIGatewayResponseSchema(params: AIGatewayChatCompletionParams): {
    params: AIGatewayChatCompletionParams;
    family: AIGatewayProviderFamily;
    applied: boolean;
};
/**
 * Extract the structured-output payload from a completion when `response_schema` was used.
 * Returns the raw parsed JSON (or undefined if the response carried no usable payload).
 *
 * - OpenAI / fallback: parse the assistant text as JSON (stripping any code fences).
 * - Anthropic: read the forced `tool_use` block's `input` field.
 * - Google: parse the assistant text as JSON.
 */
export declare function getAIGatewayCompletionStructured(completion: unknown, family?: AIGatewayProviderFamily): unknown;
export declare const AIGatewayChatCompletionStreamParamsSchema: z.ZodObject<{
    model: z.ZodString;
    input: z.ZodOptional<z.ZodUnknown>;
    contents: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
    messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
        role: z.ZodEnum<{
            system: "system";
            developer: "developer";
            user: "user";
            assistant: "assistant";
            tool: "tool";
        }>;
        content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
            type: z.ZodString;
        }, z.core.$catchall<z.ZodUnknown>>>, z.ZodNull]>>;
        name: z.ZodOptional<z.ZodString>;
        tool_call_id: z.ZodOptional<z.ZodString>;
        tool_calls: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
    }, z.core.$strip>>>;
    prompt: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
    temperature: z.ZodOptional<z.ZodNumber>;
    top_p: z.ZodOptional<z.ZodNumber>;
    max_tokens: z.ZodOptional<z.ZodNumber>;
    stop: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
    response_format: z.ZodOptional<z.ZodUnknown>;
    response_schema: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
        name: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        strict: z.ZodOptional<z.ZodBoolean>;
        schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<{
            '~standard': unknown;
        }, {
            '~standard': unknown;
        }>]>;
    }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<{
        '~standard': unknown;
    }, {
        '~standard': unknown;
    }>]>>;
    stream: z.ZodLiteral<true>;
}, z.core.$catchall<z.ZodUnknown>>;
export type AIGatewayChatCompletionStreamParams = z.infer<typeof AIGatewayChatCompletionStreamParamsSchema>;
export declare const AIGatewayChatCompletionSchema: z.ZodObject<{
    id: z.ZodOptional<z.ZodString>;
    object: z.ZodOptional<z.ZodString>;
    created: z.ZodOptional<z.ZodNumber>;
    model: z.ZodOptional<z.ZodString>;
    choices: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
    usage: z.ZodOptional<z.ZodUnknown>;
    agentuity: z.ZodOptional<z.ZodObject<{
        headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
        cost: z.ZodOptional<z.ZodObject<{
            total: z.ZodOptional<z.ZodNumber>;
            unit: z.ZodOptional<z.ZodString>;
            inputQuantity: z.ZodOptional<z.ZodNumber>;
            outputQuantity: z.ZodOptional<z.ZodNumber>;
            promptTokens: z.ZodOptional<z.ZodNumber>;
            completionTokens: z.ZodOptional<z.ZodNumber>;
            reasoningTokens: z.ZodOptional<z.ZodNumber>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
}, z.core.$catchall<z.ZodUnknown>>;
export type AIGatewayChatCompletion = z.infer<typeof AIGatewayChatCompletionSchema>;
export declare const AIGatewayResponseMetadataSchema: z.ZodObject<{
    headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
    cost: z.ZodOptional<z.ZodObject<{
        total: z.ZodOptional<z.ZodNumber>;
        unit: z.ZodOptional<z.ZodString>;
        inputQuantity: z.ZodOptional<z.ZodNumber>;
        outputQuantity: z.ZodOptional<z.ZodNumber>;
        promptTokens: z.ZodOptional<z.ZodNumber>;
        completionTokens: z.ZodOptional<z.ZodNumber>;
        reasoningTokens: z.ZodOptional<z.ZodNumber>;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type AIGatewayResponseMetadata = z.infer<typeof AIGatewayResponseMetadataSchema>;
export type AIGatewayStreamingCompletion = {
    stream: ReadableStream<Uint8Array>;
    metadata: Promise<AIGatewayResponseMetadata>;
};
export declare function getAIGatewayTextFromParts(parts: unknown): string;
export type AIGatewayCompletionTextReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'refusal' | 'no_content' | 'unknown';
export interface AIGatewayCompletionTextResult {
    /** Concatenated assistant text. Empty string if the response carried no textual content. */
    text: string;
    /** Whether any textual content was found. False distinguishes "empty response" from "response was ''". */
    hasText: boolean;
    /** Best-effort finish reason normalized across provider shapes. `undefined` when not reported. */
    finishReason?: AIGatewayCompletionTextReason;
    /** Tool calls reported by the model, if any (OpenAI shape or Anthropic tool_use blocks). */
    toolCalls?: unknown[];
}
/**
 * Extract the assistant's textual reply from an `AIGatewayChatCompletion`, normalizing across
 * OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Google Generative AI
 * response shapes. Concatenates content-parts arrays.
 *
 * Returns a structured result so callers can distinguish "the model returned no text" (e.g. it
 * stopped because of `tool_calls` or `length`) from "the model returned an empty string". For
 * the common case of just wanting the string, see {@link getAIGatewayCompletionText}.
 */
export declare function getAIGatewayCompletionTextResult(completion: unknown): AIGatewayCompletionTextResult;
/**
 * Extract the assistant's textual reply from an `AIGatewayChatCompletion` as a plain string.
 * Concatenates content-parts arrays; returns `''` when the response carried no textual content.
 * Use {@link getAIGatewayCompletionTextResult} when you need to distinguish "no text" from `''`.
 */
export declare function getAIGatewayCompletionText(completion: unknown): string;
export declare function getAIGatewayStreamDeltaText(payload: unknown): string;
export declare function getAIGatewayStreamReasoningText(payload: unknown): string;
export interface AIGatewayRequestOptions {
    path: string;
    method?: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'PATCH';
    body?: unknown;
    headers?: Record<string, string>;
    stream?: boolean;
}
export interface AIGatewayRequestResponse<T = unknown> {
    data: T;
    response: Response;
    metadata: AIGatewayResponseMetadata;
}
export declare class AIGatewayService {
    readonly baseUrl: string;
    readonly adapter: FetchAdapter;
    constructor(baseUrl: string, adapter: FetchAdapter);
    listModels(): Promise<AIGatewayModels>;
    complete(params: AIGatewayChatCompletionParams): Promise<AIGatewayChatCompletion>;
    request<T = unknown>(options: AIGatewayRequestOptions): Promise<AIGatewayRequestResponse<T>>;
    streamComplete(params: AIGatewayChatCompletionParams): Promise<ReadableStream<Uint8Array>>;
    streamCompleteWithMetadata(params: AIGatewayChatCompletionParams): Promise<AIGatewayStreamingCompletion>;
    streamRequest(options: AIGatewayRequestOptions): Promise<AIGatewayStreamingCompletion>;
}
//# sourceMappingURL=service.d.ts.map