@runapi.ai/happyhorse 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # HappyHorse API JavaScript SDK for RunAPI
2
2
 
3
- The happyhorse ai api JavaScript SDK is the language-specific package for HappyHorse on RunAPI. Use this package for text, image, reference-to-video, and edit-video workflows that need JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
3
+ The happyhorse ai api JavaScript SDK is the language-specific package for HappyHorse on RunAPI. Use this package for text, image, and edit-video workflows that need JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
4
4
 
5
5
  ## Install
6
6
 
@@ -15,15 +15,18 @@ import { HappyHorseClient } from '@runapi.ai/happyhorse';
15
15
 
16
16
  const client = new HappyHorseClient();
17
17
  const video = await client.textToVideo.run({
18
- model: 'happyhorse-text-to-video',
19
- prompt: 'A tiny paper horse gallops through a miniature cardboard city at night.',
20
- resolution: '1080p',
18
+ model: 'happyhorse-character',
19
+ prompt: 'Character1 walks through a miniature cardboard city at night.',
20
+ reference_image_urls: ['https://cdn.runapi.ai/public/samples/reference-1.jpg'],
21
+ output_resolution: '1080p',
21
22
  aspect_ratio: '16:9',
22
- duration: 5,
23
+ duration_seconds: 5,
23
24
  });
24
25
  ```
25
26
 
26
- For image-to-video, call `client.imageToVideo.run` with `model: 'happyhorse-image-to-video'` and exactly one `image_urls` entry. For reference-to-video, call `client.referenceToVideo.run` with `model: 'happyhorse-reference-to-video'` and 1-9 `reference_image` entries. For edit-video, call `client.editVideo.run` with `model: 'happyhorse-video-edit'`, one `video_url`, and optional `reference_image` entries.
27
+ For image-to-video, call `client.imageToVideo.run` with `model: 'happyhorse-image-to-video'` and exactly one `image_urls` entry. For character-guided text-to-video, call `client.textToVideo.run` with `model: 'happyhorse-character'` and 1-9 `reference_image_urls` entries. For edit-video, call `client.editVideo.run` with `model: 'happyhorse-edit-video'`, one `video_url`, and optional `reference_image` entries.
28
+
29
+ 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.
27
30
 
28
31
  ## Links
29
32
 
@@ -31,8 +34,8 @@ For image-to-video, call `client.imageToVideo.run` with `model: 'happyhorse-imag
31
34
  - SDK docs: https://runapi.ai/docs#sdk-happyhorse
32
35
  - Product docs: https://runapi.ai/docs#happyhorse
33
36
  - Image-to-video pricing and rate limits: https://runapi.ai/models/happyhorse/image-to-video
34
- - Reference-to-video pricing and rate limits: https://runapi.ai/models/happyhorse/reference-to-video
35
- - Edit-video pricing and rate limits: https://runapi.ai/models/happyhorse/video-edit
37
+ - Character pricing and rate limits: https://runapi.ai/models/happyhorse/character
38
+ - Edit-video pricing and rate limits: https://runapi.ai/models/happyhorse/edit-video
36
39
  - Pricing and rate limits: https://runapi.ai/models/happyhorse/text-to-video
37
40
  - Provider comparison: https://runapi.ai/providers/alibaba
38
41
  - Full catalog: https://runapi.ai/models
package/dist/index.d.mts CHANGED
@@ -1,55 +1,86 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type HappyHorseTextToVideoModel = 'happyhorse-text-to-video';
4
+ /**
5
+ * Text-to-video model variants. happyhorse-character requires 1-9 reference_image_urls
6
+ * for character-consistent generation; happyhorse-text-to-video is the standard model.
7
+ */
8
+ type HappyHorseTextToVideoModel = 'happyhorse-text-to-video' | 'happyhorse-character';
5
9
  type HappyHorseImageToVideoModel = 'happyhorse-image-to-video';
6
- type HappyHorseReferenceToVideoModel = 'happyhorse-reference-to-video';
7
- type HappyHorseEditVideoModel = 'happyhorse-video-edit';
8
- type HappyHorseResolution = '720p' | '1080p';
10
+ type HappyHorseEditVideoModel = 'happyhorse-edit-video';
11
+ /** Output resolution. Defaults to 1080p. */
12
+ type HappyHorseOutputResolution = '720p' | '1080p';
13
+ /** Aspect ratio. Defaults to 16:9. */
9
14
  type HappyHorseAspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';
10
- type HappyHorseAudioSetting = 'auto' | 'origin';
15
+ /** Audio handling for video editing. "auto" lets the model decide; "original" preserves the source video's audio. */
16
+ type HappyHorseAudioSetting = 'auto' | 'original';
17
+ /**
18
+ * Parameters for text-to-video generation. When using happyhorse-character,
19
+ * reference_image_urls (1-9 images) is required for character consistency.
20
+ */
11
21
  interface TextToVideoParams {
12
22
  model: HappyHorseTextToVideoModel;
23
+ /** Video description prompt. Up to 5000 non-Chinese characters or 2500 Chinese characters. */
13
24
  prompt: string;
14
- resolution?: HappyHorseResolution;
25
+ /** Character reference images for happyhorse-character (1-9 URLs). Not supported on happyhorse-text-to-video. */
26
+ reference_image_urls?: string[];
27
+ /** Output resolution. Defaults to 1080p. */
28
+ output_resolution?: HappyHorseOutputResolution;
29
+ /** Aspect ratio. Defaults to 16:9. */
15
30
  aspect_ratio?: HappyHorseAspectRatio;
16
- duration?: number;
31
+ /** Duration in seconds (3-15). Defaults to 5. */
32
+ duration_seconds?: number;
33
+ /** Reproducibility seed (0-2147483647). */
17
34
  seed?: number;
35
+ /** URL for completion callback notifications. */
18
36
  callback_url?: string;
19
37
  }
38
+ /**
39
+ * Parameters for image-to-video animation. The first-frame image is animated
40
+ * into video, optionally guided by a text prompt.
41
+ */
20
42
  interface ImageToVideoParams {
21
43
  model: HappyHorseImageToVideoModel;
22
- image_urls: string[];
44
+ /** Source image URL used as the video's opening frame. */
45
+ first_frame_image_url: string;
46
+ /** Optional motion description prompt. */
23
47
  prompt?: string;
24
- resolution?: HappyHorseResolution;
25
- duration?: number;
26
- seed?: number;
27
- callback_url?: string;
28
- }
29
- interface ReferenceToVideoParams {
30
- model: HappyHorseReferenceToVideoModel;
31
- prompt: string;
32
- reference_image: string[];
33
- resolution?: HappyHorseResolution;
34
- aspect_ratio?: HappyHorseAspectRatio;
35
- duration?: number;
48
+ /** Output resolution. Defaults to 1080p. */
49
+ output_resolution?: HappyHorseOutputResolution;
50
+ /** Duration in seconds (3-15). Defaults to 5. */
51
+ duration_seconds?: number;
52
+ /** Reproducibility seed (0-2147483647). */
36
53
  seed?: number;
54
+ /** URL for completion callback notifications. */
37
55
  callback_url?: string;
38
56
  }
57
+ /**
58
+ * Parameters for video editing. Transforms the source video according to the prompt.
59
+ * Source video must be 3-60 seconds, MP4 or MOV format. Use audio_setting to control
60
+ * whether the original audio is preserved.
61
+ */
39
62
  interface EditVideoParams {
40
63
  model: HappyHorseEditVideoModel;
64
+ /** Editing instruction prompt describing the desired transformation. */
41
65
  prompt: string;
42
- video_url: string;
43
- reference_image?: string[];
44
- resolution?: HappyHorseResolution;
66
+ /** Source video URL to transform (3-60s, MP4/MOV). */
67
+ source_video_url: string;
68
+ /** Optional reference images to guide the edit (up to 5 URLs). */
69
+ reference_image_urls?: string[];
70
+ /** Output resolution. Defaults to 1080p. */
71
+ output_resolution?: HappyHorseOutputResolution;
72
+ /** Audio handling: "auto" lets the model decide, "original" preserves the source audio. */
45
73
  audio_setting?: HappyHorseAudioSetting;
74
+ /** Reproducibility seed (0-2147483647). */
46
75
  seed?: number;
76
+ /** URL for completion callback notifications. */
47
77
  callback_url?: string;
48
78
  }
49
79
  interface TaskCreateResponse {
50
80
  id: string;
51
81
  status?: AsyncTaskStatus;
52
82
  }
83
+ /** A generated video file with a download URL. */
53
84
  interface Video {
54
85
  url: string;
55
86
  }
@@ -69,55 +100,114 @@ type CompletedImageToVideoResponse = ImageToVideoResponse & {
69
100
  status: 'completed';
70
101
  videos: Video[];
71
102
  };
72
- type ReferenceToVideoResponse = TextToVideoResponse;
73
- type CompletedReferenceToVideoResponse = ReferenceToVideoResponse & {
74
- status: 'completed';
75
- videos: Video[];
76
- };
77
103
  type EditVideoResponse = TextToVideoResponse;
78
104
  type CompletedEditVideoResponse = EditVideoResponse & {
79
105
  status: 'completed';
80
106
  videos: Video[];
81
107
  };
82
108
 
109
+ /** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */
83
110
  declare class EditVideo {
84
111
  private readonly http;
85
112
  constructor(http: HttpClient);
113
+ /**
114
+ * Create an edit-video task and wait until complete.
115
+ * @param params Edit-video parameters.
116
+ * @param options Per-request and polling overrides.
117
+ * @returns The completed task with videos.
118
+ */
86
119
  run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse>;
120
+ /**
121
+ * Create an edit-video task; returns immediately with a task id.
122
+ * @param params Edit-video parameters.
123
+ * @param options Per-request overrides.
124
+ * @returns The task creation result with id.
125
+ */
87
126
  create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
127
+ /**
128
+ * Fetch the current status of an edit-video task.
129
+ * @param id The task id.
130
+ * @param options Per-request overrides.
131
+ * @returns The current edit-video task status.
132
+ */
88
133
  get(id: string, options?: RequestOptions): Promise<EditVideoResponse>;
89
134
  }
90
135
 
136
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
91
137
  declare class ImageToVideo {
92
138
  private readonly http;
93
139
  constructor(http: HttpClient);
140
+ /**
141
+ * Create an image-to-video task and wait until complete.
142
+ * @param params Image-to-video parameters.
143
+ * @param options Per-request and polling overrides.
144
+ * @returns The completed task with videos.
145
+ */
94
146
  run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse>;
147
+ /**
148
+ * Create an image-to-video task; returns immediately with a task id.
149
+ * @param params Image-to-video parameters.
150
+ * @param options Per-request overrides.
151
+ * @returns The task creation result with id.
152
+ */
95
153
  create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
154
+ /**
155
+ * Fetch the current status of an image-to-video task.
156
+ * @param id The task id.
157
+ * @param options Per-request overrides.
158
+ * @returns The current image-to-video task status.
159
+ */
96
160
  get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse>;
97
161
  }
98
162
 
99
- declare class ReferenceToVideo {
100
- private readonly http;
101
- constructor(http: HttpClient);
102
- run(params: ReferenceToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedReferenceToVideoResponse>;
103
- create(params: ReferenceToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
104
- get(id: string, options?: RequestOptions): Promise<ReferenceToVideoResponse>;
105
- }
106
-
163
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
107
164
  declare class TextToVideo {
108
165
  private readonly http;
109
166
  constructor(http: HttpClient);
167
+ /**
168
+ * Create a text-to-video task and wait until complete.
169
+ * @param params Text-to-video parameters.
170
+ * @param options Per-request and polling overrides.
171
+ * @returns The completed task with videos.
172
+ */
110
173
  run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse>;
174
+ /**
175
+ * Create a text-to-video task; returns immediately with a task id.
176
+ * @param params Text-to-video parameters.
177
+ * @param options Per-request overrides.
178
+ * @returns The task creation result with id.
179
+ */
111
180
  create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
181
+ /**
182
+ * Fetch the current status of a text-to-video task.
183
+ * @param id The task id.
184
+ * @param options Per-request overrides.
185
+ * @returns The current text-to-video task status.
186
+ */
112
187
  get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
113
188
  }
114
189
 
115
- declare class HappyHorseClient {
190
+ /**
191
+ * HappyHorse video generation and editing API client.
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * const client = new HappyHorseClient({ apiKey: 'your-api-key' });
196
+ *
197
+ * const result = await client.textToVideo.run({
198
+ * model: 'happyhorse-text-to-video',
199
+ * prompt: 'A horse galloping across a sunset beach',
200
+ * });
201
+ * ```
202
+ */
203
+ declare class HappyHorseClient extends BaseClient {
204
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
116
205
  readonly textToVideo: TextToVideo;
206
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
117
207
  readonly imageToVideo: ImageToVideo;
118
- readonly referenceToVideo: ReferenceToVideo;
208
+ /** Transform an existing video with a text prompt and optional reference images. */
119
209
  readonly editVideo: EditVideo;
120
210
  constructor(options?: ClientOptions);
121
211
  }
122
212
 
123
- export { type CompletedEditVideoResponse, type CompletedImageToVideoResponse, type CompletedReferenceToVideoResponse, type CompletedTextToVideoResponse, type EditVideoParams, type EditVideoResponse, type HappyHorseAspectRatio, type HappyHorseAudioSetting, HappyHorseClient, type HappyHorseEditVideoModel, type HappyHorseImageToVideoModel, type HappyHorseReferenceToVideoModel, type HappyHorseResolution, type HappyHorseTextToVideoModel, type ImageToVideoParams, type ImageToVideoResponse, type ReferenceToVideoParams, type ReferenceToVideoResponse, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type Video };
213
+ export { type CompletedEditVideoResponse, type CompletedImageToVideoResponse, type CompletedTextToVideoResponse, type EditVideoParams, type EditVideoResponse, type HappyHorseAspectRatio, type HappyHorseAudioSetting, HappyHorseClient, type HappyHorseEditVideoModel, type HappyHorseImageToVideoModel, type HappyHorseOutputResolution, type HappyHorseTextToVideoModel, type ImageToVideoParams, type ImageToVideoResponse, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type Video };
package/dist/index.d.ts CHANGED
@@ -1,55 +1,86 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type HappyHorseTextToVideoModel = 'happyhorse-text-to-video';
4
+ /**
5
+ * Text-to-video model variants. happyhorse-character requires 1-9 reference_image_urls
6
+ * for character-consistent generation; happyhorse-text-to-video is the standard model.
7
+ */
8
+ type HappyHorseTextToVideoModel = 'happyhorse-text-to-video' | 'happyhorse-character';
5
9
  type HappyHorseImageToVideoModel = 'happyhorse-image-to-video';
6
- type HappyHorseReferenceToVideoModel = 'happyhorse-reference-to-video';
7
- type HappyHorseEditVideoModel = 'happyhorse-video-edit';
8
- type HappyHorseResolution = '720p' | '1080p';
10
+ type HappyHorseEditVideoModel = 'happyhorse-edit-video';
11
+ /** Output resolution. Defaults to 1080p. */
12
+ type HappyHorseOutputResolution = '720p' | '1080p';
13
+ /** Aspect ratio. Defaults to 16:9. */
9
14
  type HappyHorseAspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';
10
- type HappyHorseAudioSetting = 'auto' | 'origin';
15
+ /** Audio handling for video editing. "auto" lets the model decide; "original" preserves the source video's audio. */
16
+ type HappyHorseAudioSetting = 'auto' | 'original';
17
+ /**
18
+ * Parameters for text-to-video generation. When using happyhorse-character,
19
+ * reference_image_urls (1-9 images) is required for character consistency.
20
+ */
11
21
  interface TextToVideoParams {
12
22
  model: HappyHorseTextToVideoModel;
23
+ /** Video description prompt. Up to 5000 non-Chinese characters or 2500 Chinese characters. */
13
24
  prompt: string;
14
- resolution?: HappyHorseResolution;
25
+ /** Character reference images for happyhorse-character (1-9 URLs). Not supported on happyhorse-text-to-video. */
26
+ reference_image_urls?: string[];
27
+ /** Output resolution. Defaults to 1080p. */
28
+ output_resolution?: HappyHorseOutputResolution;
29
+ /** Aspect ratio. Defaults to 16:9. */
15
30
  aspect_ratio?: HappyHorseAspectRatio;
16
- duration?: number;
31
+ /** Duration in seconds (3-15). Defaults to 5. */
32
+ duration_seconds?: number;
33
+ /** Reproducibility seed (0-2147483647). */
17
34
  seed?: number;
35
+ /** URL for completion callback notifications. */
18
36
  callback_url?: string;
19
37
  }
38
+ /**
39
+ * Parameters for image-to-video animation. The first-frame image is animated
40
+ * into video, optionally guided by a text prompt.
41
+ */
20
42
  interface ImageToVideoParams {
21
43
  model: HappyHorseImageToVideoModel;
22
- image_urls: string[];
44
+ /** Source image URL used as the video's opening frame. */
45
+ first_frame_image_url: string;
46
+ /** Optional motion description prompt. */
23
47
  prompt?: string;
24
- resolution?: HappyHorseResolution;
25
- duration?: number;
26
- seed?: number;
27
- callback_url?: string;
28
- }
29
- interface ReferenceToVideoParams {
30
- model: HappyHorseReferenceToVideoModel;
31
- prompt: string;
32
- reference_image: string[];
33
- resolution?: HappyHorseResolution;
34
- aspect_ratio?: HappyHorseAspectRatio;
35
- duration?: number;
48
+ /** Output resolution. Defaults to 1080p. */
49
+ output_resolution?: HappyHorseOutputResolution;
50
+ /** Duration in seconds (3-15). Defaults to 5. */
51
+ duration_seconds?: number;
52
+ /** Reproducibility seed (0-2147483647). */
36
53
  seed?: number;
54
+ /** URL for completion callback notifications. */
37
55
  callback_url?: string;
38
56
  }
57
+ /**
58
+ * Parameters for video editing. Transforms the source video according to the prompt.
59
+ * Source video must be 3-60 seconds, MP4 or MOV format. Use audio_setting to control
60
+ * whether the original audio is preserved.
61
+ */
39
62
  interface EditVideoParams {
40
63
  model: HappyHorseEditVideoModel;
64
+ /** Editing instruction prompt describing the desired transformation. */
41
65
  prompt: string;
42
- video_url: string;
43
- reference_image?: string[];
44
- resolution?: HappyHorseResolution;
66
+ /** Source video URL to transform (3-60s, MP4/MOV). */
67
+ source_video_url: string;
68
+ /** Optional reference images to guide the edit (up to 5 URLs). */
69
+ reference_image_urls?: string[];
70
+ /** Output resolution. Defaults to 1080p. */
71
+ output_resolution?: HappyHorseOutputResolution;
72
+ /** Audio handling: "auto" lets the model decide, "original" preserves the source audio. */
45
73
  audio_setting?: HappyHorseAudioSetting;
74
+ /** Reproducibility seed (0-2147483647). */
46
75
  seed?: number;
76
+ /** URL for completion callback notifications. */
47
77
  callback_url?: string;
48
78
  }
49
79
  interface TaskCreateResponse {
50
80
  id: string;
51
81
  status?: AsyncTaskStatus;
52
82
  }
83
+ /** A generated video file with a download URL. */
53
84
  interface Video {
54
85
  url: string;
55
86
  }
@@ -69,55 +100,114 @@ type CompletedImageToVideoResponse = ImageToVideoResponse & {
69
100
  status: 'completed';
70
101
  videos: Video[];
71
102
  };
72
- type ReferenceToVideoResponse = TextToVideoResponse;
73
- type CompletedReferenceToVideoResponse = ReferenceToVideoResponse & {
74
- status: 'completed';
75
- videos: Video[];
76
- };
77
103
  type EditVideoResponse = TextToVideoResponse;
78
104
  type CompletedEditVideoResponse = EditVideoResponse & {
79
105
  status: 'completed';
80
106
  videos: Video[];
81
107
  };
82
108
 
109
+ /** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */
83
110
  declare class EditVideo {
84
111
  private readonly http;
85
112
  constructor(http: HttpClient);
113
+ /**
114
+ * Create an edit-video task and wait until complete.
115
+ * @param params Edit-video parameters.
116
+ * @param options Per-request and polling overrides.
117
+ * @returns The completed task with videos.
118
+ */
86
119
  run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse>;
120
+ /**
121
+ * Create an edit-video task; returns immediately with a task id.
122
+ * @param params Edit-video parameters.
123
+ * @param options Per-request overrides.
124
+ * @returns The task creation result with id.
125
+ */
87
126
  create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
127
+ /**
128
+ * Fetch the current status of an edit-video task.
129
+ * @param id The task id.
130
+ * @param options Per-request overrides.
131
+ * @returns The current edit-video task status.
132
+ */
88
133
  get(id: string, options?: RequestOptions): Promise<EditVideoResponse>;
89
134
  }
90
135
 
136
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
91
137
  declare class ImageToVideo {
92
138
  private readonly http;
93
139
  constructor(http: HttpClient);
140
+ /**
141
+ * Create an image-to-video task and wait until complete.
142
+ * @param params Image-to-video parameters.
143
+ * @param options Per-request and polling overrides.
144
+ * @returns The completed task with videos.
145
+ */
94
146
  run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse>;
147
+ /**
148
+ * Create an image-to-video task; returns immediately with a task id.
149
+ * @param params Image-to-video parameters.
150
+ * @param options Per-request overrides.
151
+ * @returns The task creation result with id.
152
+ */
95
153
  create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
154
+ /**
155
+ * Fetch the current status of an image-to-video task.
156
+ * @param id The task id.
157
+ * @param options Per-request overrides.
158
+ * @returns The current image-to-video task status.
159
+ */
96
160
  get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse>;
97
161
  }
98
162
 
99
- declare class ReferenceToVideo {
100
- private readonly http;
101
- constructor(http: HttpClient);
102
- run(params: ReferenceToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedReferenceToVideoResponse>;
103
- create(params: ReferenceToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
104
- get(id: string, options?: RequestOptions): Promise<ReferenceToVideoResponse>;
105
- }
106
-
163
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
107
164
  declare class TextToVideo {
108
165
  private readonly http;
109
166
  constructor(http: HttpClient);
167
+ /**
168
+ * Create a text-to-video task and wait until complete.
169
+ * @param params Text-to-video parameters.
170
+ * @param options Per-request and polling overrides.
171
+ * @returns The completed task with videos.
172
+ */
110
173
  run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse>;
174
+ /**
175
+ * Create a text-to-video task; returns immediately with a task id.
176
+ * @param params Text-to-video parameters.
177
+ * @param options Per-request overrides.
178
+ * @returns The task creation result with id.
179
+ */
111
180
  create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
181
+ /**
182
+ * Fetch the current status of a text-to-video task.
183
+ * @param id The task id.
184
+ * @param options Per-request overrides.
185
+ * @returns The current text-to-video task status.
186
+ */
112
187
  get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
113
188
  }
114
189
 
115
- declare class HappyHorseClient {
190
+ /**
191
+ * HappyHorse video generation and editing API client.
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * const client = new HappyHorseClient({ apiKey: 'your-api-key' });
196
+ *
197
+ * const result = await client.textToVideo.run({
198
+ * model: 'happyhorse-text-to-video',
199
+ * prompt: 'A horse galloping across a sunset beach',
200
+ * });
201
+ * ```
202
+ */
203
+ declare class HappyHorseClient extends BaseClient {
204
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
116
205
  readonly textToVideo: TextToVideo;
206
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
117
207
  readonly imageToVideo: ImageToVideo;
118
- readonly referenceToVideo: ReferenceToVideo;
208
+ /** Transform an existing video with a text prompt and optional reference images. */
119
209
  readonly editVideo: EditVideo;
120
210
  constructor(options?: ClientOptions);
121
211
  }
122
212
 
123
- export { type CompletedEditVideoResponse, type CompletedImageToVideoResponse, type CompletedReferenceToVideoResponse, type CompletedTextToVideoResponse, type EditVideoParams, type EditVideoResponse, type HappyHorseAspectRatio, type HappyHorseAudioSetting, HappyHorseClient, type HappyHorseEditVideoModel, type HappyHorseImageToVideoModel, type HappyHorseReferenceToVideoModel, type HappyHorseResolution, type HappyHorseTextToVideoModel, type ImageToVideoParams, type ImageToVideoResponse, type ReferenceToVideoParams, type ReferenceToVideoResponse, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type Video };
213
+ export { type CompletedEditVideoResponse, type CompletedImageToVideoResponse, type CompletedTextToVideoResponse, type EditVideoParams, type EditVideoResponse, type HappyHorseAspectRatio, type HappyHorseAudioSetting, HappyHorseClient, type HappyHorseEditVideoModel, type HappyHorseImageToVideoModel, type HappyHorseOutputResolution, type HappyHorseTextToVideoModel, type ImageToVideoParams, type ImageToVideoResponse, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type Video };
package/dist/index.js CHANGED
@@ -20,23 +20,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- AuthenticationError: () => import_core6.AuthenticationError,
23
+ AuthenticationError: () => import_core5.AuthenticationError,
24
24
  HappyHorseClient: () => HappyHorseClient,
25
- InsufficientCreditsError: () => import_core6.InsufficientCreditsError,
26
- NetworkError: () => import_core6.NetworkError,
27
- NotFoundError: () => import_core6.NotFoundError,
28
- RateLimitError: () => import_core6.RateLimitError,
29
- RunApiError: () => import_core6.RunApiError,
30
- ServiceUnavailableError: () => import_core6.ServiceUnavailableError,
31
- TaskFailedError: () => import_core6.TaskFailedError,
32
- TaskTimeoutError: () => import_core6.TaskTimeoutError,
33
- TimeoutError: () => import_core6.TimeoutError,
34
- ValidationError: () => import_core6.ValidationError
25
+ InsufficientCreditsError: () => import_core5.InsufficientCreditsError,
26
+ NetworkError: () => import_core5.NetworkError,
27
+ NotFoundError: () => import_core5.NotFoundError,
28
+ RateLimitError: () => import_core5.RateLimitError,
29
+ RunApiError: () => import_core5.RunApiError,
30
+ ServiceUnavailableError: () => import_core5.ServiceUnavailableError,
31
+ TaskFailedError: () => import_core5.TaskFailedError,
32
+ TaskTimeoutError: () => import_core5.TaskTimeoutError,
33
+ TimeoutError: () => import_core5.TimeoutError,
34
+ ValidationError: () => import_core5.ValidationError
35
35
  });
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/client.ts
39
- var import_core5 = require("@runapi.ai/core");
39
+ var import_core4 = require("@runapi.ai/core");
40
40
 
41
41
  // src/resources/edit-video.ts
42
42
  var import_core = require("@runapi.ai/core");
@@ -47,6 +47,12 @@ var EditVideo = class {
47
47
  this.http = http;
48
48
  }
49
49
  http;
50
+ /**
51
+ * Create an edit-video task and wait until complete.
52
+ * @param params Edit-video parameters.
53
+ * @param options Per-request and polling overrides.
54
+ * @returns The completed task with videos.
55
+ */
50
56
  async run(params, options) {
51
57
  const { id } = await this.create(params, options);
52
58
  const response = await (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
@@ -55,12 +61,24 @@ var EditVideo = class {
55
61
  });
56
62
  return response;
57
63
  }
64
+ /**
65
+ * Create an edit-video task; returns immediately with a task id.
66
+ * @param params Edit-video parameters.
67
+ * @param options Per-request overrides.
68
+ * @returns The task creation result with id.
69
+ */
58
70
  async create(params, options) {
59
71
  return this.http.request("POST", ENDPOINT, {
60
72
  body: (0, import_core.compactParams)(params),
61
73
  ...options
62
74
  });
63
75
  }
76
+ /**
77
+ * Fetch the current status of an edit-video task.
78
+ * @param id The task id.
79
+ * @param options Per-request overrides.
80
+ * @returns The current edit-video task status.
81
+ */
64
82
  async get(id, options) {
65
83
  return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
66
84
  }
@@ -75,6 +93,12 @@ var ImageToVideo = class {
75
93
  this.http = http;
76
94
  }
77
95
  http;
96
+ /**
97
+ * Create an image-to-video task and wait until complete.
98
+ * @param params Image-to-video parameters.
99
+ * @param options Per-request and polling overrides.
100
+ * @returns The completed task with videos.
101
+ */
78
102
  async run(params, options) {
79
103
  const { id } = await this.create(params, options);
80
104
  const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
@@ -83,26 +107,44 @@ var ImageToVideo = class {
83
107
  });
84
108
  return response;
85
109
  }
110
+ /**
111
+ * Create an image-to-video task; returns immediately with a task id.
112
+ * @param params Image-to-video parameters.
113
+ * @param options Per-request overrides.
114
+ * @returns The task creation result with id.
115
+ */
86
116
  async create(params, options) {
87
117
  return this.http.request("POST", ENDPOINT2, {
88
118
  body: (0, import_core2.compactParams)(params),
89
119
  ...options
90
120
  });
91
121
  }
122
+ /**
123
+ * Fetch the current status of an image-to-video task.
124
+ * @param id The task id.
125
+ * @param options Per-request overrides.
126
+ * @returns The current image-to-video task status.
127
+ */
92
128
  async get(id, options) {
93
129
  return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
94
130
  }
95
131
  };
96
132
 
97
- // src/resources/reference-to-video.ts
133
+ // src/resources/text-to-video.ts
98
134
  var import_core3 = require("@runapi.ai/core");
99
135
  var import_internal3 = require("@runapi.ai/core/internal");
100
- var ENDPOINT3 = "/api/v1/happyhorse/reference_to_video";
101
- var ReferenceToVideo = class {
136
+ var ENDPOINT3 = "/api/v1/happyhorse/text_to_video";
137
+ var TextToVideo = class {
102
138
  constructor(http) {
103
139
  this.http = http;
104
140
  }
105
141
  http;
142
+ /**
143
+ * Create a text-to-video task and wait until complete.
144
+ * @param params Text-to-video parameters.
145
+ * @param options Per-request and polling overrides.
146
+ * @returns The completed task with videos.
147
+ */
106
148
  async run(params, options) {
107
149
  const { id } = await this.create(params, options);
108
150
  const response = await (0, import_internal3.pollUntilComplete)(() => this.get(id, options), {
@@ -111,62 +153,47 @@ var ReferenceToVideo = class {
111
153
  });
112
154
  return response;
113
155
  }
156
+ /**
157
+ * Create a text-to-video task; returns immediately with a task id.
158
+ * @param params Text-to-video parameters.
159
+ * @param options Per-request overrides.
160
+ * @returns The task creation result with id.
161
+ */
114
162
  async create(params, options) {
115
163
  return this.http.request("POST", ENDPOINT3, {
116
164
  body: (0, import_core3.compactParams)(params),
117
165
  ...options
118
166
  });
119
167
  }
168
+ /**
169
+ * Fetch the current status of a text-to-video task.
170
+ * @param id The task id.
171
+ * @param options Per-request overrides.
172
+ * @returns The current text-to-video task status.
173
+ */
120
174
  async get(id, options) {
121
175
  return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
122
176
  }
123
177
  };
124
178
 
125
- // src/resources/text-to-video.ts
126
- var import_core4 = require("@runapi.ai/core");
127
- var import_internal4 = require("@runapi.ai/core/internal");
128
- var ENDPOINT4 = "/api/v1/happyhorse/text_to_video";
129
- var TextToVideo = class {
130
- constructor(http) {
131
- this.http = http;
132
- }
133
- http;
134
- async run(params, options) {
135
- const { id } = await this.create(params, options);
136
- const response = await (0, import_internal4.pollUntilComplete)(() => this.get(id, options), {
137
- maxWaitMs: options?.maxWaitMs,
138
- pollIntervalMs: options?.pollIntervalMs
139
- });
140
- return response;
141
- }
142
- async create(params, options) {
143
- return this.http.request("POST", ENDPOINT4, {
144
- body: (0, import_core4.compactParams)(params),
145
- ...options
146
- });
147
- }
148
- async get(id, options) {
149
- return this.http.request("GET", `${ENDPOINT4}/${id}`, options ?? {});
150
- }
151
- };
152
-
153
179
  // src/client.ts
154
- var HappyHorseClient = class {
180
+ var HappyHorseClient = class extends import_core4.BaseClient {
181
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
155
182
  textToVideo;
183
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
156
184
  imageToVideo;
157
- referenceToVideo;
185
+ /** Transform an existing video with a text prompt and optional reference images. */
158
186
  editVideo;
159
187
  constructor(options = {}) {
160
- const http = (0, import_core5.createHttpClient)(options);
161
- this.textToVideo = new TextToVideo(http);
162
- this.imageToVideo = new ImageToVideo(http);
163
- this.referenceToVideo = new ReferenceToVideo(http);
164
- this.editVideo = new EditVideo(http);
188
+ super(options);
189
+ this.textToVideo = new TextToVideo(this.http);
190
+ this.imageToVideo = new ImageToVideo(this.http);
191
+ this.editVideo = new EditVideo(this.http);
165
192
  }
166
193
  };
167
194
 
168
195
  // src/index.ts
169
- var import_core6 = require("@runapi.ai/core");
196
+ var import_core5 = require("@runapi.ai/core");
170
197
  // Annotate the CommonJS export names for ESM import in node:
171
198
  0 && (module.exports = {
172
199
  AuthenticationError,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/edit-video.ts","../src/resources/image-to-video.ts","../src/resources/reference-to-video.ts","../src/resources/text-to-video.ts"],"sourcesContent":["export { HappyHorseClient } 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 { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { EditVideo } from './resources/edit-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { ReferenceToVideo } from './resources/reference-to-video';\nimport { TextToVideo } from './resources/text-to-video';\n\nexport class HappyHorseClient {\n public readonly textToVideo: TextToVideo;\n public readonly imageToVideo: ImageToVideo;\n public readonly referenceToVideo: ReferenceToVideo;\n public readonly editVideo: EditVideo;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToVideo = new TextToVideo(http);\n this.imageToVideo = new ImageToVideo(http);\n this.referenceToVideo = new ReferenceToVideo(http);\n this.editVideo = new EditVideo(http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditVideoResponse,\n EditVideoParams,\n EditVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/edit_video';\n\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditVideoResponse;\n }\n\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<EditVideoResponse> {\n return this.http.request<EditVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/image_to_video';\n\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\n }\n\n async create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedReferenceToVideoResponse,\n ReferenceToVideoParams,\n ReferenceToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/reference_to_video';\n\nexport class ReferenceToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: ReferenceToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedReferenceToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ReferenceToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedReferenceToVideoResponse;\n }\n\n async create(params: ReferenceToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<ReferenceToVideoResponse> {\n return this.http.request<ReferenceToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/text_to_video';\n\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('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,eAAqD;;;ACCrD,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAEV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AA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;AAAA,EACzF;AACF;;;AJ5BO,IAAM,mBAAN,MAAuB;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,WAAO,+BAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,eAAe,IAAI,aAAa,IAAI;AACzC,SAAK,mBAAmB,IAAI,iBAAiB,IAAI;AACjD,SAAK,YAAY,IAAI,UAAU,IAAI;AAAA,EACrC;AACF;;;ADhBA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core","import_internal","ENDPOINT","import_core","import_internal","ENDPOINT","import_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/edit-video.ts","../src/resources/image-to-video.ts","../src/resources/text-to-video.ts"],"sourcesContent":["export { HappyHorseClient } 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 { EditVideo } from './resources/edit-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * HappyHorse video generation and editing API client.\n *\n * @example\n * ```typescript\n * const client = new HappyHorseClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'happyhorse-text-to-video',\n * prompt: 'A horse galloping across a sunset beach',\n * });\n * ```\n */\nexport class HappyHorseClient extends BaseClient {\n /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\n public readonly textToVideo: TextToVideo;\n /** Animate a still first-frame image into video, guided by an optional text prompt. */\n public readonly imageToVideo: ImageToVideo;\n /** Transform an existing video with a text prompt and optional reference images. */\n public readonly editVideo: EditVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n this.editVideo = new EditVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditVideoResponse,\n EditVideoParams,\n EditVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/edit_video';\n\n/** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit-video task and wait until complete.\n * @param params Edit-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditVideoResponse;\n }\n\n /**\n * Create an edit-video task; returns immediately with a task id.\n * @param params Edit-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditVideoResponse> {\n return this.http.request<EditVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/image_to_video';\n\n/** Animate a still first-frame image into video, guided by an optional text prompt. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an image-to-video task 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(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\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: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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 image-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/text_to_video';\n\n/** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text-to-video task 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(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\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: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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 text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('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,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAGV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAA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kC;AAQlC,IAAMC,YAAW;AAGV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,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,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D,UAAM,4BAAc,MAAM;AAAA,MAC1B,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;;;AHnCO,IAAM,mBAAN,cAA+B,wBAAW;AAAA;AAAA,EAE/B;AAAA;AAAA,EAEA;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;AAC9C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AD7BA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core","import_internal","ENDPOINT","import_core"]}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/client.ts
2
- import { createHttpClient } from "@runapi.ai/core";
2
+ import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/edit-video.ts
5
5
  import { compactParams } from "@runapi.ai/core";
@@ -10,6 +10,12 @@ var EditVideo = class {
10
10
  this.http = http;
11
11
  }
12
12
  http;
13
+ /**
14
+ * Create an edit-video task and wait until complete.
15
+ * @param params Edit-video parameters.
16
+ * @param options Per-request and polling overrides.
17
+ * @returns The completed task with videos.
18
+ */
13
19
  async run(params, options) {
14
20
  const { id } = await this.create(params, options);
15
21
  const response = await pollUntilComplete(() => this.get(id, options), {
@@ -18,12 +24,24 @@ var EditVideo = class {
18
24
  });
19
25
  return response;
20
26
  }
27
+ /**
28
+ * Create an edit-video task; returns immediately with a task id.
29
+ * @param params Edit-video parameters.
30
+ * @param options Per-request overrides.
31
+ * @returns The task creation result with id.
32
+ */
21
33
  async create(params, options) {
22
34
  return this.http.request("POST", ENDPOINT, {
23
35
  body: compactParams(params),
24
36
  ...options
25
37
  });
26
38
  }
39
+ /**
40
+ * Fetch the current status of an edit-video task.
41
+ * @param id The task id.
42
+ * @param options Per-request overrides.
43
+ * @returns The current edit-video task status.
44
+ */
27
45
  async get(id, options) {
28
46
  return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
29
47
  }
@@ -38,6 +56,12 @@ var ImageToVideo = class {
38
56
  this.http = http;
39
57
  }
40
58
  http;
59
+ /**
60
+ * Create an image-to-video task and wait until complete.
61
+ * @param params Image-to-video parameters.
62
+ * @param options Per-request and polling overrides.
63
+ * @returns The completed task with videos.
64
+ */
41
65
  async run(params, options) {
42
66
  const { id } = await this.create(params, options);
43
67
  const response = await pollUntilComplete2(() => this.get(id, options), {
@@ -46,26 +70,44 @@ var ImageToVideo = class {
46
70
  });
47
71
  return response;
48
72
  }
73
+ /**
74
+ * Create an image-to-video task; returns immediately with a task id.
75
+ * @param params Image-to-video parameters.
76
+ * @param options Per-request overrides.
77
+ * @returns The task creation result with id.
78
+ */
49
79
  async create(params, options) {
50
80
  return this.http.request("POST", ENDPOINT2, {
51
81
  body: compactParams2(params),
52
82
  ...options
53
83
  });
54
84
  }
85
+ /**
86
+ * Fetch the current status of an image-to-video task.
87
+ * @param id The task id.
88
+ * @param options Per-request overrides.
89
+ * @returns The current image-to-video task status.
90
+ */
55
91
  async get(id, options) {
56
92
  return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
57
93
  }
58
94
  };
59
95
 
60
- // src/resources/reference-to-video.ts
96
+ // src/resources/text-to-video.ts
61
97
  import { compactParams as compactParams3 } from "@runapi.ai/core";
62
98
  import { pollUntilComplete as pollUntilComplete3 } from "@runapi.ai/core/internal";
63
- var ENDPOINT3 = "/api/v1/happyhorse/reference_to_video";
64
- var ReferenceToVideo = class {
99
+ var ENDPOINT3 = "/api/v1/happyhorse/text_to_video";
100
+ var TextToVideo = class {
65
101
  constructor(http) {
66
102
  this.http = http;
67
103
  }
68
104
  http;
105
+ /**
106
+ * Create a text-to-video task and wait until complete.
107
+ * @param params Text-to-video parameters.
108
+ * @param options Per-request and polling overrides.
109
+ * @returns The completed task with videos.
110
+ */
69
111
  async run(params, options) {
70
112
  const { id } = await this.create(params, options);
71
113
  const response = await pollUntilComplete3(() => this.get(id, options), {
@@ -74,57 +116,42 @@ var ReferenceToVideo = class {
74
116
  });
75
117
  return response;
76
118
  }
119
+ /**
120
+ * Create a text-to-video task; returns immediately with a task id.
121
+ * @param params Text-to-video parameters.
122
+ * @param options Per-request overrides.
123
+ * @returns The task creation result with id.
124
+ */
77
125
  async create(params, options) {
78
126
  return this.http.request("POST", ENDPOINT3, {
79
127
  body: compactParams3(params),
80
128
  ...options
81
129
  });
82
130
  }
131
+ /**
132
+ * Fetch the current status of a text-to-video task.
133
+ * @param id The task id.
134
+ * @param options Per-request overrides.
135
+ * @returns The current text-to-video task status.
136
+ */
83
137
  async get(id, options) {
84
138
  return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
85
139
  }
86
140
  };
87
141
 
88
- // src/resources/text-to-video.ts
89
- import { compactParams as compactParams4 } from "@runapi.ai/core";
90
- import { pollUntilComplete as pollUntilComplete4 } from "@runapi.ai/core/internal";
91
- var ENDPOINT4 = "/api/v1/happyhorse/text_to_video";
92
- var TextToVideo = class {
93
- constructor(http) {
94
- this.http = http;
95
- }
96
- http;
97
- async run(params, options) {
98
- const { id } = await this.create(params, options);
99
- const response = await pollUntilComplete4(() => this.get(id, options), {
100
- maxWaitMs: options?.maxWaitMs,
101
- pollIntervalMs: options?.pollIntervalMs
102
- });
103
- return response;
104
- }
105
- async create(params, options) {
106
- return this.http.request("POST", ENDPOINT4, {
107
- body: compactParams4(params),
108
- ...options
109
- });
110
- }
111
- async get(id, options) {
112
- return this.http.request("GET", `${ENDPOINT4}/${id}`, options ?? {});
113
- }
114
- };
115
-
116
142
  // src/client.ts
117
- var HappyHorseClient = class {
143
+ var HappyHorseClient = class extends BaseClient {
144
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
118
145
  textToVideo;
146
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
119
147
  imageToVideo;
120
- referenceToVideo;
148
+ /** Transform an existing video with a text prompt and optional reference images. */
121
149
  editVideo;
122
150
  constructor(options = {}) {
123
- const http = createHttpClient(options);
124
- this.textToVideo = new TextToVideo(http);
125
- this.imageToVideo = new ImageToVideo(http);
126
- this.referenceToVideo = new ReferenceToVideo(http);
127
- this.editVideo = new EditVideo(http);
151
+ super(options);
152
+ this.textToVideo = new TextToVideo(this.http);
153
+ this.imageToVideo = new ImageToVideo(this.http);
154
+ this.editVideo = new EditVideo(this.http);
128
155
  }
129
156
  };
130
157
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/resources/edit-video.ts","../src/resources/image-to-video.ts","../src/resources/reference-to-video.ts","../src/resources/text-to-video.ts","../src/index.ts"],"sourcesContent":["import { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { EditVideo } from './resources/edit-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { ReferenceToVideo } from './resources/reference-to-video';\nimport { TextToVideo } from './resources/text-to-video';\n\nexport class HappyHorseClient {\n public readonly textToVideo: TextToVideo;\n public readonly imageToVideo: ImageToVideo;\n public readonly referenceToVideo: ReferenceToVideo;\n public readonly editVideo: EditVideo;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToVideo = new TextToVideo(http);\n this.imageToVideo = new ImageToVideo(http);\n this.referenceToVideo = new ReferenceToVideo(http);\n this.editVideo = new EditVideo(http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditVideoResponse,\n EditVideoParams,\n EditVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/edit_video';\n\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditVideoResponse;\n }\n\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<EditVideoResponse> {\n return this.http.request<EditVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/image_to_video';\n\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\n }\n\n async create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedReferenceToVideoResponse,\n ReferenceToVideoParams,\n ReferenceToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/reference_to_video';\n\nexport class ReferenceToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: ReferenceToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedReferenceToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ReferenceToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedReferenceToVideoResponse;\n }\n\n async create(params: ReferenceToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<ReferenceToVideoResponse> {\n return this.http.request<ReferenceToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/text_to_video';\n\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export { HappyHorseClient } 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,wBAA4C;;;ACCrD,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAEV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG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AA,EACH;AAAA,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AJ5BO,IAAM,mBAAN,MAAuB;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO,iBAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,eAAe,IAAI,aAAa,IAAI;AACzC,SAAK,mBAAmB,IAAI,iBAAiB,IAAI;AACjD,SAAK,YAAY,IAAI,UAAU,IAAI;AAAA,EACrC;AACF;;;AKhBA;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","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT"]}
1
+ {"version":3,"sources":["../src/client.ts","../src/resources/edit-video.ts","../src/resources/image-to-video.ts","../src/resources/text-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { EditVideo } from './resources/edit-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * HappyHorse video generation and editing API client.\n *\n * @example\n * ```typescript\n * const client = new HappyHorseClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'happyhorse-text-to-video',\n * prompt: 'A horse galloping across a sunset beach',\n * });\n * ```\n */\nexport class HappyHorseClient extends BaseClient {\n /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\n public readonly textToVideo: TextToVideo;\n /** Animate a still first-frame image into video, guided by an optional text prompt. */\n public readonly imageToVideo: ImageToVideo;\n /** Transform an existing video with a text prompt and optional reference images. */\n public readonly editVideo: EditVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n this.editVideo = new EditVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditVideoResponse,\n EditVideoParams,\n EditVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/edit_video';\n\n/** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit-video task and wait until complete.\n * @param params Edit-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditVideoResponse;\n }\n\n /**\n * Create an edit-video task; returns immediately with a task id.\n * @param params Edit-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditVideoResponse> {\n return this.http.request<EditVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/image_to_video';\n\n/** Animate a still first-frame image into video, guided by an optional text prompt. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an image-to-video task 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(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\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: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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 image-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/text_to_video';\n\n/** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text-to-video task 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(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\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: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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 text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export { HappyHorseClient } 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,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAGV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAqC,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KAAK,IAAI;AAAA,EAC1C;AACF;;;AI7BA;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","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runapi.ai/happyhorse",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "RunAPI HappyHorse SDK for JavaScript, Ruby, and Go",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "clean": "rm -rf dist"
29
29
  },
30
30
  "dependencies": {
31
- "@runapi.ai/core": "^0.2.4"
31
+ "@runapi.ai/core": "^0.2.6"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",
@@ -5,7 +5,7 @@
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
- Install this agent skill, inspect HappyHorse fields, then run text, image, reference-to-video, or edit-video jobs through the RunAPI CLI.
8
+ Install this agent skill, inspect HappyHorse fields, then run text, image, or edit-video jobs through the RunAPI CLI.
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  <br/>
23
23
 
24
- Generate text, image, reference-to-video, or edit-video clips with HappyHorse in 720p or 1080p. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate HappyHorse through RunAPI.
24
+ Generate text, image, or edit-video clips with HappyHorse in 720p or 1080p. Text-to-video can also use ordered reference images through the character model. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate HappyHorse through RunAPI.
25
25
 
26
26
  The canonical agent file is `skills/happyhorse/SKILL.md`.
27
27
 
@@ -51,22 +51,23 @@ import { HappyHorseClient } from '@runapi.ai/happyhorse';
51
51
 
52
52
  const client = new HappyHorseClient();
53
53
  const result = await client.textToVideo.run({
54
- model: 'happyhorse-text-to-video',
55
- prompt: 'A tiny paper horse gallops through a miniature cardboard city at night.',
56
- resolution: '1080p',
54
+ model: 'happyhorse-character',
55
+ prompt: 'Character1 walks through a miniature cardboard city at night.',
56
+ reference_image_urls: ['https://cdn.runapi.ai/public/samples/reference-1.jpg'],
57
+ output_resolution: '1080p',
57
58
  aspect_ratio: '16:9',
58
- duration: 5,
59
+ duration_seconds: 5,
59
60
  });
60
61
  ```
61
62
 
62
- Image-to-video tasks use `client.imageToVideo` with `model: 'happyhorse-image-to-video'` and exactly one `image_urls` entry. Reference-to-video tasks use `client.referenceToVideo` with `model: 'happyhorse-reference-to-video'` and 1-9 `reference_image` entries. Edit-video tasks use `client.editVideo` with `model: 'happyhorse-video-edit'`, one `video_url`, and optional `reference_image` entries.
63
+ Image-to-video tasks use `client.imageToVideo` with `model: 'happyhorse-image-to-video'` and `first_frame_image_url`. Character-guided text-to-video tasks use `client.textToVideo` with `model: 'happyhorse-character'` and 1-9 `reference_image_urls` entries. Edit-video tasks use `client.editVideo` with `model: 'happyhorse-edit-video'`, one `source_video_url`, and optional `reference_image_urls`.
63
64
 
64
65
  ## Variants
65
66
 
66
67
  - `happyhorse-text-to-video`: create 3-15 second videos from a text prompt with 720p or 1080p output.
68
+ - `happyhorse-character`: create 3-15 second text-to-video clips guided by 1-9 ordered reference images.
67
69
  - `happyhorse-image-to-video`: animate one first-frame image into a 3-15 second video with 720p or 1080p output.
68
- - `happyhorse-reference-to-video`: create 3-15 second videos from a prompt and 1-9 ordered reference images.
69
- - `happyhorse-video-edit`: edit one 3-60 second source video using a prompt and up to 5 reference images.
70
+ - `happyhorse-edit-video`: edit one 3-60 second source video using a prompt and up to 5 reference images.
70
71
 
71
72
  ## Routing
72
73
 
@@ -75,14 +76,16 @@ Image-to-video tasks use `client.imageToVideo` with `model: 'happyhorse-image-to
75
76
  - SDK docs: https://runapi.ai/docs#sdk-happyhorse
76
77
  - SDK repository: https://github.com/runapi-ai/happyhorse-sdk
77
78
  - Image-to-video pricing and rate limits: https://runapi.ai/models/happyhorse/image-to-video
78
- - Reference-to-video pricing and rate limits: https://runapi.ai/models/happyhorse/reference-to-video
79
- - Edit-video pricing and rate limits: https://runapi.ai/models/happyhorse/video-edit
79
+ - Character pricing and rate limits: https://runapi.ai/models/happyhorse/character
80
+ - Edit-video pricing and rate limits: https://runapi.ai/models/happyhorse/edit-video
80
81
  - Pricing and rate limits: https://runapi.ai/models/happyhorse/text-to-video
81
82
  - Provider comparison: https://runapi.ai/providers/alibaba
82
83
  - Browse all RunAPI models and skills: https://runapi.ai/models
83
84
 
84
85
  ## Agent rules
85
86
 
87
+ - Integration work uses the target language SDK; one-off generation, manual smoke tests, debugging, or user-requested CLI runs use the RunAPI CLI skill: https://github.com/runapi-ai/cli-skill
88
+ - 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.
86
89
  - Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
87
90
  - Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
88
91
  - For happyhorse ai api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: happyhorse
3
- description: Generate text, image, reference-to-video, or edit-video clips with HappyHorse through RunAPI. Use when the user asks an agent to create video from text, a first-frame image, reference images, or an edited source video with HappyHorse. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend.
3
+ description: Generate text, image, or edit-video clips with HappyHorse through RunAPI. Use when the user asks an agent to create video from text, a first-frame image, ordered reference images, or an edited source video with HappyHorse. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend.
4
4
  documentation: https://runapi.ai/models/happyhorse.md
5
5
  provider_page: https://runapi.ai/providers/alibaba.md
6
6
  catalog: https://runapi.ai/models.md
@@ -18,21 +18,30 @@ metadata:
18
18
  envVars:
19
19
  - name: RUNAPI_API_KEY
20
20
  required: false
21
- description: Optional RunAPI API key; agents should prefer environment auth or saved CLI config. Browser login is interactive fallback only.
21
+ description: Optional RunAPI API key; agents should prefer environment auth or saved CLI config. Browser login is interactive only.
22
22
  ---
23
23
 
24
24
  # HappyHorse on RunAPI
25
25
 
26
- Generate text, image, reference-to-video, or edit-video clips with HappyHorse through RunAPI. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration.
26
+ Generate text, image, or edit-video clips with HappyHorse through RunAPI. Text-to-video can also use ordered reference images through the character model. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration.
27
27
 
28
- ## Routing decision
28
+ ## Critical: Integration Runtime
29
29
 
30
- - One-off text, image, reference-to-video, or edit-video generation for the user -> use the CLI path with the `runapi` binary.
31
- - Building an app, backend, worker, library, or production codebase -> use the SDK integration path.
30
+ - 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.
31
+ - 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.
32
+ - Never shell out to the `runapi` CLI as the production runtime integration layer.
33
+
34
+ ## SDK integration path
35
+
36
+ When integrating HappyHorse 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:
37
+
38
+ - JavaScript / TypeScript: `@runapi.ai/happyhorse`
39
+ - Ruby: `runapi-happyhorse`
40
+ - Go: `github.com/runapi-ai/happyhorse-sdk/go`
32
41
 
33
42
  ## CLI path
34
43
 
35
- The `runapi` binary is the runtime dependency. 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.
44
+ 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.
36
45
 
37
46
  Inspect the available commands and request fields with CLI help:
38
47
 
@@ -40,7 +49,6 @@ Inspect the available commands and request fields with CLI help:
40
49
  runapi happyhorse --help
41
50
  runapi happyhorse text-to-video --help
42
51
  runapi happyhorse image-to-video --help
43
- runapi happyhorse reference-to-video --help
44
52
  runapi happyhorse edit-video --help
45
53
  ```
46
54
 
@@ -49,7 +57,6 @@ Run a one-off task:
49
57
  ```shell
50
58
  runapi happyhorse text-to-video --input-file request.json
51
59
  runapi happyhorse image-to-video --input-file request.json
52
- runapi happyhorse reference-to-video --input-file request.json
53
60
  runapi happyhorse edit-video --input-file request.json
54
61
  ```
55
62
 
@@ -60,31 +67,27 @@ runapi happyhorse text-to-video --async --input-file request.json
60
67
  runapi wait <task-id> --service happyhorse --action text-to-video
61
68
  ```
62
69
 
63
- For image-to-video, reference-to-video, and edit-video, use the same async pattern with `--action image-to-video`, `--action reference-to-video`, or `--action edit-video`.
70
+ For image-to-video and edit-video, use the same async pattern with `--action image-to-video` or `--action edit-video`.
64
71
 
65
- Available commands: `text-to-video`, `image-to-video`, `reference-to-video`, `edit-video`.
72
+ Available commands: `text-to-video`, `image-to-video`, `edit-video`.
66
73
 
67
74
  ## Variants
68
75
 
69
76
  - `happyhorse-text-to-video`: create 3-15 second videos from a text prompt with 720p or 1080p output.
77
+ - `happyhorse-character`: create 3-15 second text-to-video clips guided by 1-9 ordered reference images.
70
78
  - `happyhorse-image-to-video`: animate one first-frame image into a 3-15 second video with 720p or 1080p output.
71
- - `happyhorse-reference-to-video`: create 3-15 second videos from a prompt and 1-9 ordered reference images.
72
- - `happyhorse-video-edit`: edit one 3-60 second source video using a prompt and up to 5 reference images.
73
-
74
- ## SDK integration path
79
+ - `happyhorse-edit-video`: edit one 3-60 second source video using a prompt and up to 5 reference images.
75
80
 
76
- When integrating HappyHorse into an app, backend, worker, or library, use a RunAPI SDK package:
81
+ ## Generated file storage
77
82
 
78
- - JavaScript / TypeScript: `@runapi.ai/happyhorse`
79
- - Ruby: `runapi-happyhorse`
80
- - Go: `github.com/runapi-ai/happyhorse-sdk/go`
83
+ 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.
81
84
 
82
85
  ## References
83
86
 
84
87
  - Model overview, pricing, and rate limits: https://runapi.ai/models/happyhorse.md
85
88
  - Text-to-video variant: https://runapi.ai/models/happyhorse/text-to-video.md
89
+ - Character variant: https://runapi.ai/models/happyhorse/character.md
86
90
  - Image-to-video variant: https://runapi.ai/models/happyhorse/image-to-video.md
87
- - Reference-to-video variant: https://runapi.ai/models/happyhorse/reference-to-video.md
88
- - Edit-video variant: https://runapi.ai/models/happyhorse/video-edit.md
91
+ - Edit-video variant: https://runapi.ai/models/happyhorse/edit-video.md
89
92
  - Provider comparison: https://runapi.ai/providers/alibaba.md
90
93
  - Full model catalog: https://runapi.ai/models.md