@runapi.ai/hailuo
Advanced tools
+11
-1
@@ -117,3 +117,13 @@ "use strict"; | ||
| } | ||
| } | ||
| }, | ||
| "rules": [ | ||
| { | ||
| "when": { | ||
| "model": "hailuo-02-image-to-video-pro" | ||
| }, | ||
| "forbidden": [ | ||
| "enable_safety_checker" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
@@ -120,0 +130,0 @@ "text-to-video": { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-video.ts","../src/contract_gen.ts","../src/resources/image-to-video.ts"],"sourcesContent":["export { HailuoClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\nimport { ImageToVideo } from './resources/image-to-video';\n\n/**\n * Hailuo text-to-video and image-to-video generation API client.\n *\n * @example\n * ```typescript\n * const client = new HailuoClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'hailuo-02-text-to-video-standard',\n * prompt: 'A timelapse of cherry blossoms blooming in a Japanese garden',\n * });\n * ```\n */\nexport class HailuoClient extends BaseClient {\n /** Text-to-video generation from a text prompt. Pro delivers higher fidelity; Standard is faster. */\n public readonly textToVideo: TextToVideo;\n /** Image-to-video animation from a first-frame image guided by a text prompt. */\n public readonly imageToVideo: ImageToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoTextToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/text_to_video';\n\n/** Generate video from a text prompt. Pro delivers higher fidelity; Standard is faster. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoTextToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoTextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export const contract = {\n \"image-to-video\": {\n \"models\": [\n \"hailuo-02-image-to-video-pro\",\n \"hailuo-02-image-to-video-standard\",\n \"hailuo-2.3-image-to-video-pro\",\n \"hailuo-2.3-image-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-image-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n }\n },\n \"hailuo-02-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"512p\",\n \"768p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-pro\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n }\n }\n },\n \"text-to-video\": {\n \"models\": [\n \"hailuo-02-text-to-video-pro\",\n \"hailuo-02-text-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-text-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n }\n },\n \"hailuo-02-text-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoImageToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/image_to_video';\n\n/** Animate a still image into video, guided by a text prompt and first-frame image. Supports two model generations with different resolution and feature sets. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoImageToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['image-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;AAC9C,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,kBAAkB;AAAA,IAChB,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,gCAAgC;AAAA,QAC9B,oBAAoB;AAAA,UAClB,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,UACvB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,MACA,qCAAqC;AAAA,QACnC,oBAAoB;AAAA,UAClB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF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B;AAC1F,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AH1CO,IAAM,eAAN,cAA2B,wBAAW;AAAA;AAAA,EAE3B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAAA,EAChD;AACF;;;ADzBA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]} | ||
| {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-video.ts","../src/contract_gen.ts","../src/resources/image-to-video.ts"],"sourcesContent":["export { HailuoClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\nimport { ImageToVideo } from './resources/image-to-video';\n\n/**\n * Hailuo text-to-video and image-to-video generation API client.\n *\n * @example\n * ```typescript\n * const client = new HailuoClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'hailuo-02-text-to-video-standard',\n * prompt: 'A timelapse of cherry blossoms blooming in a Japanese garden',\n * });\n * ```\n */\nexport class HailuoClient extends BaseClient {\n /** Text-to-video generation from a text prompt. Pro delivers higher fidelity; Standard is faster. */\n public readonly textToVideo: TextToVideo;\n /** Image-to-video animation from a first-frame image guided by a text prompt. */\n public readonly imageToVideo: ImageToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoTextToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/text_to_video';\n\n/** Generate video from a text prompt. Pro delivers higher fidelity; Standard is faster. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoTextToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoTextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export const contract = {\n \"image-to-video\": {\n \"models\": [\n \"hailuo-02-image-to-video-pro\",\n \"hailuo-02-image-to-video-standard\",\n \"hailuo-2.3-image-to-video-pro\",\n \"hailuo-2.3-image-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-image-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n }\n },\n \"hailuo-02-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"512p\",\n \"768p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-pro\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"hailuo-02-image-to-video-pro\"\n },\n \"forbidden\": [\n \"enable_safety_checker\"\n ]\n }\n ]\n },\n \"text-to-video\": {\n \"models\": [\n \"hailuo-02-text-to-video-pro\",\n \"hailuo-02-text-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-text-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n }\n },\n \"hailuo-02-text-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoImageToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/image_to_video';\n\n/** Animate a still image into video, guided by a text prompt and first-frame image. Supports two model generations with different resolution and feature sets. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoImageToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['image-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC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,IAAMC,YAAW;AAGV,IAAM,eAAN,MAAmB;AAAA,EACxB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IACJ,QACA,SACuC;AACvC,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,oCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAkC,SAAuD;AACpG,UAAM,WAAO,4BAAc,MAAM;AACjC,qCAAe,SAAS,gBAAgB,GAAmB,IAA+B;AAC1F,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AH1CO,IAAM,eAAN,cAA2B,wBAAW;AAAA;AAAA,EAE3B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAAA,EAChD;AACF;;;ADzBA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]} |
+11
-1
@@ -80,3 +80,13 @@ // src/client.ts | ||
| } | ||
| } | ||
| }, | ||
| "rules": [ | ||
| { | ||
| "when": { | ||
| "model": "hailuo-02-image-to-video-pro" | ||
| }, | ||
| "forbidden": [ | ||
| "enable_safety_checker" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
@@ -83,0 +93,0 @@ "text-to-video": { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/client.ts","../src/resources/text-to-video.ts","../src/contract_gen.ts","../src/resources/image-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\nimport { ImageToVideo } from './resources/image-to-video';\n\n/**\n * Hailuo text-to-video and image-to-video generation API client.\n *\n * @example\n * ```typescript\n * const client = new HailuoClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'hailuo-02-text-to-video-standard',\n * prompt: 'A timelapse of cherry blossoms blooming in a Japanese garden',\n * });\n * ```\n */\nexport class HailuoClient extends BaseClient {\n /** Text-to-video generation from a text prompt. Pro delivers higher fidelity; Standard is faster. */\n public readonly textToVideo: TextToVideo;\n /** Image-to-video animation from a first-frame image guided by a text prompt. */\n public readonly imageToVideo: ImageToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoTextToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/text_to_video';\n\n/** Generate video from a text prompt. Pro delivers higher fidelity; Standard is faster. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoTextToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoTextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export const contract = {\n \"image-to-video\": {\n \"models\": [\n \"hailuo-02-image-to-video-pro\",\n \"hailuo-02-image-to-video-standard\",\n \"hailuo-2.3-image-to-video-pro\",\n \"hailuo-2.3-image-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-image-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n }\n },\n \"hailuo-02-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"512p\",\n \"768p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-pro\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n }\n }\n },\n \"text-to-video\": {\n \"models\": [\n \"hailuo-02-text-to-video-pro\",\n \"hailuo-02-text-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-text-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n }\n },\n \"hailuo-02-text-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoImageToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/image_to_video';\n\n/** Animate a still image into video, guided by a text prompt and first-frame image. Supports two model generations with different resolution and feature sets. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoImageToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['image-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export { HailuoClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,kBAAkB;AAAA,IAChB,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,gCAAgC;AAAA,QAC9B,oBAAoB;AAAA,UAClB,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,UACvB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,MACA,qCAAqC;AAAA,QACnC,oBAAoB;AAAA,UAClB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,UACvB,YAAY;AAAA,QACd;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,iCAAiC;AAAA,QAC/B,oBAAoB;AAAA,UAClB,QAAQ;AAAA,YAC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AK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AH1CO,IAAM,eAAN,cAA2B,WAAW;AAAA;AAAA,EAE3B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAAA,EAChD;AACF;;;AIzBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]} | ||
| {"version":3,"sources":["../src/client.ts","../src/resources/text-to-video.ts","../src/contract_gen.ts","../src/resources/image-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\nimport { ImageToVideo } from './resources/image-to-video';\n\n/**\n * Hailuo text-to-video and image-to-video generation API client.\n *\n * @example\n * ```typescript\n * const client = new HailuoClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'hailuo-02-text-to-video-standard',\n * prompt: 'A timelapse of cherry blossoms blooming in a Japanese garden',\n * });\n * ```\n */\nexport class HailuoClient extends BaseClient {\n /** Text-to-video generation from a text prompt. Pro delivers higher fidelity; Standard is faster. */\n public readonly textToVideo: TextToVideo;\n /** Image-to-video animation from a first-frame image guided by a text prompt. */\n public readonly imageToVideo: ImageToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoTextToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/text_to_video';\n\n/** Generate video from a text prompt. Pro delivers higher fidelity; Standard is faster. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoTextToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoTextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export const contract = {\n \"image-to-video\": {\n \"models\": [\n \"hailuo-02-image-to-video-pro\",\n \"hailuo-02-image-to-video-standard\",\n \"hailuo-2.3-image-to-video-pro\",\n \"hailuo-2.3-image-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-image-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n }\n },\n \"hailuo-02-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"512p\",\n \"768p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-pro\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n },\n \"hailuo-2.3-image-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"768p\",\n \"1080p\"\n ]\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"hailuo-02-image-to-video-pro\"\n },\n \"forbidden\": [\n \"enable_safety_checker\"\n ]\n }\n ]\n },\n \"text-to-video\": {\n \"models\": [\n \"hailuo-02-text-to-video-pro\",\n \"hailuo-02-text-to-video-standard\"\n ],\n \"fields_by_model\": {\n \"hailuo-02-text-to-video-pro\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n }\n },\n \"hailuo-02-text-to-video-standard\": {\n \"duration_seconds\": {\n \"enum\": [\n 6,\n 10\n ],\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedHailuoVideoResponse,\n HailuoImageToVideoParams,\n HailuoVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/hailuo/image_to_video';\n\n/** Animate a still image into video, guided by a text prompt and first-frame image. Supports two model generations with different resolution and feature sets. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(\n params: HailuoImageToVideoParams,\n options?: RequestOptions & PollingOptions\n ): Promise<CompletedHailuoVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<HailuoVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedHailuoVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: HailuoImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['image-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current task status.\n */\n async get(id: string, options?: RequestOptions): Promise<HailuoVideoResponse> {\n return this.http.request<HailuoVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export { HailuoClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,kBAAkB;AAAA,IAChB,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAC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A;AAAA,EAQ7B,MAAM,IACJ,QACA,SACuC;AACvC,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAMC,mBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAkC,SAAuD;AACpG,UAAM,OAAOC,eAAc,MAAM;AACjC,IAAAC,gBAAe,SAAS,gBAAgB,GAAmB,IAA+B;AAC1F,WAAO,KAAK,KAAK,QAA4B,QAAQH,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AH1CO,IAAM,eAAN,cAA2B,WAAW;AAAA;AAAA,EAE3B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAAA,EAChD;AACF;;;AIzBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]} |
+2
-2
@@ -6,3 +6,3 @@ { | ||
| }, | ||
| "version": "0.2.8", | ||
| "version": "0.2.9", | ||
| "description": "RunAPI Hailuo SDK for text-to-video and image-to-video workflows in JavaScript, Python, Ruby, Go, Java, and PHP", | ||
@@ -35,3 +35,3 @@ "main": "./dist/index.js", | ||
| "dependencies": { | ||
| "@runapi.ai/core": "^0.3.0" | ||
| "@runapi.ai/core": "^0.3.5" | ||
| }, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
+4
-4
@@ -5,3 +5,3 @@ # Hailuo API JavaScript SDK for RunAPI | ||
| This README is the JavaScript package guide inside the public `hailuo-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/hailuo; for API reference, use https://runapi.ai/docs#hailuo; for SDK docs, use https://runapi.ai/docs#sdk-hailuo. | ||
| This README is the JavaScript package guide inside the public `hailuo-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/hailuo; for API reference, use https://runapi.ai/docs/api/hailuo/text-to-video; for SDK docs, use https://runapi.ai/docs/resources/sdks. | ||
@@ -21,3 +21,3 @@ ## Install | ||
| const task = await client.textToVideo.create({ | ||
| // Pass the Hailuo JSON request body from https://runapi.ai/docs#hailuo. | ||
| // Pass the Hailuo JSON request body from https://runapi.ai/docs/api/hailuo/text-to-video. | ||
| }); | ||
@@ -38,4 +38,4 @@ const status = await client.textToVideo.get(task.id); | ||
| - Model page: https://runapi.ai/models/hailuo | ||
| - SDK docs: https://runapi.ai/docs#sdk-hailuo | ||
| - Product docs: https://runapi.ai/docs#hailuo | ||
| - SDK docs: https://runapi.ai/docs/resources/sdks | ||
| - Product docs: https://runapi.ai/docs/api/hailuo/text-to-video | ||
| - Pricing and rate limits: https://runapi.ai/models/hailuo/02-text-to-video-pro | ||
@@ -42,0 +42,0 @@ - Provider comparison: https://runapi.ai/providers/minimax |
@@ -62,4 +62,4 @@ <p align="center"> | ||
| - Model page: https://runapi.ai/models/hailuo | ||
| - Product docs: https://runapi.ai/docs#hailuo | ||
| - SDK docs: https://runapi.ai/docs#sdk-hailuo | ||
| - Product docs: https://runapi.ai/docs/api/hailuo/text-to-video | ||
| - SDK docs: https://runapi.ai/docs/resources/sdks | ||
| - SDK repository: https://github.com/runapi-ai/hailuo-sdk | ||
@@ -66,0 +66,0 @@ - Pricing and rate limits: https://runapi.ai/models/hailuo/02-text-to-video-pro |
+67
-33
| --- | ||
| name: hailuo | ||
| description: Generate and edit video with Hailuo through RunAPI. Use when the user asks an agent to create, edit, or transform video with Hailuo. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend. | ||
| description: "Generate and edit video with Hailuo through RunAPI. Use when the user asks an agent to create, edit, or transform video with Hailuo. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend." | ||
| documentation: https://runapi.ai/models/hailuo.md | ||
@@ -26,62 +26,96 @@ provider_page: https://runapi.ai/providers/minimax.md | ||
| Generate and edit video with Hailuo through RunAPI. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration. | ||
| ## Choose route | ||
| ## Critical: Integration Runtime | ||
| - For a one-off artifact or result, use the registered `hailuo` service in the `runapi` CLI. If the installed command catalog does not list it, stop and report the missing service instead of inventing a command. | ||
| - For an app, backend, worker, library, webhook pipeline, or production codebase, go directly to **Integrate with SDK**. Never shell out to the CLI as the production runtime. | ||
| - Integration work (app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production codebase) uses the **SDK integration path** for the target language. | ||
| - One-off generation, editing, transformation, manual smoke tests, debugging, or user-requested CLI runs use the **CLI path** with the `runapi` binary. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill. | ||
| - Never shell out to the `runapi` CLI as the production runtime integration layer. | ||
| ## Discover contract | ||
| ## SDK integration path | ||
| Authenticate, then inspect the installed command catalog and the selected operation's current contract: | ||
| When integrating Hailuo into an app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production workflow, start by checking the current SDK package and official usage. Confirm install commands, client methods (`create`, `get`, `run`), request fields, response shape, and error classes before using CLI help or raw HTTP examples. Use a RunAPI SDK package: | ||
| ```shell | ||
| runapi auth status > auth.json | ||
| jq -e '.authenticated == true' auth.json | ||
| runapi hailuo --help | ||
| runapi hailuo <operation> --help | ||
| curl --fail --location https://runapi.ai/docs/api/hailuo/<operation>.md --output contract.md | ||
| ``` | ||
| - JavaScript / TypeScript: `@runapi.ai/hailuo` | ||
| - Ruby: `runapi-hailuo` | ||
| - Go: `github.com/runapi-ai/hailuo-sdk/go` | ||
| If authentication is false, stop before submitting. Ask the user to provide a valid `RUNAPI_API_KEY`, or import a user-provided key from stdin with `runapi auth import-token --token -`; use interactive browser login only when the user explicitly requests it. Choose `<operation>` only from service help. Treat command help as authoritative for the installed operation, model, and top-level field roster. Treat its API Reference as authoritative for the complete request schema, nested fields, conditional rules, task behavior, and response variants. If the two surfaces disagree, stop and report the contract mismatch instead of guessing. | ||
| ## CLI path | ||
| ## Build request | ||
| The `runapi` binary is the one-off and manual testing runtime dependency. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth. | ||
| Create `request.json` as valid JSON using only fields accepted by the discovered operation contract. For the chosen model and values, evaluate every applicable conditional rule as a set: satisfy every required field, omit every forbidden field, and stop on unresolved contradictions. | ||
| Inspect the available commands and request fields with CLI help: | ||
| Traverse nested objects and arrays before execution. Close every relationship stated by the discovered contract, including uniqueness constraints and cross-references between nested values. | ||
| For a discovered local media input, including file-typed fields and top-level media URL fields, put an agent-readable local file path directly in `request.json`. The CLI consumes file fields as declared and uploads local paths in top-level media URL fields. Use `runapi files create` only when the user needs a reusable URL, provides Base64, or the discovered contract explicitly requires a separate upload. | ||
| Validate the file before sending it: | ||
| ```shell | ||
| runapi hailuo --help | ||
| runapi hailuo text-to-video --help | ||
| jq empty request.json | ||
| ``` | ||
| Run a one-off task (synchronous — polls until the task completes): | ||
| ## Execute | ||
| Submit exactly once and persist the task response before waiting: | ||
| ```shell | ||
| runapi hailuo text-to-video --input-file request.json | ||
| runapi hailuo <operation> --async --input-file request.json > task.json | ||
| task_id="$(jq -er '.id' task.json)" | ||
| ``` | ||
| Submit asynchronously and poll separately: | ||
| For a one-off result, immediately wait for that same task and save the complete JSON response. This blocking wait is the default: | ||
| ```shell | ||
| runapi hailuo text-to-video --async --input-file request.json | ||
| runapi wait <task-id> --service hailuo --action text-to-video | ||
| runapi wait "$task_id" --service hailuo --action <operation> > result.json | ||
| ``` | ||
| Available commands: `text-to-video`, `image-to-video`. | ||
| Only when the user explicitly asks for background execution, polling, or webhook integration may you stop after validating `task.json`. Report the task id and do not claim that the deliverable is complete. | ||
| ## Generated file storage | ||
| ## Verify | ||
| RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets. | ||
| A success status is not the deliverable. Read and validate the complete response according to the discovered result contract. Preserve the complete non-media result in the exact requested format, including JSON, text, SRT, or VTT. | ||
| For every requested media deliverable listed anywhere in the response, download all of them rather than returning only the first URL. Before downloading, derive its expected MIME type or family from response metadata when present, then the selected output format, then an unambiguous result field such as `videos`, `images`, or `audios` in the API Reference. The Catalog-declared fallback families for this skill are `video/*`. Stop only when no single expected type or family can be established from those sources. | ||
| For every downloaded file, require both a non-empty file and the expected MIME type or family: | ||
| ```shell | ||
| curl --fail --location <deliverable-url> --output <downloaded-file> | ||
| for file in <downloaded-files>; do | ||
| expected_mime=<expected-MIME-or-family-pattern-for-this-file> | ||
| test -s "$file" | ||
| [[ "$(file --brief --mime-type "$file")" == $expected_mime ]] | ||
| done | ||
| ``` | ||
| Do not report completion when any requested deliverable is missing, empty, or has an unexpected MIME type. Record `Skill Conformance` separately from `Task Outcome` so a service failure does not hide whether this recipe was followed. | ||
| ## Recover or stop | ||
| - Correct a request shape at most once, and only when the discovered contract or returned validation error identifies the correction. | ||
| - Retry a transient transport failure at most once, and only when evidence confirms that no task was created, no billing occurred, and retrying is safe. | ||
| - If waiting times out or loses transport after `task.json` exists, preserve the error and rerun `runapi wait` for that same task at most once. Never submit a replacement task. | ||
| - On a terminal RunAPI or service failure, preserve the task/error evidence and stop. Keep the selected model and capability, and do not submit another paid request without user authorization. | ||
| - If the contract is missing a fact required to build or verify the request, stop and report the contract gap. Do not turn a product defect into a permanent skill workaround. | ||
| ## Integrate with SDK | ||
| Use this route only for application or production-code integration. Open the current RunAPI SDK reference below, select the package for the target language and `Hailuo`, and confirm its install command, client methods, request types, response types, and error classes before coding. Build the request from the same discovered product contract and apply the same deliverable verification and stop rules. Do not invoke `runapi` as a subprocess from production code. | ||
| ## References | ||
| - Model overview, pricing, and rate limits: https://runapi.ai/models/hailuo.md | ||
| - Provider comparison: https://runapi.ai/providers/minimax.md | ||
| - Provider overview: https://runapi.ai/providers/minimax.md | ||
| - Full model catalog: https://runapi.ai/models.md | ||
| - SDK integration: https://github.com/runapi-ai/hailuo-sdk | ||
| ## Variants | ||
| - [02 text to video pro](https://runapi.ai/models/hailuo/02-text-to-video-pro.md) | ||
| - [02 text to video standard](https://runapi.ai/models/hailuo/02-text-to-video-standard.md) | ||
| - [02 image to video pro](https://runapi.ai/models/hailuo/02-image-to-video-pro.md) | ||
| - [02 image to video standard](https://runapi.ai/models/hailuo/02-image-to-video-standard.md) | ||
| - [2.3 image to video pro](https://runapi.ai/models/hailuo/2.3-image-to-video-pro.md) | ||
| - [2.3 image to video standard](https://runapi.ai/models/hailuo/2.3-image-to-video-standard.md) | ||
| - `hailuo-02-image-to-video-pro`: https://runapi.ai/models/hailuo/02-image-to-video-pro.md | ||
| - `hailuo-02-image-to-video-standard`: https://runapi.ai/models/hailuo/02-image-to-video-standard.md | ||
| - `hailuo-02-text-to-video-pro`: https://runapi.ai/models/hailuo/02-text-to-video-pro.md | ||
| - `hailuo-02-text-to-video-standard`: https://runapi.ai/models/hailuo/02-text-to-video-standard.md | ||
| - `hailuo-2.3-image-to-video-pro`: https://runapi.ai/models/hailuo/2.3-image-to-video-pro.md | ||
| - `hailuo-2.3-image-to-video-standard`: https://runapi.ai/models/hailuo/2.3-image-to-video-standard.md |
80417
5.92%679
3.03%Updated