import { RequestMetadata } from '@vscode/copilot-api';
import { Raw } from '@vscode/prompt-tsx';
import type { CancellationToken } from 'vscode';
import { ITokenizer, TokenizerType } from '../../../util/common/tokenizer';
import { AsyncIterableObject } from '../../../util/vs/base/common/async';
import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';
import { IAuthenticationService } from '../../authentication/common/authentication';
import { IChatMLFetcher, Source } from '../../chat/common/chatMLFetcher';
import { ChatLocation, ChatResponse } from '../../chat/common/commonTypes';
import { IConfigurationService } from '../../configuration/common/configurationService';
import { ILogService } from '../../log/common/logService';
import { FinishedCallback, OptionalChatRequestParams } from '../../networking/common/fetch';
import { IFetcherService, Response } from '../../networking/common/fetcherService';
import { IChatEndpoint, IChatEndpointTokenPricing, ICreateEndpointBodyOptions, IEndpointBody, IMakeChatRequestOptions, InteractionTypeOverride } from '../../networking/common/networking';
import { ChatCompletion, RawMessageConversionCallback } from '../../networking/common/openai';
import { IChatWebSocketManager } from '../../networking/node/chatWebSocketManager';
import { IExperimentationService } from '../../telemetry/common/nullExperimentationService';
import { ITelemetryService, TelemetryProperties } from '../../telemetry/common/telemetry';
import { TelemetryData } from '../../telemetry/common/telemetryData';
import { ITokenizerProvider } from '../../tokenizer/node/tokenizer';
import { ICAPIClientService } from '../common/capiClient';
import { IDomainService } from '../common/domainService';
import { CustomModel, IChatModelInformation } from '../common/endpointProvider';
/**
 * The default processor for the stream format from CAPI
 */
export declare function defaultChatResponseProcessor(telemetryService: ITelemetryService, logService: ILogService, response: Response, expectedNumChoices: number, finishCallback: FinishedCallback, telemetryData: TelemetryData, cancellationToken?: CancellationToken | undefined): Promise<AsyncIterableObject<ChatCompletion>>;
export declare function defaultNonStreamChatResponseProcessor(response: Response, finishCallback: FinishedCallback, telemetryData: TelemetryData): Promise<AsyncIterableObject<ChatCompletion>>;
export declare class ChatEndpoint implements IChatEndpoint {
    readonly modelMetadata: IChatModelInformation;
    protected readonly _domainService: IDomainService;
    private readonly _chatMLFetcher;
    private readonly _tokenizerProvider;
    protected readonly _instantiationService: IInstantiationService;
    protected readonly _configurationService: IConfigurationService;
    private readonly _expService;
    private readonly _chatWebSocketService;
    private readonly _maxTokens;
    private readonly _maxOutputTokens;
    readonly model: string;
    readonly name: string;
    readonly version: string;
    readonly modelProvider: string;
    readonly family: string;
    readonly tokenizer: TokenizerType;
    readonly showInModelPicker: boolean;
    readonly isFallback: boolean;
    readonly supportsToolCalls: boolean;
    readonly supportsVision: boolean;
    readonly supportsPrediction: boolean;
    readonly supportsAdaptiveThinking?: boolean;
    readonly minThinkingBudget?: number;
    readonly maxThinkingBudget?: number;
    readonly supportsReasoningEffort?: string[];
    readonly supportsToolSearch?: boolean;
    readonly supportsContextEditing?: boolean;
    readonly isPremium?: boolean | undefined;
    readonly multiplier?: number | undefined;
    readonly restrictedToSkus?: string[] | undefined;
    readonly tokenPricing?: IChatEndpointTokenPricing | undefined;
    readonly priceCategory?: string | undefined;
    readonly customModel?: CustomModel | undefined;
    readonly maxPromptImages?: number | undefined;
    private readonly _supportsStreaming;
    constructor(modelMetadata: IChatModelInformation, _domainService: IDomainService, _chatMLFetcher: IChatMLFetcher, _tokenizerProvider: ITokenizerProvider, _instantiationService: IInstantiationService, _configurationService: IConfigurationService, _expService: IExperimentationService, _chatWebSocketService: IChatWebSocketManager, _logService: ILogService);
    getExtraHeaders(location?: ChatLocation, interactionTypeOverride?: InteractionTypeOverride): Record<string, string>;
    protected getAnthropicBetaHeader(location?: ChatLocation, interactionTypeOverride?: InteractionTypeOverride): Record<string, string>;
    get modelMaxPromptTokens(): number;
    get maxOutputTokens(): number;
    get urlOrRequestMetadata(): string | RequestMetadata;
    protected get useResponsesApi(): boolean;
    protected get useWebSocketResponsesApi(): boolean;
    protected get useMessagesApi(): boolean;
    get degradationReason(): string | undefined;
    get apiType(): string;
    interceptBody(body: IEndpointBody | undefined): void;
    createRequestBody(options: ICreateEndpointBodyOptions): IEndpointBody;
    /**
     * Returns the model-specific image limit, or `undefined` if no limit applies.
     * Anthropic Messages API allows up to 20 images per request; Gemini allows up to 10.
     * These are hardcoded based on API documentation rather than model metadata to
     * avoid being clamped by unreliable server-provided values.
     */
    private getImageLimit;
    /**
     * Thin wrapper around {@link filterHistoryImages} retained for test ergonomics.
     */
    private validateAndFilterImages;
    protected getCompletionsCallback(): RawMessageConversionCallback | undefined;
    protected customizeMessagesBody(body: IEndpointBody): IEndpointBody;
    protected customizeResponsesBody(body: IEndpointBody): IEndpointBody;
    protected customizeCapiBody(body: IEndpointBody, options: ICreateEndpointBodyOptions): IEndpointBody;
    processResponseFromChatEndpoint(telemetryService: ITelemetryService, logService: ILogService, response: Response, expectedNumChoices: number, finishCallback: FinishedCallback, telemetryData: TelemetryData, cancellationToken?: CancellationToken | undefined): Promise<AsyncIterableObject<ChatCompletion>>;
    acquireTokenizer(): ITokenizer;
    makeChatRequest2(options: IMakeChatRequestOptions, token: CancellationToken): Promise<ChatResponse>;
    protected _makeChatRequest2(options: IMakeChatRequestOptions, token: CancellationToken): Promise<ChatResponse>;
    makeChatRequest(debugName: string, messages: Raw.ChatMessage[], finishedCb: FinishedCallback | undefined, token: CancellationToken, location: ChatLocation, source?: Source, requestOptions?: Omit<OptionalChatRequestParams, 'n'>, userInitiatedRequest?: boolean, telemetryProperties?: TelemetryProperties): Promise<ChatResponse>;
    cloneWithTokenOverride(modelMaxPromptTokens: number): IChatEndpoint;
}
export declare class RemoteAgentChatEndpoint extends ChatEndpoint {
    private readonly _requestMetadata;
    constructor(modelMetadata: IChatModelInformation, _requestMetadata: RequestMetadata, domainService: IDomainService, capiClientService: ICAPIClientService, fetcherService: IFetcherService, telemetryService: ITelemetryService, authService: IAuthenticationService, chatMLFetcher: IChatMLFetcher, tokenizerProvider: ITokenizerProvider, instantiationService: IInstantiationService, configService: IConfigurationService, experimentService: IExperimentationService, chatWebSocketService: IChatWebSocketManager, logService: ILogService);
    processResponseFromChatEndpoint(telemetryService: ITelemetryService, logService: ILogService, response: Response, expectedNumChoices: number, finishCallback: FinishedCallback, telemetryData: TelemetryData, cancellationToken?: CancellationToken | undefined, _location?: ChatLocation): Promise<AsyncIterableObject<ChatCompletion>>;
    get urlOrRequestMetadata(): RequestMetadata;
}
//# sourceMappingURL=chatEndpoint.d.ts.map