import type { CancellationToken } from 'vscode'; import { IChatMLFetcher } from '../../../platform/chat/common/chatMLFetcher'; import { ChatResponse } from '../../../platform/chat/common/commonTypes'; import { IConfigurationService } from '../../../platform/configuration/common/configurationService'; import { IDomainService } from '../../../platform/endpoint/common/domainService'; import { IChatModelInformation } from '../../../platform/endpoint/common/endpointProvider'; import { ChatEndpoint } from '../../../platform/endpoint/node/chatEndpoint'; import { ILogService } from '../../../platform/log/common/logService'; import { IChatEndpoint, ICreateEndpointBodyOptions, IEndpointBody, IMakeChatRequestOptions } from '../../../platform/networking/common/networking'; import { RawMessageConversionCallback } from '../../../platform/networking/common/openai'; import { IChatWebSocketManager } from '../../../platform/networking/node/chatWebSocketManager'; import { IExperimentationService } from '../../../platform/telemetry/common/nullExperimentationService'; import { ITokenizerProvider } from '../../../platform/tokenizer/node/tokenizer'; import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation'; /** * Checks to see if a given endpoint is a BYOK model. * @param endpoint The endpoint to check if it's a BYOK model * @returns 1 if client side byok, 2 if server side byok, -1 if not a byok model */ export declare function isBYOKModel(endpoint: IChatEndpoint | undefined): number; export declare class OpenAIEndpoint extends ChatEndpoint { protected readonly _apiKey: string; protected readonly _modelUrl: string; protected instantiationService: IInstantiationService; protected logService: ILogService; private static readonly _reservedHeaders; private static readonly _validHeaderNamePattern; private static readonly _maxHeaderNameLength; private static readonly _maxHeaderValueLength; private static readonly _maxCustomHeaderCount; protected readonly _customHeaders: Record; constructor(_modelMetadata: IChatModelInformation, _apiKey: string, _modelUrl: string, domainService: IDomainService, chatMLFetcher: IChatMLFetcher, tokenizerProvider: ITokenizerProvider, instantiationService: IInstantiationService, configurationService: IConfigurationService, expService: IExperimentationService, chatWebSocketService: IChatWebSocketManager, logService: ILogService); /** * BYOK endpoints supply their own credential (`api-key` / `Authorization`) * via {@link getExtraHeaders}, so the chat fetcher must not fall back to the * CAPI Copilot bearer token nor raise a missing-key error for these requests. */ readonly ownsAuthorization = true; protected getCompletionsCallback(): RawMessageConversionCallback; protected _isReservedHeader(lowerKey: string): boolean; private _sanitizeCustomHeaders; private _sanitizeHeaderValue; createRequestBody(options: ICreateEndpointBodyOptions): IEndpointBody; private _applyConfiguredModelOptions; /** * Forwards the per-request reasoning effort to the model body in the shape the endpoint expects. * Default shape mirrors the API path (`Responses` \u2192 nested `reasoning.effort`, `Messages` \u2192 `output_config.effort`, * `Chat Completions` \u2192 top-level `reasoning_effort`). * `IChatModelInformation.reasoningEffortFormat` overrides the default so users hosting OpenAI-compatible servers * with diverging conventions (e.g. nested `reasoning.effort` on `/chat/completions`) can opt in deterministically. */ private _applyReasoningEffort; interceptBody(body: IEndpointBody | undefined): void; get urlOrRequestMetadata(): string; getExtraHeaders(): Record; cloneWithTokenOverride(modelMaxPromptTokens: number): IChatEndpoint; makeChatRequest2(options: IMakeChatRequestOptions, token: CancellationToken): Promise; } //# sourceMappingURL=openAIEndpoint.d.ts.map