@runapi.ai/happyhorse 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # HappyHorse API JavaScript SDK for RunAPI
2
2
 
3
- The happyhorse ai api JavaScript SDK is the language-specific package for HappyHorse on RunAPI. Use this package for text, image, and edit-video workflows that need JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
3
+ The HappyHorse JavaScript SDK is the language-specific package for HappyHorse on RunAPI. Use this package for video generation, animation, and video editing workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
4
4
 
5
5
  ## Install
6
6
 
@@ -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
- declare class HappyHorseClient {
190
+ /**
191
+ * HappyHorse video generation and editing API client.
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * const client = new HappyHorseClient({ apiKey: 'your-api-key' });
196
+ *
197
+ * const result = await client.textToVideo.run({
198
+ * model: 'happyhorse-text-to-video',
199
+ * prompt: 'A horse galloping across a sunset beach',
200
+ * });
201
+ * ```
202
+ */
203
+ declare class HappyHorseClient extends BaseClient {
204
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
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
- declare class HappyHorseClient {
190
+ /**
191
+ * HappyHorse video generation and editing API client.
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * const client = new HappyHorseClient({ apiKey: 'your-api-key' });
196
+ *
197
+ * const result = await client.textToVideo.run({
198
+ * model: 'happyhorse-text-to-video',
199
+ * prompt: 'A horse galloping across a sunset beach',
200
+ * });
201
+ * ```
202
+ */
203
+ declare class HappyHorseClient extends BaseClient {
204
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
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
@@ -41,12 +41,132 @@ var import_core4 = require("@runapi.ai/core");
41
41
  // src/resources/edit-video.ts
42
42
  var import_core = require("@runapi.ai/core");
43
43
  var import_internal = require("@runapi.ai/core/internal");
44
+
45
+ // src/contract_gen.ts
46
+ var contract = {
47
+ "edit-video": {
48
+ "models": [
49
+ "happyhorse-edit-video"
50
+ ],
51
+ "fields_by_model": {
52
+ "happyhorse-edit-video": {
53
+ "audio_setting": {
54
+ "enum": [
55
+ "auto",
56
+ "original"
57
+ ]
58
+ },
59
+ "output_resolution": {
60
+ "enum": [
61
+ "720p",
62
+ "1080p"
63
+ ]
64
+ },
65
+ "seed": {
66
+ "type": "integer"
67
+ },
68
+ "source_video_url": {
69
+ "required": true
70
+ }
71
+ }
72
+ }
73
+ },
74
+ "image-to-video": {
75
+ "models": [
76
+ "happyhorse-image-to-video"
77
+ ],
78
+ "fields_by_model": {
79
+ "happyhorse-image-to-video": {
80
+ "duration_seconds": {
81
+ "type": "integer"
82
+ },
83
+ "first_frame_image_url": {
84
+ "required": true
85
+ },
86
+ "output_resolution": {
87
+ "enum": [
88
+ "720p",
89
+ "1080p"
90
+ ]
91
+ },
92
+ "seed": {
93
+ "type": "integer"
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "text-to-video": {
99
+ "models": [
100
+ "happyhorse-character",
101
+ "happyhorse-text-to-video"
102
+ ],
103
+ "fields_by_model": {
104
+ "happyhorse-character": {
105
+ "aspect_ratio": {
106
+ "enum": [
107
+ "16:9",
108
+ "9:16",
109
+ "1:1",
110
+ "4:3",
111
+ "3:4"
112
+ ]
113
+ },
114
+ "duration_seconds": {
115
+ "type": "integer"
116
+ },
117
+ "output_resolution": {
118
+ "enum": [
119
+ "720p",
120
+ "1080p"
121
+ ]
122
+ },
123
+ "reference_image_urls": {
124
+ "required": true
125
+ },
126
+ "seed": {
127
+ "type": "integer"
128
+ }
129
+ },
130
+ "happyhorse-text-to-video": {
131
+ "aspect_ratio": {
132
+ "enum": [
133
+ "16:9",
134
+ "9:16",
135
+ "1:1",
136
+ "4:3",
137
+ "3:4"
138
+ ]
139
+ },
140
+ "duration_seconds": {
141
+ "type": "integer"
142
+ },
143
+ "output_resolution": {
144
+ "enum": [
145
+ "720p",
146
+ "1080p"
147
+ ]
148
+ },
149
+ "seed": {
150
+ "type": "integer"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ };
156
+
157
+ // src/resources/edit-video.ts
44
158
  var ENDPOINT = "/api/v1/happyhorse/edit_video";
45
159
  var EditVideo = class {
46
160
  constructor(http) {
47
161
  this.http = http;
48
162
  }
49
163
  http;
164
+ /**
165
+ * Create an edit-video task and wait until complete.
166
+ * @param params Edit-video parameters.
167
+ * @param options Per-request and polling overrides.
168
+ * @returns The completed task with videos.
169
+ */
50
170
  async run(params, options) {
51
171
  const { id } = await this.create(params, options);
52
172
  const response = await (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
@@ -55,12 +175,26 @@ var EditVideo = class {
55
175
  });
56
176
  return response;
57
177
  }
178
+ /**
179
+ * Create an edit-video task; returns immediately with a task id.
180
+ * @param params Edit-video parameters.
181
+ * @param options Per-request overrides.
182
+ * @returns The task creation result with id.
183
+ */
58
184
  async create(params, options) {
185
+ const body = (0, import_core.compactParams)(params);
186
+ (0, import_core.validateParams)(contract["edit-video"], body);
59
187
  return this.http.request("POST", ENDPOINT, {
60
- body: (0, import_core.compactParams)(params),
188
+ body,
61
189
  ...options
62
190
  });
63
191
  }
192
+ /**
193
+ * Fetch the current status of an edit-video task.
194
+ * @param id The task id.
195
+ * @param options Per-request overrides.
196
+ * @returns The current edit-video task status.
197
+ */
64
198
  async get(id, options) {
65
199
  return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
66
200
  }
@@ -75,6 +209,12 @@ var ImageToVideo = class {
75
209
  this.http = http;
76
210
  }
77
211
  http;
212
+ /**
213
+ * Create an image-to-video task and wait until complete.
214
+ * @param params Image-to-video parameters.
215
+ * @param options Per-request and polling overrides.
216
+ * @returns The completed task with videos.
217
+ */
78
218
  async run(params, options) {
79
219
  const { id } = await this.create(params, options);
80
220
  const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
@@ -83,12 +223,26 @@ var ImageToVideo = class {
83
223
  });
84
224
  return response;
85
225
  }
226
+ /**
227
+ * Create an image-to-video task; returns immediately with a task id.
228
+ * @param params Image-to-video parameters.
229
+ * @param options Per-request overrides.
230
+ * @returns The task creation result with id.
231
+ */
86
232
  async create(params, options) {
233
+ const body = (0, import_core2.compactParams)(params);
234
+ (0, import_core2.validateParams)(contract["image-to-video"], body);
87
235
  return this.http.request("POST", ENDPOINT2, {
88
- body: (0, import_core2.compactParams)(params),
236
+ body,
89
237
  ...options
90
238
  });
91
239
  }
240
+ /**
241
+ * Fetch the current status of an image-to-video task.
242
+ * @param id The task id.
243
+ * @param options Per-request overrides.
244
+ * @returns The current image-to-video task status.
245
+ */
92
246
  async get(id, options) {
93
247
  return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
94
248
  }
@@ -103,6 +257,12 @@ var TextToVideo = class {
103
257
  this.http = http;
104
258
  }
105
259
  http;
260
+ /**
261
+ * Create a text-to-video task and wait until complete.
262
+ * @param params Text-to-video parameters.
263
+ * @param options Per-request and polling overrides.
264
+ * @returns The completed task with videos.
265
+ */
106
266
  async run(params, options) {
107
267
  const { id } = await this.create(params, options);
108
268
  const response = await (0, import_internal3.pollUntilComplete)(() => this.get(id, options), {
@@ -111,27 +271,44 @@ var TextToVideo = class {
111
271
  });
112
272
  return response;
113
273
  }
274
+ /**
275
+ * Create a text-to-video task; returns immediately with a task id.
276
+ * @param params Text-to-video parameters.
277
+ * @param options Per-request overrides.
278
+ * @returns The task creation result with id.
279
+ */
114
280
  async create(params, options) {
281
+ const body = (0, import_core3.compactParams)(params);
282
+ (0, import_core3.validateParams)(contract["text-to-video"], body);
115
283
  return this.http.request("POST", ENDPOINT3, {
116
- body: (0, import_core3.compactParams)(params),
284
+ body,
117
285
  ...options
118
286
  });
119
287
  }
288
+ /**
289
+ * Fetch the current status of a text-to-video task.
290
+ * @param id The task id.
291
+ * @param options Per-request overrides.
292
+ * @returns The current text-to-video task status.
293
+ */
120
294
  async get(id, options) {
121
295
  return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
122
296
  }
123
297
  };
124
298
 
125
299
  // src/client.ts
126
- var HappyHorseClient = class {
300
+ var HappyHorseClient = class extends import_core4.BaseClient {
301
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
127
302
  textToVideo;
303
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
128
304
  imageToVideo;
305
+ /** Transform an existing video with a text prompt and optional reference images. */
129
306
  editVideo;
130
307
  constructor(options = {}) {
131
- const http = (0, import_core4.createHttpClient)(options);
132
- this.textToVideo = new TextToVideo(http);
133
- this.imageToVideo = new ImageToVideo(http);
134
- this.editVideo = new EditVideo(http);
308
+ super(options);
309
+ this.textToVideo = new TextToVideo(this.http);
310
+ this.imageToVideo = new ImageToVideo(this.http);
311
+ this.editVideo = new EditVideo(this.http);
135
312
  }
136
313
  };
137
314
 
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,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;AAAA,MAC7D,UAAM,2BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACvF;AACF;;;ACjCA,IAAAC,eAA8B;AAC9B,IAAAC,mBAAkC;AAQlC,IAAMC,Y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,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/contract_gen.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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n 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 const body = compactParams(params);\n validateParams(contract['edit-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an 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","export const contract = {\n \"edit-video\": {\n \"models\": [\n \"happyhorse-edit-video\"\n ],\n \"fields_by_model\": {\n \"happyhorse-edit-video\": {\n \"audio_setting\": {\n \"enum\": [\n \"auto\",\n \"original\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_video_url\": {\n \"required\": true\n }\n }\n }\n },\n \"image-to-video\": {\n \"models\": [\n \"happyhorse-image-to-video\"\n ],\n \"fields_by_model\": {\n \"happyhorse-image-to-video\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n },\n \"text-to-video\": {\n \"models\": [\n \"happyhorse-character\",\n \"happyhorse-text-to-video\"\n ],\n \"fields_by_model\": {\n \"happyhorse-character\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\",\n \"1:1\",\n \"4:3\",\n \"3:4\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"reference_image_urls\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"happyhorse-text-to-video\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\",\n \"1:1\",\n \"4:3\",\n \"3:4\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n 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 const body = compactParams(params);\n validateParams(contract['image-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current 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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n 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 const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;AAC9C,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,yBAAyB;AAAA,QACvB,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA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4B,QAAQA,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AJtCO,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,15 +1,135 @@
1
1
  // src/client.ts
2
- import { createHttpClient } from "@runapi.ai/core";
2
+ import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/edit-video.ts
5
- import { compactParams } from "@runapi.ai/core";
5
+ import { compactParams, validateParams } from "@runapi.ai/core";
6
6
  import { pollUntilComplete } from "@runapi.ai/core/internal";
7
+
8
+ // src/contract_gen.ts
9
+ var contract = {
10
+ "edit-video": {
11
+ "models": [
12
+ "happyhorse-edit-video"
13
+ ],
14
+ "fields_by_model": {
15
+ "happyhorse-edit-video": {
16
+ "audio_setting": {
17
+ "enum": [
18
+ "auto",
19
+ "original"
20
+ ]
21
+ },
22
+ "output_resolution": {
23
+ "enum": [
24
+ "720p",
25
+ "1080p"
26
+ ]
27
+ },
28
+ "seed": {
29
+ "type": "integer"
30
+ },
31
+ "source_video_url": {
32
+ "required": true
33
+ }
34
+ }
35
+ }
36
+ },
37
+ "image-to-video": {
38
+ "models": [
39
+ "happyhorse-image-to-video"
40
+ ],
41
+ "fields_by_model": {
42
+ "happyhorse-image-to-video": {
43
+ "duration_seconds": {
44
+ "type": "integer"
45
+ },
46
+ "first_frame_image_url": {
47
+ "required": true
48
+ },
49
+ "output_resolution": {
50
+ "enum": [
51
+ "720p",
52
+ "1080p"
53
+ ]
54
+ },
55
+ "seed": {
56
+ "type": "integer"
57
+ }
58
+ }
59
+ }
60
+ },
61
+ "text-to-video": {
62
+ "models": [
63
+ "happyhorse-character",
64
+ "happyhorse-text-to-video"
65
+ ],
66
+ "fields_by_model": {
67
+ "happyhorse-character": {
68
+ "aspect_ratio": {
69
+ "enum": [
70
+ "16:9",
71
+ "9:16",
72
+ "1:1",
73
+ "4:3",
74
+ "3:4"
75
+ ]
76
+ },
77
+ "duration_seconds": {
78
+ "type": "integer"
79
+ },
80
+ "output_resolution": {
81
+ "enum": [
82
+ "720p",
83
+ "1080p"
84
+ ]
85
+ },
86
+ "reference_image_urls": {
87
+ "required": true
88
+ },
89
+ "seed": {
90
+ "type": "integer"
91
+ }
92
+ },
93
+ "happyhorse-text-to-video": {
94
+ "aspect_ratio": {
95
+ "enum": [
96
+ "16:9",
97
+ "9:16",
98
+ "1:1",
99
+ "4:3",
100
+ "3:4"
101
+ ]
102
+ },
103
+ "duration_seconds": {
104
+ "type": "integer"
105
+ },
106
+ "output_resolution": {
107
+ "enum": [
108
+ "720p",
109
+ "1080p"
110
+ ]
111
+ },
112
+ "seed": {
113
+ "type": "integer"
114
+ }
115
+ }
116
+ }
117
+ }
118
+ };
119
+
120
+ // src/resources/edit-video.ts
7
121
  var ENDPOINT = "/api/v1/happyhorse/edit_video";
8
122
  var EditVideo = class {
9
123
  constructor(http) {
10
124
  this.http = http;
11
125
  }
12
126
  http;
127
+ /**
128
+ * Create an edit-video task and wait until complete.
129
+ * @param params Edit-video parameters.
130
+ * @param options Per-request and polling overrides.
131
+ * @returns The completed task with videos.
132
+ */
13
133
  async run(params, options) {
14
134
  const { id } = await this.create(params, options);
15
135
  const response = await pollUntilComplete(() => this.get(id, options), {
@@ -18,19 +138,33 @@ var EditVideo = class {
18
138
  });
19
139
  return response;
20
140
  }
141
+ /**
142
+ * Create an edit-video task; returns immediately with a task id.
143
+ * @param params Edit-video parameters.
144
+ * @param options Per-request overrides.
145
+ * @returns The task creation result with id.
146
+ */
21
147
  async create(params, options) {
148
+ const body = compactParams(params);
149
+ validateParams(contract["edit-video"], body);
22
150
  return this.http.request("POST", ENDPOINT, {
23
- body: compactParams(params),
151
+ body,
24
152
  ...options
25
153
  });
26
154
  }
155
+ /**
156
+ * Fetch the current status of an edit-video task.
157
+ * @param id The task id.
158
+ * @param options Per-request overrides.
159
+ * @returns The current edit-video task status.
160
+ */
27
161
  async get(id, options) {
28
162
  return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
29
163
  }
30
164
  };
31
165
 
32
166
  // src/resources/image-to-video.ts
33
- import { compactParams as compactParams2 } from "@runapi.ai/core";
167
+ import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
34
168
  import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
35
169
  var ENDPOINT2 = "/api/v1/happyhorse/image_to_video";
36
170
  var ImageToVideo = class {
@@ -38,6 +172,12 @@ var ImageToVideo = class {
38
172
  this.http = http;
39
173
  }
40
174
  http;
175
+ /**
176
+ * Create an image-to-video task and wait until complete.
177
+ * @param params Image-to-video parameters.
178
+ * @param options Per-request and polling overrides.
179
+ * @returns The completed task with videos.
180
+ */
41
181
  async run(params, options) {
42
182
  const { id } = await this.create(params, options);
43
183
  const response = await pollUntilComplete2(() => this.get(id, options), {
@@ -46,19 +186,33 @@ var ImageToVideo = class {
46
186
  });
47
187
  return response;
48
188
  }
189
+ /**
190
+ * Create an image-to-video task; returns immediately with a task id.
191
+ * @param params Image-to-video parameters.
192
+ * @param options Per-request overrides.
193
+ * @returns The task creation result with id.
194
+ */
49
195
  async create(params, options) {
196
+ const body = compactParams2(params);
197
+ validateParams2(contract["image-to-video"], body);
50
198
  return this.http.request("POST", ENDPOINT2, {
51
- body: compactParams2(params),
199
+ body,
52
200
  ...options
53
201
  });
54
202
  }
203
+ /**
204
+ * Fetch the current status of an image-to-video task.
205
+ * @param id The task id.
206
+ * @param options Per-request overrides.
207
+ * @returns The current image-to-video task status.
208
+ */
55
209
  async get(id, options) {
56
210
  return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
57
211
  }
58
212
  };
59
213
 
60
214
  // src/resources/text-to-video.ts
61
- import { compactParams as compactParams3 } from "@runapi.ai/core";
215
+ import { compactParams as compactParams3, validateParams as validateParams3 } from "@runapi.ai/core";
62
216
  import { pollUntilComplete as pollUntilComplete3 } from "@runapi.ai/core/internal";
63
217
  var ENDPOINT3 = "/api/v1/happyhorse/text_to_video";
64
218
  var TextToVideo = class {
@@ -66,6 +220,12 @@ var TextToVideo = class {
66
220
  this.http = http;
67
221
  }
68
222
  http;
223
+ /**
224
+ * Create a text-to-video task and wait until complete.
225
+ * @param params Text-to-video parameters.
226
+ * @param options Per-request and polling overrides.
227
+ * @returns The completed task with videos.
228
+ */
69
229
  async run(params, options) {
70
230
  const { id } = await this.create(params, options);
71
231
  const response = await pollUntilComplete3(() => this.get(id, options), {
@@ -74,27 +234,44 @@ var TextToVideo = class {
74
234
  });
75
235
  return response;
76
236
  }
237
+ /**
238
+ * Create a text-to-video task; returns immediately with a task id.
239
+ * @param params Text-to-video parameters.
240
+ * @param options Per-request overrides.
241
+ * @returns The task creation result with id.
242
+ */
77
243
  async create(params, options) {
244
+ const body = compactParams3(params);
245
+ validateParams3(contract["text-to-video"], body);
78
246
  return this.http.request("POST", ENDPOINT3, {
79
- body: compactParams3(params),
247
+ body,
80
248
  ...options
81
249
  });
82
250
  }
251
+ /**
252
+ * Fetch the current status of a text-to-video task.
253
+ * @param id The task id.
254
+ * @param options Per-request overrides.
255
+ * @returns The current text-to-video task status.
256
+ */
83
257
  async get(id, options) {
84
258
  return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
85
259
  }
86
260
  };
87
261
 
88
262
  // src/client.ts
89
- var HappyHorseClient = class {
263
+ var HappyHorseClient = class extends BaseClient {
264
+ /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */
90
265
  textToVideo;
266
+ /** Animate a still first-frame image into video, guided by an optional text prompt. */
91
267
  imageToVideo;
268
+ /** Transform an existing video with a text prompt and optional reference images. */
92
269
  editVideo;
93
270
  constructor(options = {}) {
94
- const http = createHttpClient(options);
95
- this.textToVideo = new TextToVideo(http);
96
- this.imageToVideo = new ImageToVideo(http);
97
- this.editVideo = new EditVideo(http);
271
+ super(options);
272
+ this.textToVideo = new TextToVideo(this.http);
273
+ this.imageToVideo = new ImageToVideo(this.http);
274
+ this.editVideo = new EditVideo(this.http);
98
275
  }
99
276
  };
100
277
 
@@ -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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MAAM,IAAI,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/contract_gen.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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n 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 const body = compactParams(params);\n validateParams(contract['edit-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an 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","export const contract = {\n \"edit-video\": {\n \"models\": [\n \"happyhorse-edit-video\"\n ],\n \"fields_by_model\": {\n \"happyhorse-edit-video\": {\n \"audio_setting\": {\n \"enum\": [\n \"auto\",\n \"original\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_video_url\": {\n \"required\": true\n }\n }\n }\n },\n \"image-to-video\": {\n \"models\": [\n \"happyhorse-image-to-video\"\n ],\n \"fields_by_model\": {\n \"happyhorse-image-to-video\": {\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n },\n \"text-to-video\": {\n \"models\": [\n \"happyhorse-character\",\n \"happyhorse-text-to-video\"\n ],\n \"fields_by_model\": {\n \"happyhorse-character\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\",\n \"1:1\",\n \"4:3\",\n \"3:4\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"reference_image_urls\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"happyhorse-text-to-video\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\",\n \"1:1\",\n \"4:3\",\n \"3:4\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, PollingOptions, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n 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 const body = compactParams(params);\n validateParams(contract['image-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current 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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n 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 const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export { HappyHorseClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,yBAAyB;AAAA,QACvB,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,QAAQ;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,QACA,oBAAoB;AAAA,UAClB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,IAChB,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,6BAA6B;AAAA,QAC3B,oBAAoB;AAAA,UAClB,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,UACvB,YAAY;AAAA,QACd;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,QAAQ;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,wBAAwB;AAAA,QACtB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,oBAAoB;AAAA,UAClB,QAAQ;AAA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plete","compactParams","validateParams","compactParams","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]}
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@runapi.ai/happyhorse",
3
- "version": "0.2.5",
4
- "description": "RunAPI HappyHorse SDK for JavaScript, Ruby, and Go",
3
+ "runapi": {
4
+ "slug": "happyhorse"
5
+ },
6
+ "version": "0.2.7",
7
+ "description": "RunAPI HappyHorse SDK for text-to-video, image-to-video, and edit-video workflows in JavaScript, Python, Ruby, Go, and Java",
5
8
  "main": "./dist/index.js",
6
9
  "module": "./dist/index.mjs",
7
10
  "types": "./dist/index.d.ts",
@@ -28,7 +31,7 @@
28
31
  "clean": "rm -rf dist"
29
32
  },
30
33
  "dependencies": {
31
- "@runapi.ai/core": "^0.2.5"
34
+ "@runapi.ai/core": "^0.2.7"
32
35
  },
33
36
  "devDependencies": {
34
37
  "@types/node": "^20.0.0",
@@ -47,8 +50,16 @@
47
50
  "api",
48
51
  "sdk",
49
52
  "typescript",
53
+ "python",
50
54
  "ruby",
51
- "golang"
55
+ "golang",
56
+ "java",
57
+ "maven",
58
+ "gradle",
59
+ "video-generation",
60
+ "text-to-video",
61
+ "video-api",
62
+ "happyhorse-ai-api"
52
63
  ],
53
64
  "author": "RunAPI",
54
65
  "license": "Apache-2.0",
@@ -56,5 +67,8 @@
56
67
  "repository": {
57
68
  "type": "git",
58
69
  "url": "git+https://github.com/runapi-ai/happyhorse-sdk.git"
70
+ },
71
+ "bugs": {
72
+ "url": "https://github.com/runapi-ai/happyhorse-sdk/issues"
59
73
  }
60
74
  }
@@ -84,9 +84,11 @@ 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
- - For happyhorse ai api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
91
+ - For pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
90
92
 
91
93
  ## License
92
94
 
@@ -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
- ## Routing decision
28
+ ## Critical: Integration Runtime
29
29
 
30
- - One-off text, image, or edit-video generation for the user -> use the CLI path with the `runapi` binary.
31
- - Building an app, backend, worker, library, or production codebase -> use the SDK integration path.
30
+ - Integration work (app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production codebase) uses the **SDK integration path** for the target language.
31
+ - One-off generation, editing, transformation, manual smoke tests, debugging, or user-requested CLI runs use the **CLI path** with the `runapi` binary. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill.
32
+ - Never shell out to the `runapi` CLI as the production runtime integration layer.
33
+
34
+ ## SDK integration path
35
+
36
+ When integrating HappyHorse into an app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production workflow, start by checking the current SDK package and official usage. Confirm install commands, client methods (`create`, `get`, `run`), request fields, response shape, and error classes before using CLI help or raw HTTP examples. Use a RunAPI SDK package:
37
+
38
+ - JavaScript / TypeScript: `@runapi.ai/happyhorse`
39
+ - Ruby: `runapi-happyhorse`
40
+ - Go: `github.com/runapi-ai/happyhorse-sdk/go`
32
41
 
33
42
  ## CLI path
34
43
 
35
- The `runapi` binary is the runtime dependency. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
44
+ The `runapi` binary is the one-off and manual testing runtime dependency. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
36
45
 
37
46
  Inspect the available commands and request fields with CLI help:
38
47
 
@@ -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
- ## SDK integration path
73
-
74
- When integrating HappyHorse into an app, backend, worker, or library, use a RunAPI SDK package:
81
+ ## Generated file storage
75
82
 
76
- - JavaScript / TypeScript: `@runapi.ai/happyhorse`
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