import { TotalumApiResponse } from "../common/interfaces"; import { OpenAICompletionResponse, OpenAIChatCompletionResponse, ImageGenerationResponse } from "../common/response-types"; import { FetchClient } from "../common/fetch-client"; import { ChatCompletionCreateParamsBase } from "openai/resources/chat/completions"; import { CompletionCreateParamsBase } from "openai/resources/completions"; export declare class OpenaiService { private client; constructor(client: FetchClient); /** * Creates a completion using OpenAI. * @param {CompletionCreateParamsBase} body - The openai completion body, more info here: https://platform.openai.com/docs/api-reference/completions/create * @returns {Promise>} - The completion provided by openai api * @deprecated use createChatCompletion instead */ createCompletion(body: CompletionCreateParamsBase): Promise>; /** * Creates a chat completion using OpenAI. * @param {ChatCompletionCreateParamsBase} body - The openai chat completion body, more info here: https://platform.openai.com/docs/api-reference/chat/create * @returns {Promise>} - The chat completion provided by openai api */ createChatCompletion(body: ChatCompletionCreateParamsBase): Promise>; /** * Generates an image from scratch using OpenAI gpt-image-1. * @param {object} body - The image generation parameters * @param {string} body.prompt - The prompt describing the image to generate * @param {string} body.fileName - The file name to save the generated image * @param {'1024x1024' | '1536x1024' | '1024x1536' | 'auto'} [body.size] - Image dimensions (default: 'auto') * @param {'low' | 'medium' | 'high' | 'auto'} [body.quality] - Rendering quality (default: 'auto') * @param {'png' | 'jpeg' | 'webp'} [body.output_format] - Output file format (default: 'png') * @param {'transparent' | 'opaque' | 'auto'} [body.background] - Background transparency (default: 'auto') * @returns {Promise>} - The generated image filename and signed URL */ generateImage(body: { prompt: string; fileName: string; size?: '1024x1024' | '1536x1024' | '1024x1536' | 'auto'; quality?: 'low' | 'medium' | 'high' | 'auto'; output_format?: 'png' | 'jpeg' | 'webp'; background?: 'transparent' | 'opaque' | 'auto'; }): Promise>; /** * Edits or transforms existing image(s) using OpenAI gpt-image-1. * Supports: editing existing images, using images as style reference, combining multiple images, masked editing. * @param {object} body - The image edit parameters * @param {string} body.prompt - Description of the desired edit or transformation * @param {string[]} body.imageUrls - Array of image URLs to edit (1-16 images). Can be signed GCS URLs or external URLs. * @param {string} body.fileName - The file name to save the resulting image * @param {string} [body.maskUrl] - URL to a PNG mask image with alpha channel. Transparent areas indicate where the first image should be edited. * @param {'1024x1024' | '1536x1024' | '1024x1536' | 'auto'} [body.size] - Output image dimensions (default: 'auto') * @param {'low' | 'medium' | 'high' | 'auto'} [body.quality] - Rendering quality (default: 'auto') * @param {'png' | 'jpeg' | 'webp'} [body.output_format] - Output file format (default: 'png') * @param {'transparent' | 'opaque' | 'auto'} [body.background] - Background transparency (default: 'auto') * @param {'high' | 'low'} [body.input_fidelity] - How closely to match input images. 'high' preserves details (faces), 'low' allows creative freedom (default: 'low') * @returns {Promise>} - The resulting image filename and signed URL */ editImage(body: { prompt: string; imageUrls: string[]; fileName: string; maskUrl?: string; size?: '1024x1024' | '1536x1024' | '1024x1536' | 'auto'; quality?: 'low' | 'medium' | 'high' | 'auto'; output_format?: 'png' | 'jpeg' | 'webp'; background?: 'transparent' | 'opaque' | 'auto'; input_fidelity?: 'high' | 'low'; }): Promise>; }