upload
Uploads an image file to the ImagineoAI API.
Signature:
client.images.upload(input: UploadImageRequest): Promise<UploadImageResponse>
- input:
{ file: UploadFileType; description?: string }file: The image to upload. Accepts:- Browser:
FileorBlob - Node.js:
BufferorReadable
- Browser:
description(optional): String description of the image.
- Returns:
{ image_url: string; run_id: string; created_at: string } - Throws: On validation, network, or API error.
Example
const client = new ImagineoAIClient(apiUrl, { apiKey: 'sk-...' });
const file = ... // File, Blob, Buffer, or Readable
const result = await client.images.upload({ file });
console.log(result.image_url);
Notes
- In the browser, only
FileorBlobobjects are accepted. - In Node.js, use
BufferorReadablestreams. - See the Usage Guide for more details.