@encorp.ai/llm-open-proxy - v0.2.2
    Preparing search index...

    Interface CanonicalChatRequest

    @encorp.ai/llm-open-proxy — OpenAI-canonical chat translator for LLM providers.

    Three layers of API, pick whatever fits:

    1. Pure conversion — give it a canonical request + a provider name, get back a provider-shaped body. No HTTP, no I/O. Best for users who already have their own transport.

      import { convertChatRequest } from '@encorp.ai/llm-open-proxy'; const { body, warnings } = convertChatRequest(canonical, 'anthropic');

    2. Transport — convenience wrappers that handle HTTP + response translation. Returns the response in canonical (OpenAI) shape regardless of the upstream.

      import { sendChatRequest, // OpenAI-shaped providers (openai/google/...) sendAnthropicRequest, // Anthropic-shaped provider } from '@encorp.ai/llm-open-proxy';

    3. Tree-shakeable submodules — import a single provider's adapter when you only care about one upstream:

      import { anthropicChatConfig, toAnthropicRequest } from '@encorp.ai/llm-open-proxy/providers/anthropic';

    interface CanonicalChatRequest {
        model: string;
        messages: ChatMessage[];
        temperature?: number;
        top_p?: number;
        top_k?: number;
        n?: number;
        max_completion_tokens?: number;
        max_tokens?: number;
        stop?: string | string[];
        frequency_penalty?: number;
        presence_penalty?: number;
        logit_bias?: Record<string, number>;
        seed?: number;
        user?: string;
        logprobs?: boolean;
        top_logprobs?: number;
        response_format?: ResponseFormat;
        tools?: ChatTool[];
        tool_choice?: ChatToolChoice;
        parallel_tool_calls?: boolean;
        reasoning_effort?: "low" | "high" | "minimal" | "medium";
        stream?: boolean;
        stream_options?: { include_usage?: boolean };
        provider_options?: Partial<Record<ProviderName, Record<string, unknown>>>;
    }
    Index

    Properties

    model: string
    messages: ChatMessage[]
    temperature?: number
    top_p?: number
    top_k?: number
    n?: number
    max_completion_tokens?: number
    max_tokens?: number

    alias of max_completion_tokens — accepted for back-compat

    stop?: string | string[]
    frequency_penalty?: number
    presence_penalty?: number
    logit_bias?: Record<string, number>
    seed?: number
    user?: string
    logprobs?: boolean
    top_logprobs?: number
    response_format?: ResponseFormat
    tools?: ChatTool[]
    tool_choice?: ChatToolChoice
    parallel_tool_calls?: boolean
    reasoning_effort?: "low" | "high" | "minimal" | "medium"
    stream?: boolean
    stream_options?: { include_usage?: boolean }
    provider_options?: Partial<Record<ProviderName, Record<string, unknown>>>

    Provider-specific escape hatch. The entry whose key matches the active provider is shallow-merged into the upstream body verbatim. Use sparingly for fields the canonical shape does not cover.