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

127 lines (126 loc) 3.51 kB
/** * Venice AI API Client * * This is the main client class for interacting with the Venice AI API. * It provides access to all API resources and handles configuration. * * @example * ```typescript * import { VeniceAI } from 'venice-ai-sdk-apl'; * * const venice = new VeniceAI({ * apiKey: 'your-api-key', * }); * * // Now you can use the client to access API resources * const models = await venice.models.list(); * ``` */ import { ChatResource } from './resources/chat'; import { ImageResource } from './resources/image'; import { ModelsResource } from './resources/models'; import { ApiKeysResource } from './resources/api-keys'; import { CharactersResource } from './resources/characters'; import { VVVResource } from './resources/vvv'; import { ClientConfig } from './types/common'; import { LogLevel } from './utils/logger'; /** * Main Venice AI API client class */ export declare class VeniceAI { /** * The configuration for this client instance */ private config; /** * HTTP client for making API requests */ private httpClient; /** * Chat completions resource */ chat: ChatResource; /** * Image generation resource */ image: ImageResource; /** * Models resource */ models: ModelsResource; /** * API keys resource */ apiKeys: ApiKeysResource; /** * Characters resource */ characters: CharactersResource; /** * VVV resource */ vvv: VVVResource; /** * Creates a new Venice AI API client * * @param config - Client configuration */ constructor(config: Partial<ClientConfig>); /** * Get the current configuration */ getConfig(): ClientConfig; /** * Set the log level * * @param level - Log level */ setLogLevel(level: LogLevel): void; /** * Enable debug logging */ enableDebugLogging(): void; /** * Disable logging */ disableLogging(): void; /** * CLI-style interface that mirrors the command-line syntax * * This method allows you to use the same commands you're familiar with from the CLI * directly in your code. It supports both string-based CLI-style arguments and * object-based options. * * @example * ```typescript * // CLI-style with string arguments * const styles = await venice.cli('list-styles --limit 5'); * * // CLI-style with object arguments * const models = await venice.cli('list-models', { limit: 5, raw: true }); * * // Generate an image * const image = await venice.cli('generate-image "A beautiful sunset" --style Photographic --output sunset.png'); * ``` * * @param command - The command to execute (e.g., 'list-keys', 'chat', 'generate-image') * @param options - Options for the command (can be a string of CLI arguments or an object) * @returns The result of the command */ cli(command: string, options?: string | Record<string, any>): Promise<any>; /** * Parse CLI-style arguments into an options object * * @example * ```typescript * // "--limit 5 --raw" becomes { limit: "5", raw: true } * const options = venice._parseCliArgs("--limit 5 --raw"); * ``` * * @param argsString - The CLI arguments string to parse * @returns An object with the parsed options * @private */ private _parseCliArgs; } export { LogLevel };