import { LicenseState } from '@n8n/backend-common';
import { GlobalConfig } from '@n8n/config';
import { UserRepository } from '@n8n/db';
import { InstanceSettings } from 'n8n-core';
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
import type { AiGatewayConfigDto, AiGatewayUsageResponse } from '@n8n/api-types';
import { License } from '../license';
import { OwnershipService } from '../services/ownership.service';
import { UrlService } from '../services/url.service';
interface GatewayWalletResponse {
    budget: number;
    balance: number;
}
export declare class AiGatewayService {
    private readonly globalConfig;
    private readonly license;
    private readonly licenseState;
    private readonly instanceSettings;
    private readonly ownershipService;
    private readonly userRepository;
    private readonly urlService;
    private readonly tokenCache;
    private readonly TOKEN_CACHE_MAX_SIZE;
    private readonly pendingTokenRequests;
    private gatewayConfig;
    private configFetchedAt;
    private static readonly CONFIG_TTL_MS;
    constructor(globalConfig: GlobalConfig, license: License, licenseState: LicenseState, instanceSettings: InstanceSettings, ownershipService: OwnershipService, userRepository: UserRepository, urlService: UrlService);
    private resolveUserId;
    getSyntheticCredential({ credentialType, userId, workflowId, projectId, }: {
        credentialType: string;
        userId: string | undefined;
        workflowId?: string;
        projectId?: string;
    }): Promise<ICredentialDataDecryptedObject>;
    getUsage(userId: string, offset: number, limit: number): Promise<AiGatewayUsageResponse>;
    getWallet(userId: string): Promise<GatewayWalletResponse>;
    private parseWalletResponse;
    private requireBaseUrl;
    private isConfigStale;
    getGatewayConfig(): Promise<AiGatewayConfigDto>;
    private buildGatewayCredentialsHeaders;
    private getOrFetchToken;
    private fetchAndCacheToken;
}
export {};
