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

    Interface CanonicalChatResponse

    @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 CanonicalChatResponse {
        id: string;
        object: "chat.completion";
        created: number;
        model: string;
        choices: {
            index: number;
            message: {
                role: "assistant";
                content: string | null;
                tool_calls?: ChatToolCall[];
                reasoning_content?: string;
            };
            finish_reason: string;
        }[];
        usage: TokenUsage;
    }
    Index

    Properties

    id: string
    object: "chat.completion"
    created: number
    model: string
    choices: {
        index: number;
        message: {
            role: "assistant";
            content: string | null;
            tool_calls?: ChatToolCall[];
            reasoning_content?: string;
        };
        finish_reason: string;
    }[]
    usage: TokenUsage