myvoicemaker 0.1.0

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.
@@ -0,0 +1,280 @@
1
+ interface RateLimitHeaders {
2
+ limit: number;
3
+ remaining: number;
4
+ reset: number;
5
+ }
6
+ interface ApiResponse<T> {
7
+ data: T;
8
+ requestId: string | undefined;
9
+ rateLimit: RateLimitHeaders | undefined;
10
+ }
11
+ type QueryParams = Record<string, string | number | boolean | undefined>;
12
+
13
+ interface HttpClientConfig {
14
+ apiKey: string;
15
+ baseUrl: string;
16
+ timeoutMs: number;
17
+ }
18
+ declare class HttpClient {
19
+ private readonly apiKey;
20
+ private readonly baseUrl;
21
+ private readonly timeoutMs;
22
+ constructor(config: HttpClientConfig);
23
+ get<T>(path: string, query?: QueryParams): Promise<ApiResponse<T>>;
24
+ post<T>(path: string, body: unknown): Promise<ApiResponse<T>>;
25
+ postMultipart<T>(path: string, filePath: string, fields: Record<string, string | undefined>): Promise<ApiResponse<T>>;
26
+ private buildUrl;
27
+ private authHeaders;
28
+ private fetchWithTimeout;
29
+ private parseRateLimit;
30
+ private parseResponse;
31
+ }
32
+
33
+ declare abstract class BaseModule {
34
+ protected readonly http: HttpClient;
35
+ constructor(http: HttpClient);
36
+ }
37
+
38
+ type SupportedLanguage = "yo" | "ig" | "ha" | "pcm" | "en" | "auto";
39
+ type JobStatus = "queued" | "processing" | "completed" | "failed";
40
+ type OutputAudioFormat = "mp3" | "wav" | "ogg";
41
+ type OutputVideoFormat = "mp4" | "webm";
42
+ type AccountTier = "free" | "starter" | "growth" | "pro" | "enterprise";
43
+ type UsageModule$1 = "tts" | "asr" | "animate" | "explain";
44
+ interface PaginatedResponse<T> {
45
+ requestId: string;
46
+ items: T[];
47
+ nextCursor: string | null;
48
+ }
49
+ interface PollOptions {
50
+ intervalMs?: number;
51
+ timeoutMs?: number;
52
+ }
53
+
54
+ interface TranscribeUrlParams {
55
+ audio: string;
56
+ language?: SupportedLanguage;
57
+ webhookUrl?: string;
58
+ }
59
+ interface TranscribeFileParams {
60
+ language?: SupportedLanguage;
61
+ webhookUrl?: string;
62
+ }
63
+ interface ListTranscriptionsParams {
64
+ limit?: number;
65
+ cursor?: string;
66
+ status?: "QUEUED" | "PROCESSING" | "COMPLETED" | "FAILED";
67
+ }
68
+ interface TranscriptionJob {
69
+ requestId: string;
70
+ job_id: string;
71
+ status: JobStatus;
72
+ language: string;
73
+ detected_language: string | null;
74
+ text: string | null;
75
+ confidence: number | null;
76
+ duration_seconds: number | null;
77
+ credits_used: number | null;
78
+ created_at: string;
79
+ completed_at: string | null;
80
+ }
81
+
82
+ declare class ASRModule extends BaseModule {
83
+ transcribe(params: TranscribeUrlParams): Promise<TranscriptionJob>;
84
+ transcribeFile(filePath: string, params?: TranscribeFileParams): Promise<TranscriptionJob>;
85
+ getResult(jobId: string): Promise<TranscriptionJob>;
86
+ list(params?: ListTranscriptionsParams): Promise<PaginatedResponse<TranscriptionJob>>;
87
+ poll(jobId: string, options?: PollOptions): Promise<TranscriptionJob>;
88
+ }
89
+
90
+ interface ListVoicesParams {
91
+ language?: SupportedLanguage;
92
+ }
93
+ interface Voice {
94
+ id: string;
95
+ name: string;
96
+ gender: "male" | "female";
97
+ language: string;
98
+ style: string;
99
+ sample_url: string;
100
+ }
101
+ interface VoiceListResponse {
102
+ voices: Voice[];
103
+ }
104
+ interface TtsGenerateParams {
105
+ text: string;
106
+ voice_id: string;
107
+ language: SupportedLanguage;
108
+ speed?: number;
109
+ output_format?: OutputAudioFormat;
110
+ }
111
+ interface TtsGenerateResponse {
112
+ requestId: string;
113
+ id: string;
114
+ audio_url: string;
115
+ duration_seconds: number | null;
116
+ characters: number;
117
+ credits_used: number;
118
+ language: string;
119
+ voice_id: string;
120
+ created_at: string;
121
+ }
122
+
123
+ declare class TTSModule extends BaseModule {
124
+ listVoices(params?: ListVoicesParams): Promise<VoiceListResponse>;
125
+ generate(params: TtsGenerateParams): Promise<TtsGenerateResponse>;
126
+ }
127
+
128
+ interface AnimateGenerateParams {
129
+ image_url: string;
130
+ audio_url: string;
131
+ output_format?: OutputVideoFormat;
132
+ }
133
+ interface AnimateJobResponse {
134
+ requestId: string;
135
+ job_id: string;
136
+ status: "queued";
137
+ estimated_credits: number;
138
+ created_at: string;
139
+ }
140
+ interface AnimateResultResponse {
141
+ requestId: string;
142
+ job_id: string;
143
+ status: JobStatus;
144
+ video_url: string | null;
145
+ duration_seconds: number | null;
146
+ credits_used: number | null;
147
+ created_at: string;
148
+ completed_at: string | null;
149
+ error: string | null;
150
+ }
151
+
152
+ declare class AnimateModule extends BaseModule {
153
+ generate(params: AnimateGenerateParams): Promise<AnimateJobResponse>;
154
+ getResult(jobId: string): Promise<AnimateResultResponse>;
155
+ poll(jobId: string, options?: PollOptions): Promise<AnimateResultResponse>;
156
+ }
157
+
158
+ type ExplainAction = "explain" | "summarize" | "translate" | "simplify";
159
+ interface ExplainParams {
160
+ text: string;
161
+ language: SupportedLanguage;
162
+ action: ExplainAction;
163
+ target_language?: SupportedLanguage;
164
+ max_tokens?: number;
165
+ }
166
+ interface ExplainResponse {
167
+ id: string;
168
+ action: ExplainAction;
169
+ language: string;
170
+ result: string;
171
+ tokens_used: number;
172
+ credits_used: number;
173
+ created_at: string;
174
+ }
175
+
176
+ declare class ExplainModule extends BaseModule {
177
+ process(params: ExplainParams): Promise<ExplainResponse>;
178
+ }
179
+
180
+ interface UsageBalanceResponse {
181
+ account_id: string;
182
+ tier: AccountTier;
183
+ credits_remaining: number;
184
+ credits_used: number;
185
+ credits_total?: number;
186
+ credits_expire: string | null;
187
+ created_at: string;
188
+ }
189
+ interface UsageBreakdownParams {
190
+ start_date: string;
191
+ end_date: string;
192
+ module?: UsageModule$1;
193
+ }
194
+ interface UsageBreakdownEntry {
195
+ module: UsageModule$1;
196
+ requests: number;
197
+ credits_used: number;
198
+ }
199
+ interface UsageBreakdownResponse {
200
+ breakdown: UsageBreakdownEntry[];
201
+ total_requests: number;
202
+ total_credits_used: number;
203
+ }
204
+
205
+ declare class UsageModule extends BaseModule {
206
+ getBalance(): Promise<UsageBalanceResponse>;
207
+ getBreakdown(params: UsageBreakdownParams): Promise<UsageBreakdownResponse>;
208
+ }
209
+
210
+ interface VoiceMakerConfig {
211
+ apiKey: string;
212
+ baseUrl?: string;
213
+ timeoutMs?: number;
214
+ }
215
+ declare class VoiceMaker {
216
+ readonly tts: TTSModule;
217
+ readonly asr: ASRModule;
218
+ readonly animate: AnimateModule;
219
+ readonly explain: ExplainModule;
220
+ readonly usage: UsageModule;
221
+ constructor(config: VoiceMakerConfig);
222
+ }
223
+
224
+ interface ApiErrorIssue {
225
+ field: string;
226
+ code: string;
227
+ message: string;
228
+ }
229
+ interface ApiErrorBody {
230
+ error: string;
231
+ detail: string;
232
+ requestId?: string;
233
+ issues?: ApiErrorIssue[];
234
+ }
235
+ declare class VoiceMakerError extends Error {
236
+ constructor(message: string);
237
+ }
238
+ declare class VoiceMakerAPIError extends VoiceMakerError {
239
+ readonly status: number;
240
+ readonly error: string;
241
+ readonly detail: string;
242
+ readonly requestId: string | undefined;
243
+ readonly issues: ApiErrorIssue[] | undefined;
244
+ constructor(status: number, body: ApiErrorBody, message?: string);
245
+ }
246
+ declare class AuthenticationError extends VoiceMakerAPIError {
247
+ constructor(body: ApiErrorBody);
248
+ }
249
+ declare class InsufficientCreditsError extends VoiceMakerAPIError {
250
+ constructor(body: ApiErrorBody);
251
+ }
252
+ declare class PermissionError extends VoiceMakerAPIError {
253
+ constructor(body: ApiErrorBody);
254
+ }
255
+ declare class NotFoundError extends VoiceMakerAPIError {
256
+ constructor(body: ApiErrorBody);
257
+ }
258
+ declare class FileSizeLimitError extends VoiceMakerAPIError {
259
+ constructor(body: ApiErrorBody);
260
+ }
261
+ declare class UnsupportedMediaTypeError extends VoiceMakerAPIError {
262
+ constructor(body: ApiErrorBody);
263
+ }
264
+ declare class ValidationError extends VoiceMakerAPIError {
265
+ constructor(body: ApiErrorBody);
266
+ }
267
+ declare class RateLimitError extends VoiceMakerAPIError {
268
+ readonly retryAfter: number | undefined;
269
+ constructor(body: ApiErrorBody, retryAfter?: number);
270
+ }
271
+ declare class ServerError extends VoiceMakerAPIError {
272
+ constructor(status: number, body: ApiErrorBody);
273
+ }
274
+ declare class TimeoutError extends VoiceMakerError {
275
+ readonly jobId: string;
276
+ readonly timeoutMs: number;
277
+ constructor(jobId: string, timeoutMs: number);
278
+ }
279
+
280
+ export { type AccountTier, type AnimateGenerateParams, type AnimateJobResponse, type AnimateResultResponse, type ApiErrorBody, type ApiErrorIssue, AuthenticationError, type ExplainAction, type ExplainParams, type ExplainResponse, FileSizeLimitError, InsufficientCreditsError, type JobStatus, type ListTranscriptionsParams, type ListVoicesParams, NotFoundError, type OutputAudioFormat, type OutputVideoFormat, type PaginatedResponse, PermissionError, type PollOptions, RateLimitError, ServerError, type SupportedLanguage, TimeoutError, type TranscribeFileParams, type TranscribeUrlParams, type TranscriptionJob, type TtsGenerateParams, type TtsGenerateResponse, UnsupportedMediaTypeError, type UsageBalanceResponse, type UsageBreakdownEntry, type UsageBreakdownParams, type UsageBreakdownResponse, type UsageModule$1 as UsageModule, ValidationError, type Voice, type VoiceListResponse, VoiceMaker, VoiceMakerAPIError, type VoiceMakerConfig, VoiceMakerError };
@@ -0,0 +1,280 @@
1
+ interface RateLimitHeaders {
2
+ limit: number;
3
+ remaining: number;
4
+ reset: number;
5
+ }
6
+ interface ApiResponse<T> {
7
+ data: T;
8
+ requestId: string | undefined;
9
+ rateLimit: RateLimitHeaders | undefined;
10
+ }
11
+ type QueryParams = Record<string, string | number | boolean | undefined>;
12
+
13
+ interface HttpClientConfig {
14
+ apiKey: string;
15
+ baseUrl: string;
16
+ timeoutMs: number;
17
+ }
18
+ declare class HttpClient {
19
+ private readonly apiKey;
20
+ private readonly baseUrl;
21
+ private readonly timeoutMs;
22
+ constructor(config: HttpClientConfig);
23
+ get<T>(path: string, query?: QueryParams): Promise<ApiResponse<T>>;
24
+ post<T>(path: string, body: unknown): Promise<ApiResponse<T>>;
25
+ postMultipart<T>(path: string, filePath: string, fields: Record<string, string | undefined>): Promise<ApiResponse<T>>;
26
+ private buildUrl;
27
+ private authHeaders;
28
+ private fetchWithTimeout;
29
+ private parseRateLimit;
30
+ private parseResponse;
31
+ }
32
+
33
+ declare abstract class BaseModule {
34
+ protected readonly http: HttpClient;
35
+ constructor(http: HttpClient);
36
+ }
37
+
38
+ type SupportedLanguage = "yo" | "ig" | "ha" | "pcm" | "en" | "auto";
39
+ type JobStatus = "queued" | "processing" | "completed" | "failed";
40
+ type OutputAudioFormat = "mp3" | "wav" | "ogg";
41
+ type OutputVideoFormat = "mp4" | "webm";
42
+ type AccountTier = "free" | "starter" | "growth" | "pro" | "enterprise";
43
+ type UsageModule$1 = "tts" | "asr" | "animate" | "explain";
44
+ interface PaginatedResponse<T> {
45
+ requestId: string;
46
+ items: T[];
47
+ nextCursor: string | null;
48
+ }
49
+ interface PollOptions {
50
+ intervalMs?: number;
51
+ timeoutMs?: number;
52
+ }
53
+
54
+ interface TranscribeUrlParams {
55
+ audio: string;
56
+ language?: SupportedLanguage;
57
+ webhookUrl?: string;
58
+ }
59
+ interface TranscribeFileParams {
60
+ language?: SupportedLanguage;
61
+ webhookUrl?: string;
62
+ }
63
+ interface ListTranscriptionsParams {
64
+ limit?: number;
65
+ cursor?: string;
66
+ status?: "QUEUED" | "PROCESSING" | "COMPLETED" | "FAILED";
67
+ }
68
+ interface TranscriptionJob {
69
+ requestId: string;
70
+ job_id: string;
71
+ status: JobStatus;
72
+ language: string;
73
+ detected_language: string | null;
74
+ text: string | null;
75
+ confidence: number | null;
76
+ duration_seconds: number | null;
77
+ credits_used: number | null;
78
+ created_at: string;
79
+ completed_at: string | null;
80
+ }
81
+
82
+ declare class ASRModule extends BaseModule {
83
+ transcribe(params: TranscribeUrlParams): Promise<TranscriptionJob>;
84
+ transcribeFile(filePath: string, params?: TranscribeFileParams): Promise<TranscriptionJob>;
85
+ getResult(jobId: string): Promise<TranscriptionJob>;
86
+ list(params?: ListTranscriptionsParams): Promise<PaginatedResponse<TranscriptionJob>>;
87
+ poll(jobId: string, options?: PollOptions): Promise<TranscriptionJob>;
88
+ }
89
+
90
+ interface ListVoicesParams {
91
+ language?: SupportedLanguage;
92
+ }
93
+ interface Voice {
94
+ id: string;
95
+ name: string;
96
+ gender: "male" | "female";
97
+ language: string;
98
+ style: string;
99
+ sample_url: string;
100
+ }
101
+ interface VoiceListResponse {
102
+ voices: Voice[];
103
+ }
104
+ interface TtsGenerateParams {
105
+ text: string;
106
+ voice_id: string;
107
+ language: SupportedLanguage;
108
+ speed?: number;
109
+ output_format?: OutputAudioFormat;
110
+ }
111
+ interface TtsGenerateResponse {
112
+ requestId: string;
113
+ id: string;
114
+ audio_url: string;
115
+ duration_seconds: number | null;
116
+ characters: number;
117
+ credits_used: number;
118
+ language: string;
119
+ voice_id: string;
120
+ created_at: string;
121
+ }
122
+
123
+ declare class TTSModule extends BaseModule {
124
+ listVoices(params?: ListVoicesParams): Promise<VoiceListResponse>;
125
+ generate(params: TtsGenerateParams): Promise<TtsGenerateResponse>;
126
+ }
127
+
128
+ interface AnimateGenerateParams {
129
+ image_url: string;
130
+ audio_url: string;
131
+ output_format?: OutputVideoFormat;
132
+ }
133
+ interface AnimateJobResponse {
134
+ requestId: string;
135
+ job_id: string;
136
+ status: "queued";
137
+ estimated_credits: number;
138
+ created_at: string;
139
+ }
140
+ interface AnimateResultResponse {
141
+ requestId: string;
142
+ job_id: string;
143
+ status: JobStatus;
144
+ video_url: string | null;
145
+ duration_seconds: number | null;
146
+ credits_used: number | null;
147
+ created_at: string;
148
+ completed_at: string | null;
149
+ error: string | null;
150
+ }
151
+
152
+ declare class AnimateModule extends BaseModule {
153
+ generate(params: AnimateGenerateParams): Promise<AnimateJobResponse>;
154
+ getResult(jobId: string): Promise<AnimateResultResponse>;
155
+ poll(jobId: string, options?: PollOptions): Promise<AnimateResultResponse>;
156
+ }
157
+
158
+ type ExplainAction = "explain" | "summarize" | "translate" | "simplify";
159
+ interface ExplainParams {
160
+ text: string;
161
+ language: SupportedLanguage;
162
+ action: ExplainAction;
163
+ target_language?: SupportedLanguage;
164
+ max_tokens?: number;
165
+ }
166
+ interface ExplainResponse {
167
+ id: string;
168
+ action: ExplainAction;
169
+ language: string;
170
+ result: string;
171
+ tokens_used: number;
172
+ credits_used: number;
173
+ created_at: string;
174
+ }
175
+
176
+ declare class ExplainModule extends BaseModule {
177
+ process(params: ExplainParams): Promise<ExplainResponse>;
178
+ }
179
+
180
+ interface UsageBalanceResponse {
181
+ account_id: string;
182
+ tier: AccountTier;
183
+ credits_remaining: number;
184
+ credits_used: number;
185
+ credits_total?: number;
186
+ credits_expire: string | null;
187
+ created_at: string;
188
+ }
189
+ interface UsageBreakdownParams {
190
+ start_date: string;
191
+ end_date: string;
192
+ module?: UsageModule$1;
193
+ }
194
+ interface UsageBreakdownEntry {
195
+ module: UsageModule$1;
196
+ requests: number;
197
+ credits_used: number;
198
+ }
199
+ interface UsageBreakdownResponse {
200
+ breakdown: UsageBreakdownEntry[];
201
+ total_requests: number;
202
+ total_credits_used: number;
203
+ }
204
+
205
+ declare class UsageModule extends BaseModule {
206
+ getBalance(): Promise<UsageBalanceResponse>;
207
+ getBreakdown(params: UsageBreakdownParams): Promise<UsageBreakdownResponse>;
208
+ }
209
+
210
+ interface VoiceMakerConfig {
211
+ apiKey: string;
212
+ baseUrl?: string;
213
+ timeoutMs?: number;
214
+ }
215
+ declare class VoiceMaker {
216
+ readonly tts: TTSModule;
217
+ readonly asr: ASRModule;
218
+ readonly animate: AnimateModule;
219
+ readonly explain: ExplainModule;
220
+ readonly usage: UsageModule;
221
+ constructor(config: VoiceMakerConfig);
222
+ }
223
+
224
+ interface ApiErrorIssue {
225
+ field: string;
226
+ code: string;
227
+ message: string;
228
+ }
229
+ interface ApiErrorBody {
230
+ error: string;
231
+ detail: string;
232
+ requestId?: string;
233
+ issues?: ApiErrorIssue[];
234
+ }
235
+ declare class VoiceMakerError extends Error {
236
+ constructor(message: string);
237
+ }
238
+ declare class VoiceMakerAPIError extends VoiceMakerError {
239
+ readonly status: number;
240
+ readonly error: string;
241
+ readonly detail: string;
242
+ readonly requestId: string | undefined;
243
+ readonly issues: ApiErrorIssue[] | undefined;
244
+ constructor(status: number, body: ApiErrorBody, message?: string);
245
+ }
246
+ declare class AuthenticationError extends VoiceMakerAPIError {
247
+ constructor(body: ApiErrorBody);
248
+ }
249
+ declare class InsufficientCreditsError extends VoiceMakerAPIError {
250
+ constructor(body: ApiErrorBody);
251
+ }
252
+ declare class PermissionError extends VoiceMakerAPIError {
253
+ constructor(body: ApiErrorBody);
254
+ }
255
+ declare class NotFoundError extends VoiceMakerAPIError {
256
+ constructor(body: ApiErrorBody);
257
+ }
258
+ declare class FileSizeLimitError extends VoiceMakerAPIError {
259
+ constructor(body: ApiErrorBody);
260
+ }
261
+ declare class UnsupportedMediaTypeError extends VoiceMakerAPIError {
262
+ constructor(body: ApiErrorBody);
263
+ }
264
+ declare class ValidationError extends VoiceMakerAPIError {
265
+ constructor(body: ApiErrorBody);
266
+ }
267
+ declare class RateLimitError extends VoiceMakerAPIError {
268
+ readonly retryAfter: number | undefined;
269
+ constructor(body: ApiErrorBody, retryAfter?: number);
270
+ }
271
+ declare class ServerError extends VoiceMakerAPIError {
272
+ constructor(status: number, body: ApiErrorBody);
273
+ }
274
+ declare class TimeoutError extends VoiceMakerError {
275
+ readonly jobId: string;
276
+ readonly timeoutMs: number;
277
+ constructor(jobId: string, timeoutMs: number);
278
+ }
279
+
280
+ export { type AccountTier, type AnimateGenerateParams, type AnimateJobResponse, type AnimateResultResponse, type ApiErrorBody, type ApiErrorIssue, AuthenticationError, type ExplainAction, type ExplainParams, type ExplainResponse, FileSizeLimitError, InsufficientCreditsError, type JobStatus, type ListTranscriptionsParams, type ListVoicesParams, NotFoundError, type OutputAudioFormat, type OutputVideoFormat, type PaginatedResponse, PermissionError, type PollOptions, RateLimitError, ServerError, type SupportedLanguage, TimeoutError, type TranscribeFileParams, type TranscribeUrlParams, type TranscriptionJob, type TtsGenerateParams, type TtsGenerateResponse, UnsupportedMediaTypeError, type UsageBalanceResponse, type UsageBreakdownEntry, type UsageBreakdownParams, type UsageBreakdownResponse, type UsageModule$1 as UsageModule, ValidationError, type Voice, type VoiceListResponse, VoiceMaker, VoiceMakerAPIError, type VoiceMakerConfig, VoiceMakerError };