import type { SDKConfig, RunOptions, StreamOptions } from './types/sdk'; import type { SchemaKey, SchemaMap, ModelResultMap, ModelAIR, UtilityMap, RunParams } from './types/task-map'; import type { TextStream } from './types/stream'; import { type ContentClient } from './content'; export type RunwareClient = { connect: () => Promise; disconnect: () => Promise; isConnected: () => boolean; /** * Run an inference task. * * With an official model — return type auto-inferred: * client.run({ model: 'inworld:tts@2', ... }) → AudioInferenceResult[] * * With an architecture generic — typed params and results: * client.run<'sdxl'>({ model: '...', positivePrompt: '...' }) * * Without — loose params, untyped result: * client.run({ model: '...', positivePrompt: '...' }) */ run: { (params: { model: M; } & Record, options?: RunOptions): Promise; (params: SchemaMap[S]['params'], options?: RunOptions): Promise; (params: RunParams, options?: RunOptions): Promise[]>; }; /** * Stream text inference token-by-token via SSE. * * Returns a TextStream with: * - `.textStream` — AsyncIterable for text deltas as they arrive * - `.reasoningStream` — AsyncIterable for reasoning deltas * - `.text()` — Promise for the full accumulated text * - `.result()` — Promise for final metadata * * Options: * - `signal` — AbortSignal to cancel the stream. * * Usage: * const stream = client.stream({ model: '...', messages: [...] }) * for await (const word of stream.textStream) { console.log(word) } */ stream: (params: Record, options?: StreamOptions) => Promise; /** * Force a refresh of the model registry from the remote endpoint. * Useful when a day-zero model has been launched and you want it * available immediately without waiting for the next TTL cycle. */ refreshRegistry: () => Promise; /** * Poll for the result of a previously submitted async task. * Used internally by the SDK during async task execution. */ getResponse: (params: UtilityMap['getResponse']['params'], options?: RunOptions) => Promise; /** * Retrieve the original request and response for a previously executed task. * Looks up archived task data by `taskUUID`. */ getTaskDetails: (params: UtilityMap['getTaskDetails']['params'], options?: RunOptions) => Promise; /** * Search for models. */ modelSearch: (params: UtilityMap['modelSearch']['params'], options?: RunOptions) => Promise; /** * Upload a model. */ modelUpload: (params: UtilityMap['modelUpload']['params'], options?: RunOptions) => Promise; /** * Upload an image. * * @deprecated Use `mediaStorage` instead, which handles any media type and supports deletion. */ imageUpload: (params: UtilityMap['imageUpload']['params'], options?: RunOptions) => Promise; /** * Store or delete media in your Runware account. */ mediaStorage: (params: UtilityMap['mediaStorage']['params'], options?: RunOptions) => Promise; /** * Manage account settings. */ accountManagement: (params: UtilityMap['accountManagement']['params'], options?: RunOptions) => Promise; /** * Public read-only metadata about Runware's curated model catalog — * listings, single model details, examples, pricing, capabilities, creators. * Backed by the content service, separate from the inference API. */ content: ContentClient; }; type ClientConfig = Partial & { apiKey: string; }; /** * Create a Runware SDK client. Returns a ready-to-use `RunwareClient` with * `.run()`, `.stream()`, and utility methods like `.modelSearch()`. * * The only required field is `apiKey`. Everything else has sensible defaults: * - `transport`: `'websocket'` (use `'rest'` for stateless serverless) * - `timeout`/`pollTimeout`: 20 min (covers video, 3D, large upscale) * - `retry`/`reconnect`: built-in with exponential backoff * * For WebSocket, call `.connect()` before the first request. For REST it's a * no-op (each request is a standalone HTTP call). * * @example * const client = await createClient({ apiKey: process.env.RUNWARE_API_KEY }) * await client.connect() * const images = await client.run({ model: 'runware:101@1', positivePrompt: 'a cat' }) */ export declare const createClient: (userConfig: ClientConfig) => Promise; export {}; //# sourceMappingURL=client.d.ts.map