venice-dev-tools
Version:
unOfficial SDK for the Venice AI API
69 lines (66 loc) • 2.13 kB
TypeScript
import { VeniceAI, VeniceClientConfig, GenerateImageResponse } from '@venice-dev-tools/core';
export * from '@venice-dev-tools/core';
/**
* Web implementation of the Venice AI client.
*
* Extends the core VeniceAI client with web-specific functionality
* such as browser storage and file handling.
*/
declare class VeniceWeb extends VeniceAI {
/**
* Create a new Web Venice AI client.
*
* @param config - Configuration options for the client.
*/
constructor(config?: VeniceClientConfig);
/**
* Save the API key to local storage.
*
* @param apiKey - The API key to save.
* @param rememberMe - Whether to remember the API key (store in localStorage).
*/
saveApiKey(apiKey: string, rememberMe?: boolean): void;
/**
* Clear the stored API key.
*/
clearApiKey(): void;
/**
* Check if an API key is stored.
*
* @returns Whether an API key is stored.
*/
hasStoredApiKey(): boolean;
/**
* Generate an image and get it as a blob URL.
*
* @param options - The image generation options.
* @returns The image blob URL and generation response.
*/
generateImageAsUrl(options: Parameters<VeniceAI['images']['generate']>[0]): Promise<{
url: string;
response: GenerateImageResponse;
}>;
/**
* Convert a base64 string to a Blob.
*
* @param base64Data - The base64 image data (can include or exclude data URI prefix).
* @param mimeType - The MIME type of the image.
* @returns The Blob object.
*/
base64ToBlob(base64Data: string, mimeType?: string): Blob;
/**
* Download a generated image.
*
* @param base64Data - The base64 image data.
* @param fileName - The name for the downloaded file.
*/
downloadImage(base64Data: string, fileName?: string): void;
/**
* Read a local file as a base64 string.
*
* @param file - The file to read.
* @returns A promise resolving to the base64 string.
*/
readFileAsBase64(file: File): Promise<string>;
}
export { VeniceWeb, VeniceWeb as default };