61 lines
2.8 KiB
TypeScript
61 lines
2.8 KiB
TypeScript
import { type MediaKind } from "openclaw/plugin-sdk/media-mime";
|
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
|
|
import type { createProviderOperationDeadline, postMultipartRequest } from "openclaw/plugin-sdk/provider-http";
|
|
import type { VideoGenerationProvider, VideoGenerationRequest } from "openclaw/plugin-sdk/video-generation";
|
|
declare const OPENAI_VIDEO_SIZES: readonly ["720x1280", "1280x720", "1024x1792", "1792x1024"];
|
|
export type OpenAIVideoRequestPolicy = {
|
|
allowPrivateNetwork: boolean;
|
|
dispatcherPolicy?: Parameters<typeof postMultipartRequest>[0]["dispatcherPolicy"];
|
|
};
|
|
export type OpenAIVideoStatus = "queued" | "in_progress" | "completed" | "failed";
|
|
export type OpenAIReferenceAsset = {
|
|
kind: Extract<MediaKind, "image" | "video">;
|
|
file: File;
|
|
};
|
|
export type OpenAIVideoResponse = {
|
|
id?: string;
|
|
model?: string;
|
|
status?: OpenAIVideoStatus;
|
|
prompt?: string | null;
|
|
seconds?: string;
|
|
size?: string;
|
|
error?: string | {
|
|
code?: string;
|
|
message?: string;
|
|
} | null;
|
|
};
|
|
export interface SecretRefObject {
|
|
source: string;
|
|
provider: string;
|
|
id: string;
|
|
}
|
|
export interface VideoPluginConfig {
|
|
baseUrl?: string;
|
|
apiKey?: string | SecretRefObject;
|
|
allowPrivateNetwork?: boolean;
|
|
defaultModel?: string;
|
|
models?: string[];
|
|
}
|
|
export declare function resolvePluginApiKey(rawKey: string | SecretRefObject | undefined): string | undefined;
|
|
export declare function resolveVideoConfig(cfg: VideoGenerationRequest["cfg"] | undefined, apiPluginConfig?: Record<string, unknown>): VideoPluginConfig | undefined;
|
|
export declare function resolveConfiguredOpenAIBaseUrl(cfg: VideoGenerationRequest["cfg"], pluginCfg?: VideoPluginConfig): string;
|
|
export declare function readOpenAIVideoFailureMessage(payload: OpenAIVideoResponse): string | undefined;
|
|
export declare function resolveDurationSeconds(durationSeconds: number | undefined): "4" | "8" | "12" | undefined;
|
|
export declare function resolveSize(params: {
|
|
size?: string;
|
|
aspectRatio?: string;
|
|
resolution?: string;
|
|
}): (typeof OPENAI_VIDEO_SIZES)[number] | undefined;
|
|
export declare function resolveReferenceAsset(req: VideoGenerationRequest): OpenAIReferenceAsset | null;
|
|
export declare function fetchOpenAIVideoDownload(params: {
|
|
url: string;
|
|
init: RequestInit;
|
|
deadline: ReturnType<typeof createProviderOperationDeadline>;
|
|
fetchFn: typeof fetch;
|
|
} & OpenAIVideoRequestPolicy): Promise<any>;
|
|
export declare function buildOpenAIVideoGenerationProvider({ isProviderApiKeyConfiguredAsync, getPluginConfig, }: {
|
|
isProviderApiKeyConfiguredAsync: OpenClawPluginApi["runtime"]["modelAuth"]["isProviderApiKeyConfiguredAsync"];
|
|
getPluginConfig?: () => Record<string, unknown> | undefined;
|
|
}): VideoGenerationProvider;
|
|
export {};
|