Tyr Admission Controller - v0.36.1
    Preparing search index...

    Type Alias Adapter

    type Adapter = {
        forwardHeaders: readonly string[];
        path: string;
        shape: ApiShape;
        createStreamExtractor(
            onUsage: UsageListener,
            onResponse?: (
                response: Record<string, unknown>,
                eventType: unknown,
            ) => void,
        ): StreamExtractor;
        isStreamRequested(body: Record<string, unknown>): boolean;
        parseUsage(json: unknown): TokenUsage | undefined;
        toAdmissionRequest(body: Record<string, unknown>): LLMRequest;
        validate(body: unknown, opts: AdapterValidationOptions): ValidationResult;
    }
    Index
    forwardHeaders: readonly string[]

    Headers forwarded verbatim to the upstream (auth passthrough — the gateway holds no provider keys).

    path: string

    Route path this adapter serves, e.g. "/v1/messages".

    shape: ApiShape
    • Create an incremental usage extractor for a streaming response body. onResponse receives each provider response object the stream carries, with the type of the event that carried it, on protocols that have one, before the chunk holding it is forwarded.

      Parameters

      • onUsage: UsageListener
      • OptionalonResponse: (response: Record<string, unknown>, eventType: unknown) => void

      Returns StreamExtractor

    • Whether the client requested a streaming response.

      Parameters

      • body: Record<string, unknown>

      Returns boolean

    • Parse actual usage from a complete (non-streaming) JSON response body.

      Parameters

      • json: unknown

      Returns TokenUsage | undefined

    • Build the complete token-bearing admission projection.

      Parameters

      • body: Record<string, unknown>

      Returns LLMRequest