@runapi.ai/happyhorse 0.2.5 → 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 +2 -0
- package/dist/index.d.mts +116 -2
- package/dist/index.d.ts +116 -2
- package/dist/index.js +62 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/happyhorse/README.md +2 -0
- package/skills/happyhorse/SKILL.md +15 -10
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ const video = await client.textToVideo.run({
|
|
|
26
26
|
|
|
27
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
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.
|
|
30
|
+
|
|
29
31
|
## Links
|
|
30
32
|
|
|
31
33
|
- Model page: https://runapi.ai/models/happyhorse
|
package/dist/index.d.mts
CHANGED
|
@@ -1,45 +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
|
+
/**
|
|
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
|
+
*/
|
|
4
8
|
type HappyHorseTextToVideoModel = 'happyhorse-text-to-video' | 'happyhorse-character';
|
|
5
9
|
type HappyHorseImageToVideoModel = 'happyhorse-image-to-video';
|
|
6
10
|
type HappyHorseEditVideoModel = 'happyhorse-edit-video';
|
|
11
|
+
/** Output resolution. Defaults to 1080p. */
|
|
7
12
|
type HappyHorseOutputResolution = '720p' | '1080p';
|
|
13
|
+
/** Aspect ratio. Defaults to 16:9. */
|
|
8
14
|
type HappyHorseAspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';
|
|
15
|
+
/** Audio handling for video editing. "auto" lets the model decide; "original" preserves the source video's audio. */
|
|
9
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
|
+
*/
|
|
10
21
|
interface TextToVideoParams {
|
|
11
22
|
model: HappyHorseTextToVideoModel;
|
|
23
|
+
/** Video description prompt. Up to 5000 non-Chinese characters or 2500 Chinese characters. */
|
|
12
24
|
prompt: string;
|
|
25
|
+
/** Character reference images for happyhorse-character (1-9 URLs). Not supported on happyhorse-text-to-video. */
|
|
13
26
|
reference_image_urls?: string[];
|
|
27
|
+
/** Output resolution. Defaults to 1080p. */
|
|
14
28
|
output_resolution?: HappyHorseOutputResolution;
|
|
29
|
+
/** Aspect ratio. Defaults to 16:9. */
|
|
15
30
|
aspect_ratio?: HappyHorseAspectRatio;
|
|
31
|
+
/** Duration in seconds (3-15). Defaults to 5. */
|
|
16
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;
|
|
44
|
+
/** Source image URL used as the video's opening frame. */
|
|
22
45
|
first_frame_image_url: string;
|
|
46
|
+
/** Optional motion description prompt. */
|
|
23
47
|
prompt?: string;
|
|
48
|
+
/** Output resolution. Defaults to 1080p. */
|
|
24
49
|
output_resolution?: HappyHorseOutputResolution;
|
|
50
|
+
/** Duration in seconds (3-15). Defaults to 5. */
|
|
25
51
|
duration_seconds?: number;
|
|
52
|
+
/** Reproducibility seed (0-2147483647). */
|
|
26
53
|
seed?: number;
|
|
54
|
+
/** URL for completion callback notifications. */
|
|
27
55
|
callback_url?: string;
|
|
28
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
|
+
*/
|
|
29
62
|
interface EditVideoParams {
|
|
30
63
|
model: HappyHorseEditVideoModel;
|
|
64
|
+
/** Editing instruction prompt describing the desired transformation. */
|
|
31
65
|
prompt: string;
|
|
66
|
+
/** Source video URL to transform (3-60s, MP4/MOV). */
|
|
32
67
|
source_video_url: string;
|
|
68
|
+
/** Optional reference images to guide the edit (up to 5 URLs). */
|
|
33
69
|
reference_image_urls?: string[];
|
|
70
|
+
/** Output resolution. Defaults to 1080p. */
|
|
34
71
|
output_resolution?: HappyHorseOutputResolution;
|
|
72
|
+
/** Audio handling: "auto" lets the model decide, "original" preserves the source audio. */
|
|
35
73
|
audio_setting?: HappyHorseAudioSetting;
|
|
74
|
+
/** Reproducibility seed (0-2147483647). */
|
|
36
75
|
seed?: number;
|
|
76
|
+
/** URL for completion callback notifications. */
|
|
37
77
|
callback_url?: string;
|
|
38
78
|
}
|
|
39
79
|
interface TaskCreateResponse {
|
|
40
80
|
id: string;
|
|
41
81
|
status?: AsyncTaskStatus;
|
|
42
82
|
}
|
|
83
|
+
/** A generated video file with a download URL. */
|
|
43
84
|
interface Video {
|
|
44
85
|
url: string;
|
|
45
86
|
}
|
|
@@ -65,33 +106,106 @@ type CompletedEditVideoResponse = EditVideoResponse & {
|
|
|
65
106
|
videos: Video[];
|
|
66
107
|
};
|
|
67
108
|
|
|
109
|
+
/** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */
|
|
68
110
|
declare class EditVideo {
|
|
69
111
|
private readonly http;
|
|
70
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
|
+
*/
|
|
71
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
|
+
*/
|
|
72
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
|
+
*/
|
|
73
133
|
get(id: string, options?: RequestOptions): Promise<EditVideoResponse>;
|
|
74
134
|
}
|
|
75
135
|
|
|
136
|
+
/** Animate a still first-frame image into video, guided by an optional text prompt. */
|
|
76
137
|
declare class ImageToVideo {
|
|
77
138
|
private readonly http;
|
|
78
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
|
+
*/
|
|
79
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
|
+
*/
|
|
80
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
|
+
*/
|
|
81
160
|
get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse>;
|
|
82
161
|
}
|
|
83
162
|
|
|
163
|
+
/** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
|
|
84
164
|
declare class TextToVideo {
|
|
85
165
|
private readonly http;
|
|
86
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
|
+
*/
|
|
87
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
|
+
*/
|
|
88
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
|
+
*/
|
|
89
187
|
get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
|
|
90
188
|
}
|
|
91
189
|
|
|
92
|
-
|
|
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. */
|
|
93
205
|
readonly textToVideo: TextToVideo;
|
|
206
|
+
/** Animate a still first-frame image into video, guided by an optional text prompt. */
|
|
94
207
|
readonly imageToVideo: ImageToVideo;
|
|
208
|
+
/** Transform an existing video with a text prompt and optional reference images. */
|
|
95
209
|
readonly editVideo: EditVideo;
|
|
96
210
|
constructor(options?: ClientOptions);
|
|
97
211
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,45 +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
|
+
/**
|
|
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
|
+
*/
|
|
4
8
|
type HappyHorseTextToVideoModel = 'happyhorse-text-to-video' | 'happyhorse-character';
|
|
5
9
|
type HappyHorseImageToVideoModel = 'happyhorse-image-to-video';
|
|
6
10
|
type HappyHorseEditVideoModel = 'happyhorse-edit-video';
|
|
11
|
+
/** Output resolution. Defaults to 1080p. */
|
|
7
12
|
type HappyHorseOutputResolution = '720p' | '1080p';
|
|
13
|
+
/** Aspect ratio. Defaults to 16:9. */
|
|
8
14
|
type HappyHorseAspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';
|
|
15
|
+
/** Audio handling for video editing. "auto" lets the model decide; "original" preserves the source video's audio. */
|
|
9
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
|
+
*/
|
|
10
21
|
interface TextToVideoParams {
|
|
11
22
|
model: HappyHorseTextToVideoModel;
|
|
23
|
+
/** Video description prompt. Up to 5000 non-Chinese characters or 2500 Chinese characters. */
|
|
12
24
|
prompt: string;
|
|
25
|
+
/** Character reference images for happyhorse-character (1-9 URLs). Not supported on happyhorse-text-to-video. */
|
|
13
26
|
reference_image_urls?: string[];
|
|
27
|
+
/** Output resolution. Defaults to 1080p. */
|
|
14
28
|
output_resolution?: HappyHorseOutputResolution;
|
|
29
|
+
/** Aspect ratio. Defaults to 16:9. */
|
|
15
30
|
aspect_ratio?: HappyHorseAspectRatio;
|
|
31
|
+
/** Duration in seconds (3-15). Defaults to 5. */
|
|
16
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;
|
|
44
|
+
/** Source image URL used as the video's opening frame. */
|
|
22
45
|
first_frame_image_url: string;
|
|
46
|
+
/** Optional motion description prompt. */
|
|
23
47
|
prompt?: string;
|
|
48
|
+
/** Output resolution. Defaults to 1080p. */
|
|
24
49
|
output_resolution?: HappyHorseOutputResolution;
|
|
50
|
+
/** Duration in seconds (3-15). Defaults to 5. */
|
|
25
51
|
duration_seconds?: number;
|
|
52
|
+
/** Reproducibility seed (0-2147483647). */
|
|
26
53
|
seed?: number;
|
|
54
|
+
/** URL for completion callback notifications. */
|
|
27
55
|
callback_url?: string;
|
|
28
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
|
+
*/
|
|
29
62
|
interface EditVideoParams {
|
|
30
63
|
model: HappyHorseEditVideoModel;
|
|
64
|
+
/** Editing instruction prompt describing the desired transformation. */
|
|
31
65
|
prompt: string;
|
|
66
|
+
/** Source video URL to transform (3-60s, MP4/MOV). */
|
|
32
67
|
source_video_url: string;
|
|
68
|
+
/** Optional reference images to guide the edit (up to 5 URLs). */
|
|
33
69
|
reference_image_urls?: string[];
|
|
70
|
+
/** Output resolution. Defaults to 1080p. */
|
|
34
71
|
output_resolution?: HappyHorseOutputResolution;
|
|
72
|
+
/** Audio handling: "auto" lets the model decide, "original" preserves the source audio. */
|
|
35
73
|
audio_setting?: HappyHorseAudioSetting;
|
|
74
|
+
/** Reproducibility seed (0-2147483647). */
|
|
36
75
|
seed?: number;
|
|
76
|
+
/** URL for completion callback notifications. */
|
|
37
77
|
callback_url?: string;
|
|
38
78
|
}
|
|
39
79
|
interface TaskCreateResponse {
|
|
40
80
|
id: string;
|
|
41
81
|
status?: AsyncTaskStatus;
|
|
42
82
|
}
|
|
83
|
+
/** A generated video file with a download URL. */
|
|
43
84
|
interface Video {
|
|
44
85
|
url: string;
|
|
45
86
|
}
|
|
@@ -65,33 +106,106 @@ type CompletedEditVideoResponse = EditVideoResponse & {
|
|
|
65
106
|
videos: Video[];
|
|
66
107
|
};
|
|
67
108
|
|
|
109
|
+
/** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */
|
|
68
110
|
declare class EditVideo {
|
|
69
111
|
private readonly http;
|
|
70
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
|
+
*/
|
|
71
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
|
+
*/
|
|
72
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
|
+
*/
|
|
73
133
|
get(id: string, options?: RequestOptions): Promise<EditVideoResponse>;
|
|
74
134
|
}
|
|
75
135
|
|
|
136
|
+
/** Animate a still first-frame image into video, guided by an optional text prompt. */
|
|
76
137
|
declare class ImageToVideo {
|
|
77
138
|
private readonly http;
|
|
78
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
|
+
*/
|
|
79
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
|
+
*/
|
|
80
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
|
+
*/
|
|
81
160
|
get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse>;
|
|
82
161
|
}
|
|
83
162
|
|
|
163
|
+
/** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
|
|
84
164
|
declare class TextToVideo {
|
|
85
165
|
private readonly http;
|
|
86
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
|
+
*/
|
|
87
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
|
+
*/
|
|
88
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
|
+
*/
|
|
89
187
|
get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
|
|
90
188
|
}
|
|
91
189
|
|
|
92
|
-
|
|
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. */
|
|
93
205
|
readonly textToVideo: TextToVideo;
|
|
206
|
+
/** Animate a still first-frame image into video, guided by an optional text prompt. */
|
|
94
207
|
readonly imageToVideo: ImageToVideo;
|
|
208
|
+
/** Transform an existing video with a text prompt and optional reference images. */
|
|
95
209
|
readonly editVideo: EditVideo;
|
|
96
210
|
constructor(options?: ClientOptions);
|
|
97
211
|
}
|
package/dist/index.js
CHANGED
|
@@ -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,12 +107,24 @@ 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
|
}
|
|
@@ -103,6 +139,12 @@ var TextToVideo = class {
|
|
|
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,27 +153,42 @@ var TextToVideo = 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
179
|
// src/client.ts
|
|
126
|
-
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. */
|
|
127
182
|
textToVideo;
|
|
183
|
+
/** Animate a still first-frame image into video, guided by an optional text prompt. */
|
|
128
184
|
imageToVideo;
|
|
185
|
+
/** Transform an existing video with a text prompt and optional reference images. */
|
|
129
186
|
editVideo;
|
|
130
187
|
constructor(options = {}) {
|
|
131
|
-
|
|
132
|
-
this.textToVideo = new TextToVideo(http);
|
|
133
|
-
this.imageToVideo = new ImageToVideo(http);
|
|
134
|
-
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);
|
|
135
192
|
}
|
|
136
193
|
};
|
|
137
194
|
|
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/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 { TextToVideo } from './resources/text-to-video';\n\nexport class HappyHorseClient {\n public readonly textToVideo: TextToVideo;\n public readonly imageToVideo: ImageToVideo;\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.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 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,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,mBAAkC;AAQlC,IAAMC,YAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AH7BO,IAAM,mBAAN,MAAuB;AAAA,EACZ;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,YAAY,IAAI,UAAU,IAAI;AAAA,EACrC;AACF;;;ADbA,IAAAC,eAYO;","names":["import_core","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":";;;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AA;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 {
|
|
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,12 +70,24 @@ 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
|
}
|
|
@@ -66,6 +102,12 @@ var TextToVideo = class {
|
|
|
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,27 +116,42 @@ var TextToVideo = 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
142
|
// src/client.ts
|
|
89
|
-
var HappyHorseClient = class {
|
|
143
|
+
var HappyHorseClient = class extends BaseClient {
|
|
144
|
+
/** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
|
|
90
145
|
textToVideo;
|
|
146
|
+
/** Animate a still first-frame image into video, guided by an optional text prompt. */
|
|
91
147
|
imageToVideo;
|
|
148
|
+
/** Transform an existing video with a text prompt and optional reference images. */
|
|
92
149
|
editVideo;
|
|
93
150
|
constructor(options = {}) {
|
|
94
|
-
|
|
95
|
-
this.textToVideo = new TextToVideo(http);
|
|
96
|
-
this.imageToVideo = new ImageToVideo(http);
|
|
97
|
-
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);
|
|
98
155
|
}
|
|
99
156
|
};
|
|
100
157
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 { createHttpClient, 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\nexport class HappyHorseClient {\n public readonly textToVideo: TextToVideo;\n public readonly imageToVideo: ImageToVideo;\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.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 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;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAA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I,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAMD,mBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQC,WAAU;AAAA,MAC7D,MAAMF,eAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AH7BO,IAAM,mBAAN,MAAuB;AAAA,EACZ;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,YAAY,IAAI,UAAU,IAAI;AAAA,EACrC;AACF;;;AIbA;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"]}
|
|
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;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AQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AHnCO,IAAM,mBAAN,cAA+B,WAAW;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;;;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.
|
|
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.
|
|
31
|
+
"@runapi.ai/core": "^0.2.6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^20.0.0",
|
|
@@ -84,6 +84,8 @@ Image-to-video tasks use `client.imageToVideo` with `model: 'happyhorse-image-to
|
|
|
84
84
|
|
|
85
85
|
## Agent rules
|
|
86
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.
|
|
87
89
|
- Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
|
|
88
90
|
- Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
|
|
89
91
|
- For happyhorse ai api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
|
|
@@ -25,14 +25,23 @@ metadata:
|
|
|
25
25
|
|
|
26
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
|
-
##
|
|
28
|
+
## Critical: Integration Runtime
|
|
29
29
|
|
|
30
|
-
-
|
|
31
|
-
-
|
|
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
|
|
|
@@ -69,13 +78,9 @@ Available commands: `text-to-video`, `image-to-video`, `edit-video`.
|
|
|
69
78
|
- `happyhorse-image-to-video`: animate one first-frame image into a 3-15 second video with 720p or 1080p output.
|
|
70
79
|
- `happyhorse-edit-video`: edit one 3-60 second source video using a prompt and up to 5 reference images.
|
|
71
80
|
|
|
72
|
-
##
|
|
73
|
-
|
|
74
|
-
When integrating HappyHorse into an app, backend, worker, or library, use a RunAPI SDK package:
|
|
81
|
+
## Generated file storage
|
|
75
82
|
|
|
76
|
-
-
|
|
77
|
-
- Ruby: `runapi-happyhorse`
|
|
78
|
-
- 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.
|
|
79
84
|
|
|
80
85
|
## References
|
|
81
86
|
|