@runapi.ai/happyhorse 0.2.4
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/LICENSE +201 -0
- package/README.md +42 -0
- package/dist/index.d.mts +123 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.js +185 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +159 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +60 -0
- package/skills/happyhorse/README.md +92 -0
- package/skills/happyhorse/SKILL.md +90 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# HappyHorse API JavaScript SDK for RunAPI
|
|
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.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @runapi.ai/happyhorse
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { HappyHorseClient } from '@runapi.ai/happyhorse';
|
|
15
|
+
|
|
16
|
+
const client = new HappyHorseClient();
|
|
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',
|
|
21
|
+
aspect_ratio: '16:9',
|
|
22
|
+
duration: 5,
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
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
|
+
|
|
28
|
+
## Links
|
|
29
|
+
|
|
30
|
+
- Model page: https://runapi.ai/models/happyhorse
|
|
31
|
+
- SDK docs: https://runapi.ai/docs#sdk-happyhorse
|
|
32
|
+
- Product docs: https://runapi.ai/docs#happyhorse
|
|
33
|
+
- 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
|
|
36
|
+
- Pricing and rate limits: https://runapi.ai/models/happyhorse/text-to-video
|
|
37
|
+
- Provider comparison: https://runapi.ai/providers/alibaba
|
|
38
|
+
- Full catalog: https://runapi.ai/models
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
Licensed under the Apache License, Version 2.0.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
|
|
2
|
+
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
|
+
|
|
4
|
+
type HappyHorseTextToVideoModel = 'happyhorse-text-to-video';
|
|
5
|
+
type HappyHorseImageToVideoModel = 'happyhorse-image-to-video';
|
|
6
|
+
type HappyHorseReferenceToVideoModel = 'happyhorse-reference-to-video';
|
|
7
|
+
type HappyHorseEditVideoModel = 'happyhorse-video-edit';
|
|
8
|
+
type HappyHorseResolution = '720p' | '1080p';
|
|
9
|
+
type HappyHorseAspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';
|
|
10
|
+
type HappyHorseAudioSetting = 'auto' | 'origin';
|
|
11
|
+
interface TextToVideoParams {
|
|
12
|
+
model: HappyHorseTextToVideoModel;
|
|
13
|
+
prompt: string;
|
|
14
|
+
resolution?: HappyHorseResolution;
|
|
15
|
+
aspect_ratio?: HappyHorseAspectRatio;
|
|
16
|
+
duration?: number;
|
|
17
|
+
seed?: number;
|
|
18
|
+
callback_url?: string;
|
|
19
|
+
}
|
|
20
|
+
interface ImageToVideoParams {
|
|
21
|
+
model: HappyHorseImageToVideoModel;
|
|
22
|
+
image_urls: string[];
|
|
23
|
+
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;
|
|
36
|
+
seed?: number;
|
|
37
|
+
callback_url?: string;
|
|
38
|
+
}
|
|
39
|
+
interface EditVideoParams {
|
|
40
|
+
model: HappyHorseEditVideoModel;
|
|
41
|
+
prompt: string;
|
|
42
|
+
video_url: string;
|
|
43
|
+
reference_image?: string[];
|
|
44
|
+
resolution?: HappyHorseResolution;
|
|
45
|
+
audio_setting?: HappyHorseAudioSetting;
|
|
46
|
+
seed?: number;
|
|
47
|
+
callback_url?: string;
|
|
48
|
+
}
|
|
49
|
+
interface TaskCreateResponse {
|
|
50
|
+
id: string;
|
|
51
|
+
status?: AsyncTaskStatus;
|
|
52
|
+
}
|
|
53
|
+
interface Video {
|
|
54
|
+
url: string;
|
|
55
|
+
}
|
|
56
|
+
interface TextToVideoResponse {
|
|
57
|
+
id: string;
|
|
58
|
+
status: AsyncTaskStatus;
|
|
59
|
+
videos?: Video[];
|
|
60
|
+
error?: string;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
type CompletedTextToVideoResponse = TextToVideoResponse & {
|
|
64
|
+
status: 'completed';
|
|
65
|
+
videos: Video[];
|
|
66
|
+
};
|
|
67
|
+
type ImageToVideoResponse = TextToVideoResponse;
|
|
68
|
+
type CompletedImageToVideoResponse = ImageToVideoResponse & {
|
|
69
|
+
status: 'completed';
|
|
70
|
+
videos: Video[];
|
|
71
|
+
};
|
|
72
|
+
type ReferenceToVideoResponse = TextToVideoResponse;
|
|
73
|
+
type CompletedReferenceToVideoResponse = ReferenceToVideoResponse & {
|
|
74
|
+
status: 'completed';
|
|
75
|
+
videos: Video[];
|
|
76
|
+
};
|
|
77
|
+
type EditVideoResponse = TextToVideoResponse;
|
|
78
|
+
type CompletedEditVideoResponse = EditVideoResponse & {
|
|
79
|
+
status: 'completed';
|
|
80
|
+
videos: Video[];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
declare class EditVideo {
|
|
84
|
+
private readonly http;
|
|
85
|
+
constructor(http: HttpClient);
|
|
86
|
+
run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse>;
|
|
87
|
+
create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
88
|
+
get(id: string, options?: RequestOptions): Promise<EditVideoResponse>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class ImageToVideo {
|
|
92
|
+
private readonly http;
|
|
93
|
+
constructor(http: HttpClient);
|
|
94
|
+
run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse>;
|
|
95
|
+
create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
96
|
+
get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse>;
|
|
97
|
+
}
|
|
98
|
+
|
|
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
|
+
|
|
107
|
+
declare class TextToVideo {
|
|
108
|
+
private readonly http;
|
|
109
|
+
constructor(http: HttpClient);
|
|
110
|
+
run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse>;
|
|
111
|
+
create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
112
|
+
get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare class HappyHorseClient {
|
|
116
|
+
readonly textToVideo: TextToVideo;
|
|
117
|
+
readonly imageToVideo: ImageToVideo;
|
|
118
|
+
readonly referenceToVideo: ReferenceToVideo;
|
|
119
|
+
readonly editVideo: EditVideo;
|
|
120
|
+
constructor(options?: ClientOptions);
|
|
121
|
+
}
|
|
122
|
+
|
|
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 };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
|
|
2
|
+
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
|
+
|
|
4
|
+
type HappyHorseTextToVideoModel = 'happyhorse-text-to-video';
|
|
5
|
+
type HappyHorseImageToVideoModel = 'happyhorse-image-to-video';
|
|
6
|
+
type HappyHorseReferenceToVideoModel = 'happyhorse-reference-to-video';
|
|
7
|
+
type HappyHorseEditVideoModel = 'happyhorse-video-edit';
|
|
8
|
+
type HappyHorseResolution = '720p' | '1080p';
|
|
9
|
+
type HappyHorseAspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';
|
|
10
|
+
type HappyHorseAudioSetting = 'auto' | 'origin';
|
|
11
|
+
interface TextToVideoParams {
|
|
12
|
+
model: HappyHorseTextToVideoModel;
|
|
13
|
+
prompt: string;
|
|
14
|
+
resolution?: HappyHorseResolution;
|
|
15
|
+
aspect_ratio?: HappyHorseAspectRatio;
|
|
16
|
+
duration?: number;
|
|
17
|
+
seed?: number;
|
|
18
|
+
callback_url?: string;
|
|
19
|
+
}
|
|
20
|
+
interface ImageToVideoParams {
|
|
21
|
+
model: HappyHorseImageToVideoModel;
|
|
22
|
+
image_urls: string[];
|
|
23
|
+
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;
|
|
36
|
+
seed?: number;
|
|
37
|
+
callback_url?: string;
|
|
38
|
+
}
|
|
39
|
+
interface EditVideoParams {
|
|
40
|
+
model: HappyHorseEditVideoModel;
|
|
41
|
+
prompt: string;
|
|
42
|
+
video_url: string;
|
|
43
|
+
reference_image?: string[];
|
|
44
|
+
resolution?: HappyHorseResolution;
|
|
45
|
+
audio_setting?: HappyHorseAudioSetting;
|
|
46
|
+
seed?: number;
|
|
47
|
+
callback_url?: string;
|
|
48
|
+
}
|
|
49
|
+
interface TaskCreateResponse {
|
|
50
|
+
id: string;
|
|
51
|
+
status?: AsyncTaskStatus;
|
|
52
|
+
}
|
|
53
|
+
interface Video {
|
|
54
|
+
url: string;
|
|
55
|
+
}
|
|
56
|
+
interface TextToVideoResponse {
|
|
57
|
+
id: string;
|
|
58
|
+
status: AsyncTaskStatus;
|
|
59
|
+
videos?: Video[];
|
|
60
|
+
error?: string;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
type CompletedTextToVideoResponse = TextToVideoResponse & {
|
|
64
|
+
status: 'completed';
|
|
65
|
+
videos: Video[];
|
|
66
|
+
};
|
|
67
|
+
type ImageToVideoResponse = TextToVideoResponse;
|
|
68
|
+
type CompletedImageToVideoResponse = ImageToVideoResponse & {
|
|
69
|
+
status: 'completed';
|
|
70
|
+
videos: Video[];
|
|
71
|
+
};
|
|
72
|
+
type ReferenceToVideoResponse = TextToVideoResponse;
|
|
73
|
+
type CompletedReferenceToVideoResponse = ReferenceToVideoResponse & {
|
|
74
|
+
status: 'completed';
|
|
75
|
+
videos: Video[];
|
|
76
|
+
};
|
|
77
|
+
type EditVideoResponse = TextToVideoResponse;
|
|
78
|
+
type CompletedEditVideoResponse = EditVideoResponse & {
|
|
79
|
+
status: 'completed';
|
|
80
|
+
videos: Video[];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
declare class EditVideo {
|
|
84
|
+
private readonly http;
|
|
85
|
+
constructor(http: HttpClient);
|
|
86
|
+
run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse>;
|
|
87
|
+
create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
88
|
+
get(id: string, options?: RequestOptions): Promise<EditVideoResponse>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class ImageToVideo {
|
|
92
|
+
private readonly http;
|
|
93
|
+
constructor(http: HttpClient);
|
|
94
|
+
run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse>;
|
|
95
|
+
create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
96
|
+
get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse>;
|
|
97
|
+
}
|
|
98
|
+
|
|
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
|
+
|
|
107
|
+
declare class TextToVideo {
|
|
108
|
+
private readonly http;
|
|
109
|
+
constructor(http: HttpClient);
|
|
110
|
+
run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse>;
|
|
111
|
+
create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
112
|
+
get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare class HappyHorseClient {
|
|
116
|
+
readonly textToVideo: TextToVideo;
|
|
117
|
+
readonly imageToVideo: ImageToVideo;
|
|
118
|
+
readonly referenceToVideo: ReferenceToVideo;
|
|
119
|
+
readonly editVideo: EditVideo;
|
|
120
|
+
constructor(options?: ClientOptions);
|
|
121
|
+
}
|
|
122
|
+
|
|
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 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AuthenticationError: () => import_core6.AuthenticationError,
|
|
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
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
|
+
|
|
38
|
+
// src/client.ts
|
|
39
|
+
var import_core5 = require("@runapi.ai/core");
|
|
40
|
+
|
|
41
|
+
// src/resources/edit-video.ts
|
|
42
|
+
var import_core = require("@runapi.ai/core");
|
|
43
|
+
var import_internal = require("@runapi.ai/core/internal");
|
|
44
|
+
var ENDPOINT = "/api/v1/happyhorse/edit_video";
|
|
45
|
+
var EditVideo = class {
|
|
46
|
+
constructor(http) {
|
|
47
|
+
this.http = http;
|
|
48
|
+
}
|
|
49
|
+
http;
|
|
50
|
+
async run(params, options) {
|
|
51
|
+
const { id } = await this.create(params, options);
|
|
52
|
+
const response = await (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
|
|
53
|
+
maxWaitMs: options?.maxWaitMs,
|
|
54
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
55
|
+
});
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
async create(params, options) {
|
|
59
|
+
return this.http.request("POST", ENDPOINT, {
|
|
60
|
+
body: (0, import_core.compactParams)(params),
|
|
61
|
+
...options
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async get(id, options) {
|
|
65
|
+
return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/resources/image-to-video.ts
|
|
70
|
+
var import_core2 = require("@runapi.ai/core");
|
|
71
|
+
var import_internal2 = require("@runapi.ai/core/internal");
|
|
72
|
+
var ENDPOINT2 = "/api/v1/happyhorse/image_to_video";
|
|
73
|
+
var ImageToVideo = class {
|
|
74
|
+
constructor(http) {
|
|
75
|
+
this.http = http;
|
|
76
|
+
}
|
|
77
|
+
http;
|
|
78
|
+
async run(params, options) {
|
|
79
|
+
const { id } = await this.create(params, options);
|
|
80
|
+
const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
|
|
81
|
+
maxWaitMs: options?.maxWaitMs,
|
|
82
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
83
|
+
});
|
|
84
|
+
return response;
|
|
85
|
+
}
|
|
86
|
+
async create(params, options) {
|
|
87
|
+
return this.http.request("POST", ENDPOINT2, {
|
|
88
|
+
body: (0, import_core2.compactParams)(params),
|
|
89
|
+
...options
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async get(id, options) {
|
|
93
|
+
return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/resources/reference-to-video.ts
|
|
98
|
+
var import_core3 = require("@runapi.ai/core");
|
|
99
|
+
var import_internal3 = require("@runapi.ai/core/internal");
|
|
100
|
+
var ENDPOINT3 = "/api/v1/happyhorse/reference_to_video";
|
|
101
|
+
var ReferenceToVideo = class {
|
|
102
|
+
constructor(http) {
|
|
103
|
+
this.http = http;
|
|
104
|
+
}
|
|
105
|
+
http;
|
|
106
|
+
async run(params, options) {
|
|
107
|
+
const { id } = await this.create(params, options);
|
|
108
|
+
const response = await (0, import_internal3.pollUntilComplete)(() => this.get(id, options), {
|
|
109
|
+
maxWaitMs: options?.maxWaitMs,
|
|
110
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
111
|
+
});
|
|
112
|
+
return response;
|
|
113
|
+
}
|
|
114
|
+
async create(params, options) {
|
|
115
|
+
return this.http.request("POST", ENDPOINT3, {
|
|
116
|
+
body: (0, import_core3.compactParams)(params),
|
|
117
|
+
...options
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async get(id, options) {
|
|
121
|
+
return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
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
|
+
// src/client.ts
|
|
154
|
+
var HappyHorseClient = class {
|
|
155
|
+
textToVideo;
|
|
156
|
+
imageToVideo;
|
|
157
|
+
referenceToVideo;
|
|
158
|
+
editVideo;
|
|
159
|
+
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);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/index.ts
|
|
169
|
+
var import_core6 = require("@runapi.ai/core");
|
|
170
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
171
|
+
0 && (module.exports = {
|
|
172
|
+
AuthenticationError,
|
|
173
|
+
HappyHorseClient,
|
|
174
|
+
InsufficientCreditsError,
|
|
175
|
+
NetworkError,
|
|
176
|
+
NotFoundError,
|
|
177
|
+
RateLimitError,
|
|
178
|
+
RunApiError,
|
|
179
|
+
ServiceUnavailableError,
|
|
180
|
+
TaskFailedError,
|
|
181
|
+
TaskTimeoutError,
|
|
182
|
+
TimeoutError,
|
|
183
|
+
ValidationError
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AAAA,EACT;AAAA,EAEA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AA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AAA,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"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import { createHttpClient } from "@runapi.ai/core";
|
|
3
|
+
|
|
4
|
+
// src/resources/edit-video.ts
|
|
5
|
+
import { compactParams } from "@runapi.ai/core";
|
|
6
|
+
import { pollUntilComplete } from "@runapi.ai/core/internal";
|
|
7
|
+
var ENDPOINT = "/api/v1/happyhorse/edit_video";
|
|
8
|
+
var EditVideo = class {
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
http;
|
|
13
|
+
async run(params, options) {
|
|
14
|
+
const { id } = await this.create(params, options);
|
|
15
|
+
const response = await pollUntilComplete(() => this.get(id, options), {
|
|
16
|
+
maxWaitMs: options?.maxWaitMs,
|
|
17
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
18
|
+
});
|
|
19
|
+
return response;
|
|
20
|
+
}
|
|
21
|
+
async create(params, options) {
|
|
22
|
+
return this.http.request("POST", ENDPOINT, {
|
|
23
|
+
body: compactParams(params),
|
|
24
|
+
...options
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async get(id, options) {
|
|
28
|
+
return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// src/resources/image-to-video.ts
|
|
33
|
+
import { compactParams as compactParams2 } from "@runapi.ai/core";
|
|
34
|
+
import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
|
|
35
|
+
var ENDPOINT2 = "/api/v1/happyhorse/image_to_video";
|
|
36
|
+
var ImageToVideo = class {
|
|
37
|
+
constructor(http) {
|
|
38
|
+
this.http = http;
|
|
39
|
+
}
|
|
40
|
+
http;
|
|
41
|
+
async run(params, options) {
|
|
42
|
+
const { id } = await this.create(params, options);
|
|
43
|
+
const response = await pollUntilComplete2(() => this.get(id, options), {
|
|
44
|
+
maxWaitMs: options?.maxWaitMs,
|
|
45
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
46
|
+
});
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
async create(params, options) {
|
|
50
|
+
return this.http.request("POST", ENDPOINT2, {
|
|
51
|
+
body: compactParams2(params),
|
|
52
|
+
...options
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async get(id, options) {
|
|
56
|
+
return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/resources/reference-to-video.ts
|
|
61
|
+
import { compactParams as compactParams3 } from "@runapi.ai/core";
|
|
62
|
+
import { pollUntilComplete as pollUntilComplete3 } from "@runapi.ai/core/internal";
|
|
63
|
+
var ENDPOINT3 = "/api/v1/happyhorse/reference_to_video";
|
|
64
|
+
var ReferenceToVideo = class {
|
|
65
|
+
constructor(http) {
|
|
66
|
+
this.http = http;
|
|
67
|
+
}
|
|
68
|
+
http;
|
|
69
|
+
async run(params, options) {
|
|
70
|
+
const { id } = await this.create(params, options);
|
|
71
|
+
const response = await pollUntilComplete3(() => this.get(id, options), {
|
|
72
|
+
maxWaitMs: options?.maxWaitMs,
|
|
73
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
74
|
+
});
|
|
75
|
+
return response;
|
|
76
|
+
}
|
|
77
|
+
async create(params, options) {
|
|
78
|
+
return this.http.request("POST", ENDPOINT3, {
|
|
79
|
+
body: compactParams3(params),
|
|
80
|
+
...options
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async get(id, options) {
|
|
84
|
+
return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
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
|
+
// src/client.ts
|
|
117
|
+
var HappyHorseClient = class {
|
|
118
|
+
textToVideo;
|
|
119
|
+
imageToVideo;
|
|
120
|
+
referenceToVideo;
|
|
121
|
+
editVideo;
|
|
122
|
+
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);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// src/index.ts
|
|
132
|
+
import {
|
|
133
|
+
RunApiError,
|
|
134
|
+
AuthenticationError,
|
|
135
|
+
InsufficientCreditsError,
|
|
136
|
+
NotFoundError,
|
|
137
|
+
ValidationError,
|
|
138
|
+
RateLimitError,
|
|
139
|
+
ServiceUnavailableError,
|
|
140
|
+
NetworkError,
|
|
141
|
+
TimeoutError,
|
|
142
|
+
TaskTimeoutError,
|
|
143
|
+
TaskFailedError
|
|
144
|
+
} from "@runapi.ai/core";
|
|
145
|
+
export {
|
|
146
|
+
AuthenticationError,
|
|
147
|
+
HappyHorseClient,
|
|
148
|
+
InsufficientCreditsError,
|
|
149
|
+
NetworkError,
|
|
150
|
+
NotFoundError,
|
|
151
|
+
RateLimitError,
|
|
152
|
+
RunApiError,
|
|
153
|
+
ServiceUnavailableError,
|
|
154
|
+
TaskFailedError,
|
|
155
|
+
TaskTimeoutError,
|
|
156
|
+
TimeoutError,
|
|
157
|
+
ValidationError
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AA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C,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"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@runapi.ai/happyhorse",
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "RunAPI HappyHorse SDK for JavaScript, Ruby, and Go",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"skills",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18.0.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"clean": "rm -rf dist"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@runapi.ai/core": "^0.2.4"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^20.0.0",
|
|
35
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
36
|
+
"tsup": "^8.0.0",
|
|
37
|
+
"typescript": "^5.4.0",
|
|
38
|
+
"vitest": "^1.6.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"runapi",
|
|
45
|
+
"runapi-ai",
|
|
46
|
+
"happyhorse",
|
|
47
|
+
"api",
|
|
48
|
+
"sdk",
|
|
49
|
+
"typescript",
|
|
50
|
+
"ruby",
|
|
51
|
+
"golang"
|
|
52
|
+
],
|
|
53
|
+
"author": "RunAPI",
|
|
54
|
+
"license": "Apache-2.0",
|
|
55
|
+
"homepage": "https://runapi.ai/models/happyhorse",
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "git+https://github.com/runapi-ai/happyhorse-sdk.git"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/runapi-ai/happyhorse">
|
|
3
|
+
<h3 align="center">HappyHorse API Skill for RunAPI</h3>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
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.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://runapi.ai/models/happyhorse"><strong>Model Reference</strong></a> · <a href="https://github.com/runapi-ai/cli"><strong>CLI</strong></a> · <a href="https://github.com/runapi-ai/happyhorse-sdk"><strong>SDK</strong></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<div align="center">
|
|
16
|
+
|
|
17
|
+
[](https://www.skills.sh/runapi-ai/happyhorse/happyhorse)
|
|
18
|
+
[](https://clawhub.ai/runapi-ai/runapi-happyhorse)
|
|
19
|
+
[](https://github.com/runapi-ai/happyhorse/blob/main/LICENSE)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
<br/>
|
|
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.
|
|
25
|
+
|
|
26
|
+
The canonical agent file is `skills/happyhorse/SKILL.md`.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx skills add runapi-ai/happyhorse -g
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or paste this prompt to your AI agent:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
Install the happyhorse skill for me:
|
|
38
|
+
|
|
39
|
+
1. Clone https://github.com/runapi-ai/happyhorse
|
|
40
|
+
2. Copy the skills/happyhorse/ directory into your
|
|
41
|
+
user-level skills directory (e.g. ~/.claude/skills/
|
|
42
|
+
for Claude Code, ~/.codex/skills/ for Codex).
|
|
43
|
+
3. Verify that SKILL.md is present.
|
|
44
|
+
4. Confirm the install path when done.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick example
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { HappyHorseClient } from '@runapi.ai/happyhorse';
|
|
51
|
+
|
|
52
|
+
const client = new HappyHorseClient();
|
|
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',
|
|
57
|
+
aspect_ratio: '16:9',
|
|
58
|
+
duration: 5,
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
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
|
+
|
|
64
|
+
## Variants
|
|
65
|
+
|
|
66
|
+
- `happyhorse-text-to-video`: create 3-15 second videos from a text prompt with 720p or 1080p output.
|
|
67
|
+
- `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
|
+
|
|
71
|
+
## Routing
|
|
72
|
+
|
|
73
|
+
- Model page: https://runapi.ai/models/happyhorse
|
|
74
|
+
- Product docs: https://runapi.ai/docs#happyhorse
|
|
75
|
+
- SDK docs: https://runapi.ai/docs#sdk-happyhorse
|
|
76
|
+
- SDK repository: https://github.com/runapi-ai/happyhorse-sdk
|
|
77
|
+
- 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
|
|
80
|
+
- Pricing and rate limits: https://runapi.ai/models/happyhorse/text-to-video
|
|
81
|
+
- Provider comparison: https://runapi.ai/providers/alibaba
|
|
82
|
+
- Browse all RunAPI models and skills: https://runapi.ai/models
|
|
83
|
+
|
|
84
|
+
## Agent rules
|
|
85
|
+
|
|
86
|
+
- Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
|
|
87
|
+
- Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
|
|
88
|
+
- For happyhorse ai api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
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.
|
|
4
|
+
documentation: https://runapi.ai/models/happyhorse.md
|
|
5
|
+
provider_page: https://runapi.ai/providers/alibaba.md
|
|
6
|
+
catalog: https://runapi.ai/models.md
|
|
7
|
+
metadata:
|
|
8
|
+
openclaw:
|
|
9
|
+
homepage: https://runapi.ai/models/happyhorse
|
|
10
|
+
requires:
|
|
11
|
+
bins:
|
|
12
|
+
- runapi
|
|
13
|
+
install:
|
|
14
|
+
- kind: brew
|
|
15
|
+
formula: runapi-ai/tap/runapi
|
|
16
|
+
bins:
|
|
17
|
+
- runapi
|
|
18
|
+
envVars:
|
|
19
|
+
- name: RUNAPI_API_KEY
|
|
20
|
+
required: false
|
|
21
|
+
description: Optional RunAPI API key; agents should prefer environment auth or saved CLI config. Browser login is interactive fallback only.
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# HappyHorse on RunAPI
|
|
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.
|
|
27
|
+
|
|
28
|
+
## Routing decision
|
|
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.
|
|
32
|
+
|
|
33
|
+
## CLI path
|
|
34
|
+
|
|
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.
|
|
36
|
+
|
|
37
|
+
Inspect the available commands and request fields with CLI help:
|
|
38
|
+
|
|
39
|
+
```shell
|
|
40
|
+
runapi happyhorse --help
|
|
41
|
+
runapi happyhorse text-to-video --help
|
|
42
|
+
runapi happyhorse image-to-video --help
|
|
43
|
+
runapi happyhorse reference-to-video --help
|
|
44
|
+
runapi happyhorse edit-video --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Run a one-off task:
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
runapi happyhorse text-to-video --input-file request.json
|
|
51
|
+
runapi happyhorse image-to-video --input-file request.json
|
|
52
|
+
runapi happyhorse reference-to-video --input-file request.json
|
|
53
|
+
runapi happyhorse edit-video --input-file request.json
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Submit asynchronously and poll separately:
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
runapi happyhorse text-to-video --async --input-file request.json
|
|
60
|
+
runapi wait <task-id> --service happyhorse --action text-to-video
|
|
61
|
+
```
|
|
62
|
+
|
|
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`.
|
|
64
|
+
|
|
65
|
+
Available commands: `text-to-video`, `image-to-video`, `reference-to-video`, `edit-video`.
|
|
66
|
+
|
|
67
|
+
## Variants
|
|
68
|
+
|
|
69
|
+
- `happyhorse-text-to-video`: create 3-15 second videos from a text prompt with 720p or 1080p output.
|
|
70
|
+
- `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
|
|
75
|
+
|
|
76
|
+
When integrating HappyHorse into an app, backend, worker, or library, use a RunAPI SDK package:
|
|
77
|
+
|
|
78
|
+
- JavaScript / TypeScript: `@runapi.ai/happyhorse`
|
|
79
|
+
- Ruby: `runapi-happyhorse`
|
|
80
|
+
- Go: `github.com/runapi-ai/happyhorse-sdk/go`
|
|
81
|
+
|
|
82
|
+
## References
|
|
83
|
+
|
|
84
|
+
- Model overview, pricing, and rate limits: https://runapi.ai/models/happyhorse.md
|
|
85
|
+
- Text-to-video variant: https://runapi.ai/models/happyhorse/text-to-video.md
|
|
86
|
+
- 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
|
|
89
|
+
- Provider comparison: https://runapi.ai/providers/alibaba.md
|
|
90
|
+
- Full model catalog: https://runapi.ai/models.md
|