import type { LlmAnalytics } from "../_internal/types.gen";
import type { RequestOptions } from "../base-client";
import type { RequestBuilder } from "../request-builder";
/** LLM provider configuration for an application. */
export interface ProviderConfig {
    id?: string;
    cloud_model?: string;
    embedding_model?: string;
    vector_dimensions?: number;
    model_overrides?: Record<string, string>;
    fallback_chains?: Record<string, unknown> | null;
    pricing_floor_percent?: number | null;
    workload_backends?: Record<string, unknown> | null;
}
/**
 * Attributes accepted by the LLM analytics `:record` create action.
 *
 * Mirrors the server `GptCore.LLM.LlmAnalytics` `:record` accept list.
 * Note: the model attribute is `model_id` (NOT `model`). Decimal fields
 * (`cost_usd`, `wholesale_cost_usd`, `audio_seconds`) accept either a
 * number or a string to preserve precision over the wire.
 */
export interface RecordLlmAnalyticsAttributes {
    model_id: string;
    tenant_id?: string;
    workspace_id?: string;
    user_id?: string;
    agent_id?: string;
    provider?: string;
    task?: string;
    workload?: string;
    input_tokens?: number;
    output_tokens?: number;
    total_tokens?: number;
    audio_seconds?: number | string;
    image_pages?: number;
    image_tokens?: number;
    character_count?: number;
    latency_ms?: number;
    cost_usd?: number | string;
    wholesale_cost_usd?: number | string;
    confidence_score?: number;
    metadata?: Record<string, unknown>;
    usage_event_id?: string;
}
/** LLM analytics cost breakdown. */
export interface LlmCostBreakdown {
    total_usd?: number;
    total_tokens?: number;
    by_model?: Array<{
        name?: string;
        usd?: number;
        tokens?: number;
    }>;
}
/** LLM analytics summary. */
export interface LlmAnalyticsSummary {
    total_requests?: number;
    avg_latency_ms?: number;
}
/** LLM analytics usage time-series. */
export interface LlmAnalyticsUsage {
    data_points?: Array<{
        timestamp?: string;
        tokens?: number;
        requests?: number;
    }>;
}
/** LLM workspace-level metrics. */
export interface LlmWorkspaceMetrics {
    top_agents?: Array<{
        name?: string;
    }>;
}
/** LLM platform-level summary metrics. */
export interface LlmPlatformSummary {
    total_requests?: number;
    total_tokens?: number;
    total_usd?: number;
}
/**
 * Creates the `ai` namespace for the admin SDK, providing methods for
 * LLM provider configuration, analytics, and semantic cache management.
 *
 * @param rb - The `RequestBuilder` instance bound to the authenticated client.
 * @returns An object containing AI management sub-namespaces.
 *
 * @example
 * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
 *
 * // List provider configs
 * const configs = await admin.ai.providerConfig.list();
 *
 * // Get analytics summary
 * const summary = await admin.ai.analytics.summary();
 *
 * // Clear semantic cache
 * await admin.ai.cache.clear(true);
 */
export declare function createAiNamespace(rb: RequestBuilder): {
    /**
     * Sub-namespace for managing LLM provider configurations.
     *
     * Provider configs control which LLM provider and model an application
     * uses for inference. Each application can have its own config.
     */
    providerConfig: {
        /**
         * Lists all provider configurations.
         *
         * @param options - Optional request options.
         * @returns A promise that resolves to an array of provider config objects.
         *
         * @example
         * const configs = await admin.ai.providerConfig.list();
         * console.log(`Provider configs: ${configs.length}`);
         */
        list: (options?: RequestOptions) => Promise<ProviderConfig[]>;
        /**
         * Gets a provider configuration by ID.
         *
         * @param id - The UUID of the provider config.
         * @param options - Optional request options.
         * @returns A promise that resolves to the provider config object.
         *
         * @example
         * const config = await admin.ai.providerConfig.get('cfg_01HXYZ...');
         * console.log(`Model: ${config.cloud_model}`);
         */
        get: (id: string, options?: RequestOptions) => Promise<ProviderConfig>;
        /**
         * Creates or upserts a provider configuration.
         *
         * @param attributes - The provider config attributes.
         * @param options - Optional request options.
         * @returns A promise that resolves to the created provider config.
         *
         * @example
         * const config = await admin.ai.providerConfig.create({
         *   cloud_model: 'google/gemini-2.5-pro',
         *   embedding_model: 'text-embedding-004',
         * });
         */
        create: (attributes: Partial<ProviderConfig>, options?: RequestOptions) => Promise<ProviderConfig>;
        /**
         * Updates a provider configuration by ID.
         *
         * @param id - The UUID of the provider config to update.
         * @param attributes - The attributes to update.
         * @param options - Optional request options.
         * @returns A promise that resolves to the updated provider config.
         *
         * @example
         * const updated = await admin.ai.providerConfig.update('cfg_01HXYZ...', {
         *   cloud_model: 'gpt-4o-mini',
         * });
         */
        update: (id: string, attributes: Partial<ProviderConfig>, options?: RequestOptions) => Promise<ProviderConfig>;
    };
    /**
     * Sub-namespace for querying LLM analytics and usage metrics.
     *
     * Provides admin-level access to token usage, costs, and platform-wide
     * metrics across all tenants and workspaces.
     */
    analytics: {
        /**
         * Lists raw LLM analytics records.
         *
         * @param options - Optional request options.
         * @returns A promise that resolves to an array of analytics records.
         *
         * @example
         * const records = await admin.ai.analytics.list();
         * console.log(`Total records: ${records.length}`);
         */
        list: (options?: RequestOptions) => Promise<LlmAnalytics[]>;
        /**
         * Gets a single LLM analytics record by ID.
         *
         * @param id - The UUID of the analytics record.
         * @param options - Optional request options.
         * @returns A promise that resolves to the analytics record.
         *
         * @example
         * const record = await admin.ai.analytics.get("lla_01HXYZ...");
         * console.log(record.attributes?.model_id);
         */
        get: (id: string, options?: RequestOptions) => Promise<LlmAnalytics>;
        /**
         * Records a new LLM analytics entry.
         *
         * @param attributes - The analytics entry attributes.
         * @param options - Optional request options.
         * @returns A promise that resolves to the created record.
         *
         * @example
         * const entry = await admin.ai.analytics.record({
         *   model_id: "gpt-4o-mini",
         *   provider: "openrouter",
         *   task: "completion",
         *   workload: "chat",
         *   input_tokens: 1200,
         *   output_tokens: 350,
         *   total_tokens: 1550,
         *   latency_ms: 820,
         *   cost_usd: "0.0042",
         * });
         * console.log(entry.id);
         */
        record: (attributes: RecordLlmAnalyticsAttributes, options?: RequestOptions) => Promise<LlmAnalytics>;
        /**
         * Returns a token cost breakdown grouped by model and time period.
         *
         * @param options - Optional request options.
         * @returns A promise that resolves to a cost breakdown object.
         *
         * @example
         * const costs = await admin.ai.analytics.costs();
         * console.log(`Total spend: $${costs.total_usd}`);
         */
        costs: (options?: RequestOptions) => Promise<LlmCostBreakdown>;
        /**
         * Returns a high-level summary of LLM usage, optionally filtered by date range.
         *
         * @param params - Optional filter parameters.
         * @param params.startDate - ISO 8601 start date for the summary period.
         * @param params.endDate - ISO 8601 end date for the summary period.
         * @param options - Optional request options.
         * @returns A promise that resolves to a summary metrics object.
         *
         * @example
         * const summary = await admin.ai.analytics.summary();
         * const filtered = await admin.ai.analytics.summary({
         *   startDate: "2026-01-01",
         *   endDate: "2026-03-31",
         * });
         */
        summary: (params?: {
            startDate?: string;
            endDate?: string;
        }, options?: RequestOptions) => Promise<LlmAnalyticsSummary>;
        /**
         * Returns time-series LLM usage data points.
         *
         * @param options - Optional request options.
         * @returns A promise that resolves to usage time-series data.
         *
         * @example
         * const usage = await admin.ai.analytics.usage();
         * for (const point of usage.data_points) {
         *   console.log(`${point.timestamp}: ${point.tokens} tokens`);
         * }
         */
        usage: (options?: RequestOptions) => Promise<LlmAnalyticsUsage>;
        /**
         * Returns workspace-scoped LLM metrics.
         *
         * @param workspaceId - The UUID of the workspace to query metrics for.
         * @param options - Optional request options.
         * @returns A promise that resolves to workspace metrics.
         *
         * @example
         * const metrics = await admin.ai.analytics.workspace("ws_abc123");
         */
        workspace: (workspaceId: string, options?: RequestOptions) => Promise<LlmWorkspaceMetrics>;
        /**
         * Returns platform-wide LLM summary across all applications and tenants.
         *
         * @param options - Optional request options.
         * @returns A promise that resolves to platform summary metrics.
         *
         * @example
         * const platform = await admin.ai.analytics.platformSummary();
         * console.log(`Platform total: $${platform.total_usd}`);
         */
        platformSummary: (options?: RequestOptions) => Promise<LlmPlatformSummary>;
    };
    /**
     * Sub-namespace for semantic cache management.
     *
     * The semantic cache stores LLM prompt/response pairs indexed by vector
     * similarity. Admins can inspect cache entries and clear the cache.
     */
    cache: {
        /**
         * Gets semantic cache statistics.
         *
         * @param options - Optional request options.
         * @returns A promise that resolves to the cache stats (entry counts,
         *   hit/miss totals, and storage metrics).
         *
         * @example
         * const stats = await admin.ai.cache.stats();
         * console.log(stats);
         */
        stats: (options?: RequestOptions) => Promise<unknown>;
        /**
         * Clears the semantic cache.
         *
         * Removes all cached prompt/response pairs. This is irreversible.
         * Requires `confirm: true` as a safety gate.
         *
         * @param confirm - Must be `true` to confirm the destructive operation.
         * @param options - Optional request options.
         * @returns A promise that resolves when the cache is cleared.
         *
         * @example
         * await admin.ai.cache.clear(true);
         * console.log('Semantic cache cleared');
         */
        clear: (confirm: boolean, options?: RequestOptions) => Promise<unknown>;
    };
};
//# sourceMappingURL=ai.d.ts.map