export type CreateApiV1VideoGenerationsArgs = {body: {duration?: string | undefined, media?: Array> | undefined, model?: string | undefined, prompt?: string | undefined, resolution?: string | undefined}}; export type CreateApiV1VideoGenerationsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * OpenAI Video Generations 兼容入口 * * POST /v1/video/generations */ export const createApiV1VideoGenerations = async (args: CreateApiV1VideoGenerationsArgs, options: CreateApiV1VideoGenerationsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/video/generations${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };