@magic-ai-tools/ai-api-gateway-client 1.0.1

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 ADDED
@@ -0,0 +1,228 @@
1
+ # AI API Gateway Client
2
+
3
+ A type-safe TypeScript/JavaScript client SDK for the AI API Gateway.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install ai-api-gateway-client
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { createClient } from 'ai-api-gateway-client';
15
+
16
+ // Create a client instance
17
+ const client = createClient({
18
+ baseUrl: 'https://your-gateway.com',
19
+ apiKey: 'your-api-key',
20
+ system: 'your-system-code',
21
+ defaultWatermark: 'your-watermark' // Optional default watermark
22
+ });
23
+
24
+ // Generate an image with Flux 1 Schnell
25
+ const result = await client.fluxSchnell({
26
+ prompt: 'A beautiful sunset over the ocean',
27
+ aspectRatio: '16:9'
28
+ });
29
+
30
+ console.log('Task ID:', result.data.taskId);
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ | Option | Type | Required | Description |
36
+ |--------|------|----------|-------------|
37
+ | `baseUrl` | `string` | Yes | Base URL of the AI API Gateway |
38
+ | `apiKey` | `string` | Yes | API key for authentication |
39
+ | `system` | `string` | Yes | System identifier for your application |
40
+ | `defaultWatermark` | `string` | No | Default watermark text for all requests |
41
+
42
+ ## Available APIs
43
+
44
+ ### Image Generation
45
+
46
+ #### Flux 1 Schnell
47
+
48
+ Fast image generation with good quality.
49
+
50
+ ```typescript
51
+ const result = await client.fluxSchnell({
52
+ prompt: 'A cyberpunk cityscape at night',
53
+ aspectRatio: '16:9', // '1:1' | '16:9' | '9:16' | '3:2' | '2:3'
54
+ seed: 12345, // Optional: for reproducible results
55
+ watermarkText: 'custom-watermark', // Optional: override default
56
+ webHookUrl: 'https://your-webhook.com/callback' // Optional
57
+ });
58
+ ```
59
+
60
+ #### GPT Image 1
61
+
62
+ Advanced image generation and editing.
63
+
64
+ ```typescript
65
+ const result = await client.gptImage1({
66
+ prompt: 'A portrait in impressionist style',
67
+ size: '1024x1024', // Optional
68
+ variants: 2, // Optional: number of variants
69
+ urls: ['https://example.com/reference.jpg'], // Optional: reference images
70
+ watermarkText: 'custom-watermark',
71
+ webHookUrl: 'https://your-webhook.com/callback'
72
+ });
73
+ ```
74
+
75
+ #### Seedream 4
76
+
77
+ High-quality image generation with multiple variants.
78
+
79
+ ```typescript
80
+ const result = await client.seedream4({
81
+ prompt: 'A serene mountain landscape',
82
+ aspectRatio: '16:9', // '1:1' | '16:9' | '9:16' | '3:2' | '2:3' | '3:4' | '4:3' | '21:9'
83
+ resolution: '2K', // '1K' | '2K' | '4K'
84
+ variants: 3, // 1-6
85
+ urls: ['https://example.com/reference.jpg'], // Optional
86
+ watermarkText: 'custom-watermark',
87
+ webHookUrl: 'https://your-webhook.com/callback'
88
+ });
89
+ ```
90
+
91
+ #### Imagen 4 Ultra
92
+
93
+ Google's advanced image generation.
94
+
95
+ ```typescript
96
+ const result = await client.imagen4Ultra({
97
+ prompt: 'A photorealistic portrait',
98
+ aspectRatio: '1:1', // '1:1' | '16:9' | '9:16' | '4:3' | '3:4'
99
+ watermarkText: 'custom-watermark',
100
+ webHookUrl: 'https://your-webhook.com/callback'
101
+ });
102
+ ```
103
+
104
+ ### Image Transformation
105
+
106
+ #### Nano Banana
107
+
108
+ ```typescript
109
+ const result = await client.nanoBanana({
110
+ prompt: 'Transform to anime style',
111
+ aspectRatio: '1:1',
112
+ urls: ['https://example.com/source.jpg'],
113
+ watermarkText: 'custom-watermark',
114
+ webHookUrl: 'https://your-webhook.com/callback'
115
+ });
116
+ ```
117
+
118
+ #### Nano Banana Pro
119
+
120
+ Advanced transformation with resolution and format options.
121
+
122
+ ```typescript
123
+ const result = await client.nanoBananaPro({
124
+ prompt: 'Transform to watercolor painting',
125
+ aspectRatio: '1:1',
126
+ urls: ['https://example.com/source.jpg'],
127
+ resolution: '2K', // '1K' | '2K' | '4K'
128
+ outputFormat: 'png', // 'jpg' | 'png'
129
+ watermarkText: 'custom-watermark',
130
+ webHookUrl: 'https://your-webhook.com/callback'
131
+ });
132
+ ```
133
+
134
+ ### Image Processing
135
+
136
+ #### Remove Background
137
+
138
+ ```typescript
139
+ const result = await client.rmBg({
140
+ imageUrl: 'https://example.com/photo.jpg',
141
+ watermarkText: 'custom-watermark',
142
+ webHookUrl: 'https://your-webhook.com/callback'
143
+ });
144
+ ```
145
+
146
+ ### Task Management
147
+
148
+ #### Get Task
149
+
150
+ ```typescript
151
+ const task = await client.getTask('task-id-here');
152
+ console.log('Status:', task.data.status);
153
+ console.log('Outputs:', task.data.outputs);
154
+ ```
155
+
156
+ #### List Tasks
157
+
158
+ ```typescript
159
+ const tasks = await client.listTasks({
160
+ page: 1,
161
+ pageSize: 20
162
+ });
163
+
164
+ console.log('Total:', tasks.data.pagination.total);
165
+ tasks.data.tasks.forEach(task => {
166
+ console.log(`${task.id}: ${task.status}`);
167
+ });
168
+ ```
169
+
170
+ #### Retry Webhook
171
+
172
+ ```typescript
173
+ const result = await client.retryWebhook('task-id-here');
174
+ console.log('Webhook status:', result.data.webHookStatus);
175
+ ```
176
+
177
+ ## Error Handling
178
+
179
+ The client throws `AiApiGatewayError` for API errors:
180
+
181
+ ```typescript
182
+ import { createClient, AiApiGatewayError } from 'ai-api-gateway-client';
183
+
184
+ try {
185
+ const result = await client.fluxSchnell({
186
+ prompt: 'A beautiful sunset',
187
+ aspectRatio: '16:9'
188
+ });
189
+ } catch (error) {
190
+ if (AiApiGatewayError.isAiApiGatewayError(error)) {
191
+ console.error('API Error:', error.message);
192
+ console.error('Error Code:', error.code);
193
+ console.error('Status Code:', error.statusCode);
194
+ console.error('Response:', error.response);
195
+ } else {
196
+ throw error;
197
+ }
198
+ }
199
+ ```
200
+
201
+ ## TypeScript Support
202
+
203
+ The client is written in TypeScript and provides full type definitions:
204
+
205
+ ```typescript
206
+ import type {
207
+ ClientConfig,
208
+ ApiResponse,
209
+ TaskResponse,
210
+ Task,
211
+ FluxSchnellParams,
212
+ GptImage1Params,
213
+ // ... other types
214
+ } from 'ai-api-gateway-client';
215
+ ```
216
+
217
+ ## Release
218
+
219
+ ```bash
220
+ npm run build
221
+ npm login
222
+ npm publish --access public
223
+ ```
224
+
225
+ ## License
226
+
227
+ MIT
228
+
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Custom error class for AI API Gateway client errors
3
+ */
4
+ export declare class AiApiGatewayError extends Error {
5
+ /** Error code from the API response */
6
+ readonly code: string;
7
+ /** HTTP status code */
8
+ readonly statusCode: number;
9
+ /** Original API response data (if available) */
10
+ readonly response?: unknown;
11
+ constructor(message: string, code?: string, statusCode?: number, response?: unknown);
12
+ /**
13
+ * Check if an error is an AiApiGatewayError
14
+ */
15
+ static isAiApiGatewayError(error: unknown): error is AiApiGatewayError;
16
+ }
17
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,uCAAuC;IACvC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,uBAAuB;IACvB,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,gDAAgD;IAChD,SAAgB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAGjC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAwB,EAC9B,UAAU,GAAE,MAAY,EACxB,QAAQ,CAAC,EAAE,OAAO;IAcpB;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB;CAGvE"}
package/dist/errors.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Custom error class for AI API Gateway client errors
3
+ */
4
+ export class AiApiGatewayError extends Error {
5
+ /** Error code from the API response */
6
+ code;
7
+ /** HTTP status code */
8
+ statusCode;
9
+ /** Original API response data (if available) */
10
+ response;
11
+ constructor(message, code = 'UNKNOWN_ERROR', statusCode = 500, response) {
12
+ super(message);
13
+ this.name = 'AiApiGatewayError';
14
+ this.code = code;
15
+ this.statusCode = statusCode;
16
+ this.response = response;
17
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
18
+ if (Error.captureStackTrace) {
19
+ Error.captureStackTrace(this, AiApiGatewayError);
20
+ }
21
+ }
22
+ /**
23
+ * Check if an error is an AiApiGatewayError
24
+ */
25
+ static isAiApiGatewayError(error) {
26
+ return error instanceof AiApiGatewayError;
27
+ }
28
+ }
29
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,uCAAuC;IACvB,IAAI,CAAS;IAC7B,uBAAuB;IACP,UAAU,CAAS;IACnC,gDAAgD;IAChC,QAAQ,CAAW;IAEnC,YACE,OAAe,EACf,OAAe,eAAe,EAC9B,aAAqB,GAAG,EACxB,QAAkB;QAElB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,qFAAqF;QACrF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAc;QACvC,OAAO,KAAK,YAAY,iBAAiB,CAAC;IAC5C,CAAC;CACF"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * AI API Gateway Client SDK
3
+ *
4
+ * A type-safe client for interacting with the AI API Gateway.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { createClient } from 'ai-api-gateway-client';
9
+ *
10
+ * const client = createClient({
11
+ * baseUrl: 'https://your-gateway.com',
12
+ * apiKey: 'your-api-key',
13
+ * system: 'your-system-code',
14
+ * defaultWatermark: 'your-watermark'
15
+ * });
16
+ *
17
+ * const result = await client.fluxSchnell({
18
+ * prompt: 'A beautiful sunset',
19
+ * aspectRatio: '16:9'
20
+ * });
21
+ * ```
22
+ */
23
+ import type { ClientConfig, ApiResponse, TaskResponse, Task, TasksListResponse, WebhookRetryResponse, FluxSchnellParams, GptImage1Params, NanoBananaParams, NanoBananaProParams, RmBgParams, Seedream4Params, Imagen4UltraParams, FaceSwapParams, PaginationParams } from './types.js';
24
+ export * from './types.js';
25
+ export { AiApiGatewayError } from './errors.js';
26
+ /**
27
+ * AI API Gateway Client instance
28
+ */
29
+ export interface AiApiGatewayClient {
30
+ /**
31
+ * Generate an image using Flux 1 Schnell model
32
+ * Fast image generation with good quality
33
+ */
34
+ fluxSchnell(params: FluxSchnellParams): Promise<ApiResponse<TaskResponse>>;
35
+ /**
36
+ * Generate or edit an image using GPT Image 1 model
37
+ * Supports image generation and editing with reference images
38
+ */
39
+ gptImage1(params: GptImage1Params): Promise<ApiResponse<TaskResponse>>;
40
+ /**
41
+ * Transform an image using Nano Banana model
42
+ */
43
+ nanoBanana(params: NanoBananaParams): Promise<ApiResponse<TaskResponse>>;
44
+ /**
45
+ * Transform an image using Nano Banana Pro model
46
+ * Advanced transformation with resolution and format options
47
+ */
48
+ nanoBananaPro(params: NanoBananaProParams): Promise<ApiResponse<TaskResponse>>;
49
+ /**
50
+ * Remove background from an image
51
+ */
52
+ rmBg(params: RmBgParams): Promise<ApiResponse<TaskResponse>>;
53
+ /**
54
+ * Generate an image using Seedream 4 model
55
+ * High-quality image generation with multiple variants
56
+ */
57
+ seedream4(params: Seedream4Params): Promise<ApiResponse<TaskResponse>>;
58
+ /**
59
+ * Generate an image using Imagen 4 Ultra model
60
+ * Google's advanced image generation
61
+ */
62
+ imagen4Ultra(params: Imagen4UltraParams): Promise<ApiResponse<TaskResponse>>;
63
+ /**
64
+ * Swap faces between images using AI
65
+ * Requires at least 2 images
66
+ */
67
+ faceSwap(params: FaceSwapParams): Promise<ApiResponse<TaskResponse>>;
68
+ /**
69
+ * Get a task by ID
70
+ */
71
+ getTask(taskId: string): Promise<ApiResponse<Task>>;
72
+ /**
73
+ * List all tasks with pagination
74
+ */
75
+ listTasks(params?: PaginationParams): Promise<ApiResponse<TasksListResponse>>;
76
+ /**
77
+ * Retry sending a webhook for a task
78
+ */
79
+ retryWebhook(taskId: string): Promise<ApiResponse<WebhookRetryResponse>>;
80
+ }
81
+ /**
82
+ * Create an AI API Gateway client instance
83
+ *
84
+ * @param config - Client configuration
85
+ * @returns AI API Gateway client instance
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const client = createClient({
90
+ * baseUrl: 'https://your-gateway.com',
91
+ * apiKey: 'your-api-key',
92
+ * system: 'your-system-code',
93
+ * defaultWatermark: 'your-watermark'
94
+ * });
95
+ * ```
96
+ */
97
+ export declare function createClient(config: ClientConfig): AiApiGatewayClient;
98
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAGpB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;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AAY,GAAG,kBAAkB,CAkNrE"}
package/dist/index.js ADDED
@@ -0,0 +1,203 @@
1
+ /**
2
+ * AI API Gateway Client SDK
3
+ *
4
+ * A type-safe client for interacting with the AI API Gateway.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { createClient } from 'ai-api-gateway-client';
9
+ *
10
+ * const client = createClient({
11
+ * baseUrl: 'https://your-gateway.com',
12
+ * apiKey: 'your-api-key',
13
+ * system: 'your-system-code',
14
+ * defaultWatermark: 'your-watermark'
15
+ * });
16
+ *
17
+ * const result = await client.fluxSchnell({
18
+ * prompt: 'A beautiful sunset',
19
+ * aspectRatio: '16:9'
20
+ * });
21
+ * ```
22
+ */
23
+ import { AiApiGatewayError } from './errors.js';
24
+ // Re-export types for convenience
25
+ export * from './types.js';
26
+ export { AiApiGatewayError } from './errors.js';
27
+ /**
28
+ * Create an AI API Gateway client instance
29
+ *
30
+ * @param config - Client configuration
31
+ * @returns AI API Gateway client instance
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const client = createClient({
36
+ * baseUrl: 'https://your-gateway.com',
37
+ * apiKey: 'your-api-key',
38
+ * system: 'your-system-code',
39
+ * defaultWatermark: 'your-watermark'
40
+ * });
41
+ * ```
42
+ */
43
+ export function createClient(config) {
44
+ const { baseUrl, apiKey, system, defaultWatermark } = config;
45
+ // Remove trailing slash from baseUrl if present
46
+ const normalizedBaseUrl = baseUrl.replace(/\/$/, '');
47
+ /**
48
+ * Make a POST request to the API
49
+ */
50
+ async function post(endpoint, body) {
51
+ const response = await fetch(`${normalizedBaseUrl}${endpoint}`, {
52
+ method: 'POST',
53
+ headers: {
54
+ 'Content-Type': 'application/json',
55
+ 'Authorization': apiKey,
56
+ },
57
+ body: JSON.stringify(body),
58
+ });
59
+ const data = (await response.json());
60
+ if (!data.success) {
61
+ throw new AiApiGatewayError(data.message || 'Unknown API error', data.code || 'UNKNOWN_ERROR', response.status, data);
62
+ }
63
+ return data;
64
+ }
65
+ /**
66
+ * Make a GET request to the API
67
+ */
68
+ async function get(endpoint, params) {
69
+ const url = new URL(`${normalizedBaseUrl}${endpoint}`);
70
+ if (params) {
71
+ Object.entries(params).forEach(([key, value]) => {
72
+ if (value !== undefined) {
73
+ url.searchParams.set(key, String(value));
74
+ }
75
+ });
76
+ }
77
+ const response = await fetch(url.toString(), {
78
+ method: 'GET',
79
+ headers: {
80
+ 'Content-Type': 'application/json',
81
+ 'Authorization': apiKey,
82
+ },
83
+ });
84
+ const data = (await response.json());
85
+ if (!data.success) {
86
+ throw new AiApiGatewayError(data.message || 'Unknown API error', data.code || 'UNKNOWN_ERROR', response.status, data);
87
+ }
88
+ return data;
89
+ }
90
+ /**
91
+ * Get watermark text, preferring params over default
92
+ */
93
+ function getWatermark(paramsWatermark) {
94
+ const watermark = paramsWatermark ?? defaultWatermark;
95
+ if (!watermark) {
96
+ throw new AiApiGatewayError('watermarkText is required. Either provide it in the request params or set defaultWatermark in client config.', 'MISSING_WATERMARK', 400);
97
+ }
98
+ return watermark;
99
+ }
100
+ return {
101
+ async fluxSchnell(params) {
102
+ const { prompt, aspectRatio, seed, watermarkText, webHookUrl } = params;
103
+ return post('/flux-1-schnell', {
104
+ system,
105
+ watermarkText: getWatermark(watermarkText),
106
+ prompt,
107
+ aspectRatio,
108
+ ...(seed !== undefined && { seed }),
109
+ ...(webHookUrl && { webHookUrl }),
110
+ });
111
+ },
112
+ async gptImage1(params) {
113
+ const { prompt, size, variants, urls, watermarkText, webHookUrl } = params;
114
+ return post('/gpt-image-1', {
115
+ system,
116
+ watermarkText: getWatermark(watermarkText),
117
+ prompt,
118
+ ...(size && { size }),
119
+ ...(variants !== undefined && { variants }),
120
+ ...(urls && { urls }),
121
+ ...(webHookUrl && { webHookUrl }),
122
+ });
123
+ },
124
+ async nanoBanana(params) {
125
+ const { prompt, aspectRatio, urls, watermarkText, webHookUrl } = params;
126
+ return post('/nano-banana', {
127
+ system,
128
+ watermarkText: getWatermark(watermarkText),
129
+ prompt,
130
+ ...(aspectRatio && { aspectRatio }),
131
+ ...(urls && { urls }),
132
+ ...(webHookUrl && { webHookUrl }),
133
+ });
134
+ },
135
+ async nanoBananaPro(params) {
136
+ const { prompt, aspectRatio, urls, resolution, outputFormat, watermarkText, webHookUrl } = params;
137
+ return post('/nano-banana-pro', {
138
+ system,
139
+ watermarkText: getWatermark(watermarkText),
140
+ prompt,
141
+ ...(aspectRatio && { aspectRatio }),
142
+ ...(urls && { urls }),
143
+ ...(resolution && { resolution }),
144
+ ...(outputFormat && { outputFormat }),
145
+ ...(webHookUrl && { webHookUrl }),
146
+ });
147
+ },
148
+ async rmBg(params) {
149
+ const { imageUrl, watermarkText, webHookUrl } = params;
150
+ return post('/rm-bg', {
151
+ system,
152
+ watermarkText: getWatermark(watermarkText),
153
+ imageUrl,
154
+ ...(webHookUrl && { webHookUrl }),
155
+ });
156
+ },
157
+ async seedream4(params) {
158
+ const { prompt, aspectRatio, resolution, variants, urls, watermarkText, webHookUrl } = params;
159
+ return post('/seedream-v4', {
160
+ system,
161
+ watermarkText: getWatermark(watermarkText),
162
+ prompt,
163
+ aspectRatio,
164
+ resolution,
165
+ variants,
166
+ ...(urls && { urls }),
167
+ ...(webHookUrl && { webHookUrl }),
168
+ });
169
+ },
170
+ async imagen4Ultra(params) {
171
+ const { prompt, aspectRatio, watermarkText, webHookUrl } = params;
172
+ return post('/imagen4-ultra', {
173
+ system,
174
+ watermarkText: getWatermark(watermarkText),
175
+ prompt,
176
+ aspectRatio,
177
+ ...(webHookUrl && { webHookUrl }),
178
+ });
179
+ },
180
+ async faceSwap(params) {
181
+ const { imageUrls, watermarkText, webHookUrl } = params;
182
+ return post('/face-swap', {
183
+ system,
184
+ watermarkText: getWatermark(watermarkText),
185
+ imageUrls,
186
+ ...(webHookUrl && { webHookUrl }),
187
+ });
188
+ },
189
+ async getTask(taskId) {
190
+ return get(`/tasks/${taskId}`);
191
+ },
192
+ async listTasks(params) {
193
+ return get('/tasks', {
194
+ page: params?.page,
195
+ pageSize: params?.pageSize,
196
+ });
197
+ },
198
+ async retryWebhook(taskId) {
199
+ return post(`/webhook/retry/${taskId}`, {});
200
+ },
201
+ };
202
+ }
203
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAmBhD,kCAAkC;AAClC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAoEhD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAE7D,gDAAgD;IAChD,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAErD;;OAEG;IACH,KAAK,UAAU,IAAI,CACjB,QAAgB,EAChB,IAA6B;QAE7B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,iBAAiB,GAAG,QAAQ,EAAE,EAAE;YAC9D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,MAAM;aACxB;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAmB,CAAC;QAEvD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,iBAAiB,CACzB,IAAI,CAAC,OAAO,IAAI,mBAAmB,EACnC,IAAI,CAAC,IAAI,IAAI,eAAe,EAC5B,QAAQ,CAAC,MAAM,EACf,IAAI,CACL,CAAC;QACJ,CAA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kB,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACpE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * AI API Gateway Client Types
3
+ *
4
+ * These types mirror the server-side schemas but are independent
5
+ * to avoid runtime dependencies on server code.
6
+ */
7
+ export interface ClientConfig {
8
+ /** Base URL of the AI API Gateway (e.g., 'https://your-gateway.com') */
9
+ baseUrl: string;
10
+ /** API key for authentication */
11
+ apiKey: string;
12
+ /** System identifier for your application */
13
+ system: string;
14
+ /** Default watermark text (optional, can be overridden per request) */
15
+ defaultWatermark?: string;
16
+ }
17
+ export interface ApiResponse<T = unknown> {
18
+ success: boolean;
19
+ message: string;
20
+ code?: string;
21
+ data: T;
22
+ }
23
+ export interface TaskResponse {
24
+ taskId: string;
25
+ }
26
+ export interface Task {
27
+ id: string;
28
+ system: string;
29
+ watermarkText: string | null;
30
+ retryCount: number;
31
+ failureType: string | null;
32
+ model: string;
33
+ inputs: string;
34
+ outputs: string | null;
35
+ status: 'running' | 'success' | 'failed';
36
+ message: string | null;
37
+ provider: string;
38
+ providerTaskId: string | null;
39
+ webHookUrl: string | null;
40
+ webHookStatus: string | null;
41
+ webHookAttemptCount: number | null;
42
+ webHookResponse: string | null;
43
+ webHookNextRetryAt: string | null;
44
+ createdAt: string;
45
+ updatedAt: string | null;
46
+ }
47
+ export interface TasksListResponse {
48
+ tasks: Task[];
49
+ pagination: {
50
+ page: number;
51
+ pageSize: number;
52
+ total: number;
53
+ totalPages: number;
54
+ };
55
+ }
56
+ export interface WebhookRetryResponse {
57
+ taskId: string;
58
+ webHookStatus: string | null;
59
+ webHookAttemptCount: number | null;
60
+ webHookResponse: string | null;
61
+ }
62
+ /** Flux 1 Schnell - Fast image generation */
63
+ export interface FluxSchnellParams {
64
+ /** Text prompt describing the image to generate */
65
+ prompt: string;
66
+ /** Aspect ratio of the generated image */
67
+ aspectRatio: '1:1' | '16:9' | '9:16' | '3:2' | '2:3';
68
+ /** Optional seed for reproducible results */
69
+ seed?: number;
70
+ /** Optional watermark text (overrides default) */
71
+ watermarkText?: string;
72
+ /** Optional webhook URL for async notifications */
73
+ webHookUrl?: string;
74
+ }
75
+ /** GPT Image 1 - Advanced image generation/editing */
76
+ export interface GptImage1Params {
77
+ /** Text prompt describing the image to generate */
78
+ prompt: string;
79
+ /** Size of the generated image (e.g., '1024x1024') */
80
+ size?: string;
81
+ /** Number of image variants to generate */
82
+ variants?: number;
83
+ /** Optional reference image URLs for editing */
84
+ urls?: string[];
85
+ /** Optional watermark text (overrides default) */
86
+ watermarkText?: string;
87
+ /** Optional webhook URL for async notifications */
88
+ webHookUrl?: string;
89
+ }
90
+ /** Nano Banana - Image transformation */
91
+ export interface NanoBananaParams {
92
+ /** Text prompt describing the transformation */
93
+ prompt: string;
94
+ /** Aspect ratio of the output image */
95
+ aspectRatio?: string;
96
+ /** Input image URLs to transform */
97
+ urls?: string[];
98
+ /** Optional watermark text (overrides default) */
99
+ watermarkText?: string;
100
+ /** Optional webhook URL for async notifications */
101
+ webHookUrl?: string;
102
+ }
103
+ /** Nano Banana Pro - Advanced image transformation */
104
+ export interface NanoBananaProParams {
105
+ /** Text prompt describing the transformation */
106
+ prompt: string;
107
+ /** Aspect ratio of the output image */
108
+ aspectRatio?: string;
109
+ /** Input image URLs to transform */
110
+ urls?: string[];
111
+ /** Output resolution */
112
+ resolution?: '1K' | '2K' | '4K';
113
+ /** Output image format */
114
+ outputFormat?: 'jpg' | 'png';
115
+ /** Optional watermark text (overrides default) */
116
+ watermarkText?: string;
117
+ /** Optional webhook URL for async notifications */
118
+ webHookUrl?: string;
119
+ }
120
+ /** Remove Background - Background removal */
121
+ export interface RmBgParams {
122
+ /** URL of the image to remove background from */
123
+ imageUrl: string;
124
+ /** Optional watermark text (overrides default) */
125
+ watermarkText?: string;
126
+ /** Optional webhook URL for async notifications */
127
+ webHookUrl?: string;
128
+ }
129
+ /** Seedream 4 - High-quality image generation */
130
+ export interface Seedream4Params {
131
+ /** Text prompt describing the image to generate */
132
+ prompt: string;
133
+ /** Aspect ratio of the generated image */
134
+ aspectRatio: '1:1' | '16:9' | '9:16' | '3:2' | '2:3' | '3:4' | '4:3' | '21:9';
135
+ /** Output resolution */
136
+ resolution: '1K' | '2K' | '4K';
137
+ /** Number of image variants to generate (1-6) */
138
+ variants: number;
139
+ /** Optional reference image URLs */
140
+ urls?: string[];
141
+ /** Optional watermark text (overrides default) */
142
+ watermarkText?: string;
143
+ /** Optional webhook URL for async notifications */
144
+ webHookUrl?: string;
145
+ }
146
+ /** Imagen 4 Ultra - Google's advanced image generation */
147
+ export interface Imagen4UltraParams {
148
+ /** Text prompt describing the image to generate */
149
+ prompt: string;
150
+ /** Aspect ratio of the generated image */
151
+ aspectRatio: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
152
+ /** Optional watermark text (overrides default) */
153
+ watermarkText?: string;
154
+ /** Optional webhook URL for async notifications */
155
+ webHookUrl?: string;
156
+ }
157
+ /** Face Swap - AI face swapping */
158
+ export interface FaceSwapParams {
159
+ /** Image URLs for face swap (at least 2 images required) */
160
+ imageUrls: string[];
161
+ /** Optional watermark text (overrides default) */
162
+ watermarkText?: string;
163
+ /** Optional webhook URL for async notifications */
164
+ webHookUrl?: string;
165
+ }
166
+ /** Pagination parameters for listing tasks */
167
+ export interface PaginationParams {
168
+ /** Page number (1-based) */
169
+ page?: number;
170
+ /** Number of items per page (1-100) */
171
+ pageSize?: number;
172
+ }
173
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,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,KAAK,CAAC;IACrD,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * AI API Gateway Client Types
3
+ *
4
+ * These types mirror the server-side schemas but are independent
5
+ * to avoid runtime dependencies on server code.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@magic-ai-tools/ai-api-gateway-client",
3
+ "version": "1.0.1",
4
+ "description": "TypeScript client SDK for AI API Gateway",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "prepublishOnly": "npm run build"
22
+ },
23
+ "keywords": [],
24
+ "author": "",
25
+ "license": "MIT",
26
+ "devDependencies": {
27
+ "typescript": "^5.8.3"
28
+ },
29
+ "engines": {
30
+ "node": ">=18"
31
+ }
32
+ }
33
+