export type GetApiJoinmassiveAiArgs = {prompt: string, model?: string | undefined, device?: string | undefined, country?: string | undefined, subdivision?: string | undefined, city?: string | undefined, language?: string | undefined, format?: string | undefined, expiration?: number | undefined, callback?: string | undefined, mode?: string | undefined}; export type GetApiJoinmassiveAiOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve an LLM completion. Supports ChatGPT, Gemini, Perplexity, and Copilot with geotargeting. * * GET /joinmassive/ai */ export const getApiJoinmassiveAi = async (args: GetApiJoinmassiveAiArgs, options?: GetApiJoinmassiveAiOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.prompt != null) query.append("prompt", String(args.prompt)) if (args.model != null) query.append("model", String(args.model)) if (args.device != null) query.append("device", String(args.device)) if (args.country != null) query.append("country", String(args.country)) if (args.subdivision != null) query.append("subdivision", String(args.subdivision)) if (args.city != null) query.append("city", String(args.city)) if (args.language != null) query.append("language", String(args.language)) if (args.format != null) query.append("format", String(args.format)) if (args.expiration != null) query.append("expiration", String(args.expiration)) if (args.callback != null) query.append("callback", String(args.callback)) if (args.mode != null) query.append("mode", String(args.mode)) const url = `${baseUrl.replace(/\/+$/, '')}/joinmassive/ai${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };