UNPKG

venice-ai-sdk-apl

Version:

A comprehensive SDK for the Venice AI API with CLI support, programmatic CLI usage, CLI-style interface, and interactive demo

88 lines (87 loc) 2.12 kB
/** * HTTP client for making API requests * * This module provides a wrapper around axios for making HTTP requests to the Venice AI API. * It handles authentication, error handling, and response parsing. */ import { ClientConfig, RequestParams } from '../types/common'; /** * HTTP client for making API requests */ export declare class HttpClient { /** * Axios instance for making HTTP requests */ private client; /** * Client configuration */ private config; /** * Creates a new HTTP client * * @param config - Client configuration */ constructor(config: ClientConfig); /** * Gets the base URL for API requests * * @returns The base URL */ getBaseURL(): string; /** * Gets the API key for authentication * * @returns The API key */ getApiKey(): string; /** * Makes an HTTP request to the API * * @param params - Request parameters * @returns Promise that resolves with the response data */ request<T>(params: RequestParams): Promise<T>; /** * Handles successful responses * * @param response - Axios response * @returns Response data */ private handleSuccess; /** * Handles error responses * * @param error - Axios error * @throws ApiError or RateLimitError */ private handleError; /** * Extracts rate limit information from response headers * * @param response - Axios response * @returns Rate limit information */ private extractRateLimitInfo; /** * Extracts balance information from response headers * * @param response - Axios response * @returns Balance information */ private extractBalanceInfo; /** * Sanitizes headers for logging * * @param headers - Headers to sanitize * @returns Sanitized headers */ private sanitizeHeaders; /** * Sanitizes data for logging * * @param data - Data to sanitize * @returns Sanitized data */ private sanitizeData; }