UNPKG

venice-dev-tools

Version:

unOfficial SDK for the Venice AI API

83 lines (80 loc) 2.87 kB
import { VeniceAI, VeniceClientConfig, GenerateImageResponse } from '@venice-dev-tools/core'; export * from '@venice-dev-tools/core'; /** * Node.js specific implementation of the Venice AI client. * * Extends the core VeniceAI client with Node-specific functionality * such as file handling and configuration loading. */ declare class VeniceNode extends VeniceAI { /** * Create a new Node.js Venice AI client. * * @param config - Configuration options for the client. */ constructor(config?: VeniceClientConfig); /** * Get the current API key. * * @returns The current API key. * @throws Error with a user-friendly message if no API key is set. */ getApiKey(): string; /** * Load configuration from a JSON file. * * @param filePath - Path to the configuration file. * @returns This client instance. */ loadConfigFromFile(filePath: string): this; /** * Save an image from a base64 string to a file. * * @param base64Data - The base64 image data (can include or exclude data URI prefix). * @param outputPath - Path where the image should be saved. * @returns The absolute path to the saved file. */ saveImageToFile(base64Data: string, outputPath: string): string; /** * Generate an image and save it directly to a file. * * @param options - The image generation options with additional save options. * @param outputPath - Path where the image should be saved. * @returns The image generation response and the saved file path. */ generateImageToFile(options: Parameters<VeniceAI['images']['generate']>[0], outputPath: string): Promise<{ response: GenerateImageResponse; filePath: string; }>; /** * Load an image file as a base64 string. * * @param filePath - Path to the image file. * @param includeDataUri - Whether to include the data URI prefix. * @returns The base64 encoded image string. */ loadImageAsBase64(filePath: string, includeDataUri?: boolean): string; /** * Read an image file as a Buffer. * * @param filePath - Path to the image file. * @returns The image buffer. */ readImageFile(filePath: string): Buffer; /** * Create a temporary file with a unique name. * * @param extension - File extension (without the dot). * @param prefix - Optional file name prefix. * @returns The path to the temporary file. */ createTempFilePath(extension?: string, prefix?: string): string; /** * Save the API key to a configuration file. * * @param apiKey - The API key to save. * @param filePath - Path to the configuration file. */ saveApiKey(apiKey: string, filePath: string): void; } export { VeniceNode, VeniceNode as default };