aiwrapper
Version:
A Universal AI Wrapper for JavaScript & TypeScript
40 lines (39 loc) • 1.28 kB
TypeScript
import { LangImageInput } from "../lang/language-provider.ts";
import { LangMessages } from "../lang/messages.ts";
export type OpenAIImgOptions = {
apiKey: string;
model?: string;
baseURL?: string;
};
export declare class OpenAIImg {
private _apiKey;
private _model;
private _baseURL;
constructor(options: OpenAIImgOptions);
generate(prompt: string, options?: {
size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
quality?: 'standard' | 'hd';
responseFormat?: 'url' | 'b64_json';
}): Promise<LangMessages>;
edit(params: {
prompt: string;
image: LangImageInput;
mask?: LangImageInput;
size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
n?: number;
quality?: 'standard' | 'hd';
responseFormat?: 'url' | 'b64_json';
}): Promise<LangMessages>;
vary(params: {
image: LangImageInput;
size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
n?: number;
quality?: 'standard' | 'hd';
responseFormat?: 'url' | 'b64_json';
}): Promise<LangMessages>;
private buildImageEditForm;
private buildImageVariationForm;
private imageInputToBlob;
private blobFilename;
private guessMimeFromUrl;
}