Er-Api SDK - v1.0.7
    Preparing search index...

    Class OpenErApi

    OpenRouter client for accessing AI models through ER-API

    Index

    Constructors

    Methods

    • Generate a response from an AI model

      Parameters

      • modelId: string

        The model ID to use (e.g. "anthropic/claude-3-opus")

      • prompt: string

        User prompt/query text

      • Optionalparams: ModelParams

        Optional parameters for the model

      Returns Promise<ModelResponse>

      Promise resolving to the model response

    • Check if a specific model is available

      Parameters

      • modelId: string

        The model ID to check

      Returns Promise<ModelInfo>

      Promise resolving to the model information if available

    • Get the current API key

      Returns string

      The current OpenRouter API key

    • Generate a response with step-by-step reasoning

      Parameters

      • modelId: string

        The model ID to use

      • prompt: string

        User prompt/query text

      • Optionalparams: ModelParams

        Optional parameters for the model

      Returns Promise<ModelResponse>

      Promise resolving to the model response with reasoning

    • Set OpenRouter API key

      Parameters

      • key: string

        OpenRouter API key

      Returns void

    • Generate a streaming response from an AI model

      Parameters

      • modelId: string

        The model ID to use

      • prompt: string

        User prompt/query text

      • onData: (data: StreamChunk) => void

        Callback function for data chunks

      • onError: (error: unknown) => void

        Callback function for errors

      • onComplete: (data: StreamChunk) => void

        Callback function called when stream is complete

      • Optionalparams: ModelParams

        Optional parameters for the model

      Returns Promise<void>