본문으로 건너뛰기

Interface: ProviderAdapter

Defined in: provider-sdk/src/types.ts:51

A provider that can generate completions and optionally speech, images and transcriptions (ТЗ §4.3). Text generation is the base capability; the other modalities are optional so an LLM-only adapter stays a valid provider.

Properties

capabilities?

readonly optional capabilities?: Readonly<{ assistantPrefill?: boolean; textCompletion?: boolean; }>

Defined in: provider-sdk/src/types.ts:66

Optional generation-wire capabilities. Plugin adapters must opt in before a connection profile can use the respective feature; the host never silently drops a persisted profile override.


kind

readonly kind: string

Defined in: provider-sdk/src/types.ts:53

Stable provider kind, e.g. "openai-compatible".


modalities?

readonly optional modalities?: readonly ("text" | "speech" | "transcription" | "image")[]

Defined in: provider-sdk/src/types.ts:59

Declared capabilities. Defaults to ['text'] when omitted. Hosts use it to reject unsupported modalities with a typed error before any call.

Methods

countTokens()?

optional countTokens(request): Promise<TokenCount>

Defined in: provider-sdk/src/types.ts:95

Optional local token counting (approximation allowed with a flag).

Parameters

request

TokenCountRequest

Returns

Promise<TokenCount>


generate()

generate(request, signal): AsyncIterable<{ chatId: string; messages: object[]; meta: {[key: string]: unknown; }; requestId: string; responseToken: string; type: "plugin_intercept"; } | { requestId: string; type: "start"; } | { text: string; type: "delta"; } | { text: string; type: "done"; usage?: { completionTokens: number; promptTokens: number; totalTokens: number; }; } | { code: string; message: string; type: "error"; }>

Defined in: provider-sdk/src/types.ts:83

Generate a completion, streaming unified events. Exactly one terminal event (done or error) is yielded. Must abort promptly on signal.

Parameters

request
assistantPrefill?

string

Provider-neutral assistant prefill. Adapters serialize it as the beginning of the assistant turn; the host prepends it to the streamed/saved reply. Plugin adapters must explicitly opt in before a connection profile using this field can be applied.

frequencyPenalty?

number

maxTokens

number

messages

object[]

minP?

number

model

string

presencePenalty?

number

reasoning?

boolean

reasoningEffort?

"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"

repetitionPenalty?

number

seed?

number

stop?

string[]

stream

boolean

temperature

number

topA?

number

topK?

number

topP?

number

signal

AbortSignal

Returns

AsyncIterable<{ chatId: string; messages: object[]; meta: {[key: string]: unknown; }; requestId: string; responseToken: string; type: "plugin_intercept"; } | { requestId: string; type: "start"; } | { text: string; type: "delta"; } | { text: string; type: "done"; usage?: { completionTokens: number; promptTokens: number; totalTokens: number; }; } | { code: string; message: string; type: "error"; }>


image()?

optional image(request, signal): AsyncIterable<{ requestId: string; type: "start"; } | { dataBase64: string; mime: string; type: "image"; } | { count: number; type: "done"; } | { code: string; message: string; type: "error"; }>

Defined in: provider-sdk/src/types.ts:89

Image generation. Same streaming contract shape as generate.

Parameters

request
count?

number

height?

number

model

string

prompt

string

width?

number

signal

AbortSignal

Returns

AsyncIterable<{ requestId: string; type: "start"; } | { dataBase64: string; mime: string; type: "image"; } | { count: number; type: "done"; } | { code: string; message: string; type: "error"; }>


listModels()

listModels(signal): Promise<object[]>

Defined in: provider-sdk/src/types.ts:77

List available models. Must respect the abort signal.

Parameters

signal

AbortSignal

Returns

Promise<object[]>


speech()?

optional speech(request, signal): AsyncIterable<{ requestId: string; type: "start"; } | { dataBase64: string; mime: string; type: "audio"; } | { bytes: number; mime: string; type: "done"; } | { code: string; message: string; type: "error"; }>

Defined in: provider-sdk/src/types.ts:86

Text-to-speech. Same streaming contract shape as generate.

Parameters

request
format?

"wav" | "mp3"

input

string

model

string

voice?

string

signal

AbortSignal

Returns

AsyncIterable<{ requestId: string; type: "start"; } | { dataBase64: string; mime: string; type: "audio"; } | { bytes: number; mime: string; type: "done"; } | { code: string; message: string; type: "error"; }>


transcribe()?

optional transcribe(request, signal): Promise<{ language?: string; text: string; }>

Defined in: provider-sdk/src/types.ts:92

Speech-to-text (single result, not streamed).

Parameters

request
audioBase64

string

mime

string

model

string

signal

AbortSignal

Returns

Promise<{ language?: string; text: string; }>


validateConfig()

validateConfig(): Promise<ValidationResult>

Defined in: provider-sdk/src/types.ts:74

Validate provider configuration without performing network calls.

Returns

Promise<ValidationResult>