@runapi.ai/happyhorse 0.2.6 → 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 +1 -1
- package/dist/index.js +123 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -4
- package/skills/happyhorse/README.md +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# HappyHorse API JavaScript SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The
|
|
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
|
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,120 @@ 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) {
|
|
@@ -68,8 +182,10 @@ var EditVideo = class {
|
|
|
68
182
|
* @returns The task creation result with id.
|
|
69
183
|
*/
|
|
70
184
|
async create(params, options) {
|
|
185
|
+
const body = (0, import_core.compactParams)(params);
|
|
186
|
+
(0, import_core.validateParams)(contract["edit-video"], body);
|
|
71
187
|
return this.http.request("POST", ENDPOINT, {
|
|
72
|
-
body
|
|
188
|
+
body,
|
|
73
189
|
...options
|
|
74
190
|
});
|
|
75
191
|
}
|
|
@@ -114,8 +230,10 @@ var ImageToVideo = class {
|
|
|
114
230
|
* @returns The task creation result with id.
|
|
115
231
|
*/
|
|
116
232
|
async create(params, options) {
|
|
233
|
+
const body = (0, import_core2.compactParams)(params);
|
|
234
|
+
(0, import_core2.validateParams)(contract["image-to-video"], body);
|
|
117
235
|
return this.http.request("POST", ENDPOINT2, {
|
|
118
|
-
body
|
|
236
|
+
body,
|
|
119
237
|
...options
|
|
120
238
|
});
|
|
121
239
|
}
|
|
@@ -160,8 +278,10 @@ var TextToVideo = class {
|
|
|
160
278
|
* @returns The task creation result with id.
|
|
161
279
|
*/
|
|
162
280
|
async create(params, options) {
|
|
281
|
+
const body = (0, import_core3.compactParams)(params);
|
|
282
|
+
(0, import_core3.validateParams)(contract["text-to-video"], body);
|
|
163
283
|
return this.http.request("POST", ENDPOINT3, {
|
|
164
|
-
body
|
|
284
|
+
body,
|
|
165
285
|
...options
|
|
166
286
|
});
|
|
167
287
|
}
|
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 { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { EditVideo } from './resources/edit-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * HappyHorse video generation and editing API client.\n *\n * @example\n * ```typescript\n * const client = new HappyHorseClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'happyhorse-text-to-video',\n * prompt: 'A horse galloping across a sunset beach',\n * });\n * ```\n */\nexport class HappyHorseClient extends BaseClient {\n /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\n public readonly textToVideo: TextToVideo;\n /** Animate a still first-frame image into video, guided by an optional text prompt. */\n public readonly imageToVideo: ImageToVideo;\n /** Transform an existing video with a text prompt and optional reference images. */\n public readonly editVideo: EditVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n this.editVideo = new EditVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditVideoResponse,\n EditVideoParams,\n EditVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/edit_video';\n\n/** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit-video task and wait until complete.\n * @param params Edit-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditVideoResponse;\n }\n\n /**\n * Create an edit-video task; returns immediately with a task id.\n * @param params Edit-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditVideoResponse> {\n return this.http.request<EditVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/image_to_video';\n\n/** Animate a still first-frame image into video, guided by an optional text prompt. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an image-to-video task and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/text_to_video';\n\n/** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text-to-video task and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAGV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,I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,OAAO;AAChD,UAAM,WAAW,UAAM,oCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D,UAAM,4BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AHnCO,IAAM,mBAAN,cAA+B,wBAAW;AAAA;AAAA,EAE/B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAC9C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AD7BA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core","import_internal","ENDPOINT","import_core"]}
|
|
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', `${EN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AAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,oCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,UAAM,WAAO,4BAAc,MAAM;AACjC,qCAAe,SAAS,eAAe,GAAmB,IAA+B;AACzF,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;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
|
@@ -2,8 +2,122 @@
|
|
|
2
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) {
|
|
@@ -31,8 +145,10 @@ var EditVideo = class {
|
|
|
31
145
|
* @returns The task creation result with id.
|
|
32
146
|
*/
|
|
33
147
|
async create(params, options) {
|
|
148
|
+
const body = compactParams(params);
|
|
149
|
+
validateParams(contract["edit-video"], body);
|
|
34
150
|
return this.http.request("POST", ENDPOINT, {
|
|
35
|
-
body
|
|
151
|
+
body,
|
|
36
152
|
...options
|
|
37
153
|
});
|
|
38
154
|
}
|
|
@@ -48,7 +164,7 @@ var EditVideo = class {
|
|
|
48
164
|
};
|
|
49
165
|
|
|
50
166
|
// src/resources/image-to-video.ts
|
|
51
|
-
import { compactParams as compactParams2 } from "@runapi.ai/core";
|
|
167
|
+
import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
|
|
52
168
|
import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
|
|
53
169
|
var ENDPOINT2 = "/api/v1/happyhorse/image_to_video";
|
|
54
170
|
var ImageToVideo = class {
|
|
@@ -77,8 +193,10 @@ var ImageToVideo = class {
|
|
|
77
193
|
* @returns The task creation result with id.
|
|
78
194
|
*/
|
|
79
195
|
async create(params, options) {
|
|
196
|
+
const body = compactParams2(params);
|
|
197
|
+
validateParams2(contract["image-to-video"], body);
|
|
80
198
|
return this.http.request("POST", ENDPOINT2, {
|
|
81
|
-
body
|
|
199
|
+
body,
|
|
82
200
|
...options
|
|
83
201
|
});
|
|
84
202
|
}
|
|
@@ -94,7 +212,7 @@ var ImageToVideo = class {
|
|
|
94
212
|
};
|
|
95
213
|
|
|
96
214
|
// src/resources/text-to-video.ts
|
|
97
|
-
import { compactParams as compactParams3 } from "@runapi.ai/core";
|
|
215
|
+
import { compactParams as compactParams3, validateParams as validateParams3 } from "@runapi.ai/core";
|
|
98
216
|
import { pollUntilComplete as pollUntilComplete3 } from "@runapi.ai/core/internal";
|
|
99
217
|
var ENDPOINT3 = "/api/v1/happyhorse/text_to_video";
|
|
100
218
|
var TextToVideo = class {
|
|
@@ -123,8 +241,10 @@ var TextToVideo = class {
|
|
|
123
241
|
* @returns The task creation result with id.
|
|
124
242
|
*/
|
|
125
243
|
async create(params, options) {
|
|
244
|
+
const body = compactParams3(params);
|
|
245
|
+
validateParams3(contract["text-to-video"], body);
|
|
126
246
|
return this.http.request("POST", ENDPOINT3, {
|
|
127
|
-
body
|
|
247
|
+
body,
|
|
128
248
|
...options
|
|
129
249
|
});
|
|
130
250
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/resources/edit-video.ts","../src/resources/image-to-video.ts","../src/resources/text-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { EditVideo } from './resources/edit-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * HappyHorse video generation and editing API client.\n *\n * @example\n * ```typescript\n * const client = new HappyHorseClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'happyhorse-text-to-video',\n * prompt: 'A horse galloping across a sunset beach',\n * });\n * ```\n */\nexport class HappyHorseClient extends BaseClient {\n /** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\n public readonly textToVideo: TextToVideo;\n /** Animate a still first-frame image into video, guided by an optional text prompt. */\n public readonly imageToVideo: ImageToVideo;\n /** Transform an existing video with a text prompt and optional reference images. */\n public readonly editVideo: EditVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n this.editVideo = new EditVideo(this.http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditVideoResponse,\n EditVideoParams,\n EditVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/edit_video';\n\n/** Transform an existing video with a text prompt and optional reference images. Use audio_setting to control whether original audio is preserved. */\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit-video task and wait until complete.\n * @param params Edit-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditVideoResponse;\n }\n\n /**\n * Create an edit-video task; returns immediately with a task id.\n * @param params Edit-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditVideoResponse> {\n return this.http.request<EditVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/image_to_video';\n\n/** Animate a still first-frame image into video, guided by an optional text prompt. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an image-to-video task and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/happyhorse/text_to_video';\n\n/** Generate video from a text prompt, with optional character consistency via happyhorse-character. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text-to-video task and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export { HappyHorseClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAGV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAA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,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQC,WAAU;AAAA,MAC7D,MAAMF,eAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AHnCO,IAAM,mBAAN,cAA+B,WAAW;AAAA;AAAA,EAE/B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAC9C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AI7BA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT"]}
|
|
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;AAAA,QACV;AAAA,QACA,qBAAqB;AAAA,UACn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;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAMC,mBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,UAAM,OAAOC,eAAc,MAAM;AACjC,IAAAC,gBAAe,SAAS,eAAe,GAAmB,IAA+B;AACzF,WAAO,KAAK,KAAK,QAA4B,QAAQH,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC;AAAA,EACzF;AACF;;;AJtCO,IAAM,mBAAN,cAA+B,WAAW;AAAA;AAAA,EAE/B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAC9C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AK7BA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams","compactParams","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runapi.ai/happyhorse",
|
|
3
|
-
"
|
|
4
|
-
|
|
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.
|
|
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
|
}
|
|
@@ -88,7 +88,7 @@ Image-to-video tasks use `client.imageToVideo` with `model: 'happyhorse-image-to
|
|
|
88
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.
|
|
89
89
|
- Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
|
|
90
90
|
- Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
|
|
91
|
-
- For
|
|
91
|
+
- For pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
|
|
92
92
|
|
|
93
93
|
## License
|
|
94
94
|
|