@kvidai/sdk 0.2.1 → 0.3.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.
- package/README.md +168 -0
- package/dist/esm/index.js +33 -56
- package/dist/index.d.ts +49 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -56
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# @kvidai/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the [kvidai](https://kvid.ai) AI video platform — auth, AI video/image/voice generation, media upload, presets, and the conversational agent.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm i @kvidai/sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Works in Node.js and React Native (uses global `fetch` / `AbortSignal`; no Node‑only APIs).
|
|
10
|
+
|
|
11
|
+
## Credentials
|
|
12
|
+
|
|
13
|
+
kvidai uses two credentials:
|
|
14
|
+
|
|
15
|
+
- **Strapi JWT** — identity: login + api‑key management (`console.kvid.ai`). Get it with `auth.login()`.
|
|
16
|
+
- **API key** (32‑hex) — generation, media, preset, agent (`api.kvid.ai`). Get/create it via the [dashboard](https://kvid.ai) or the `auth.loginAndGetApiKey()` shortcut.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { KvidaiClient } from '@kvidai/sdk';
|
|
20
|
+
|
|
21
|
+
// Default: targets api.kvid.ai (generation) and console.kvid.ai (auth).
|
|
22
|
+
const client = new KvidaiClient({
|
|
23
|
+
// jwt: '<strapi-jwt>', // for auth/key management
|
|
24
|
+
// apiKey: '<api-key>', // for generation/media/preset/agent
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick start — generate a video
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const client = new KvidaiClient({});
|
|
32
|
+
|
|
33
|
+
// 1. Log in and get an API key in one call
|
|
34
|
+
const { apiKey, user } = await client.auth.loginAndGetApiKey('you@example.com', 'password');
|
|
35
|
+
client.setCredentials({ apiKey });
|
|
36
|
+
|
|
37
|
+
// 2. Create a generation job
|
|
38
|
+
const { requestId, model } = await client.generation.textToVideo({
|
|
39
|
+
model: 'wan',
|
|
40
|
+
prompt: 'A cat walking on a sunny beach, cinematic',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// 3. Poll to completion and get the result URL
|
|
44
|
+
const result = await client.generation.waitForResult({ requestId, model });
|
|
45
|
+
console.log(result.url); // https://cdn.kvid.ai/...
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`waitForResult` encapsulates the real polling policy: 3 s interval, up to 200 attempts, tolerates up to 5 consecutive 5xx, and a 90 s result fetch for the fal→CDN upload. Pass `{ signal }` to cancel, or override `pollIntervalMs` / `maxAttempts`.
|
|
49
|
+
|
|
50
|
+
## Modules
|
|
51
|
+
|
|
52
|
+
### `client.auth` (Strapi JWT)
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const { jwt, user } = await client.auth.login({ identifier, password });
|
|
56
|
+
await client.auth.me();
|
|
57
|
+
await client.auth.products(); // available api products
|
|
58
|
+
await client.auth.listKeys(); // your api keys (masked)
|
|
59
|
+
await client.auth.keyDetail(subscriptionId); // full key
|
|
60
|
+
await client.auth.generateKey({ email, productId });
|
|
61
|
+
await client.auth.regenerateKey({ subscriptionId, email });
|
|
62
|
+
await client.auth.revokeKey(subscriptionId);
|
|
63
|
+
await client.auth.creditSummary(email);
|
|
64
|
+
await client.auth.loginAndGetApiKey(identifier, password); // login + reuse/create key
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `client.generation` (api‑key)
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
client.generation.textToVideo({ model, prompt, ... });
|
|
71
|
+
client.generation.imageToVideo({ model, image_url, ... });
|
|
72
|
+
client.generation.referenceToVideo({ model, ... });
|
|
73
|
+
client.generation.videoToVideo({ model, input_video_url, ... });
|
|
74
|
+
client.generation.textToImage({ model, prompt, ... }); // e.g. model: 'nano-banana'
|
|
75
|
+
client.generation.imageToImage({ model, image_url, ... });
|
|
76
|
+
client.generation.talkV2V({ model, audio_url, input_video /* or image_url */ });
|
|
77
|
+
client.generation.voice({ model, text });
|
|
78
|
+
|
|
79
|
+
client.generation.status(requestId); // one status poll
|
|
80
|
+
client.generation.waitForResult({ requestId, model }); // poll → result
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Create methods return `{ requestId, model }`. `waitForResult` returns `{ url, requestId, model }`.
|
|
84
|
+
|
|
85
|
+
### `client.media` (api‑key)
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const cdnUrl = await client.media.upload(file); // presign → PUT → CDN url (browser File; <90 MB)
|
|
89
|
+
// or the low-level steps:
|
|
90
|
+
const presigned = await client.media.presign({ filename, mimeType, size });
|
|
91
|
+
// PUT your bytes to presigned.uploadUrl yourself (useful on React Native)
|
|
92
|
+
await client.media.completeUpload({ ... });
|
|
93
|
+
await client.media.list();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
On React Native (no `File`), use `presign()` + your own `fetch(uploadUrl, { method: 'PUT', body })` + `completeUpload()`.
|
|
97
|
+
|
|
98
|
+
### `client.preset` (api‑key)
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
client.preset.list(); client.preset.get(id);
|
|
102
|
+
client.preset.create({ name, settings }); client.preset.update(id, { ... });
|
|
103
|
+
client.preset.delete(id); client.preset.duplicate(id);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `client.agent` — conversational video agent (SSE, api‑key)
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
const { projectId } = await client.agent.createProject('My video');
|
|
110
|
+
|
|
111
|
+
await client.agent.generate(
|
|
112
|
+
{ projectId, message: 'Make a 30s promo about coffee', chatHistory: [] },
|
|
113
|
+
(event) => console.log(event.type) // streamed events: tool_start, tool_end, done, error, ...
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const project = await client.agent.getProjectResult(projectId); // { renderUrl, sceneCount, composition }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Error handling
|
|
120
|
+
|
|
121
|
+
Every failure throws a typed `KvidaiError`:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { KvidaiError } from '@kvidai/sdk';
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
await client.generation.waitForResult({ requestId, model });
|
|
128
|
+
} catch (err) {
|
|
129
|
+
if (err instanceof KvidaiError) {
|
|
130
|
+
console.error(err.code, err.status, err.message);
|
|
131
|
+
// codes: INSUFFICIENT_CREDITS | GENERATION_FAILED | CANCELLED | POLL_ERROR
|
|
132
|
+
// | FILE_TOO_LARGE | TIMEOUT | NO_PRODUCT | API_ERROR | ...
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Base URL override
|
|
138
|
+
|
|
139
|
+
By default the SDK targets `https://api.kvid.ai` (generation/media/preset/agent) and `https://console.kvid.ai` (auth). Override either URL for custom environments:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
const client = new KvidaiClient({
|
|
143
|
+
baseUrl: 'https://api.kvid.ai', // generation/media/preset/agent base
|
|
144
|
+
consoleBaseUrl: 'http://localhost:1337', // auth/key-management base
|
|
145
|
+
generationPath: '/ai/generation-clone', // override generation path prefix
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
| option | default | purpose |
|
|
150
|
+
| ------------------ | ------------------------- | -------------------------------------- |
|
|
151
|
+
| `baseUrl` | `https://api.kvid.ai` | generation, media, preset, agent calls |
|
|
152
|
+
| `consoleBaseUrl` | `https://console.kvid.ai` | auth (login, key management) calls |
|
|
153
|
+
| `generationPath` | `/ai/generation` | generation endpoint prefix |
|
|
154
|
+
| `mediaPath` | `/media` | media endpoint prefix |
|
|
155
|
+
| `presetPath` | `/preset` | preset endpoint prefix |
|
|
156
|
+
| `agentPath` | `/agent` | agent endpoint prefix |
|
|
157
|
+
| `videoProjectPath` | `/video-project` | video-project endpoint prefix |
|
|
158
|
+
|
|
159
|
+
**Note**: base URLs are not secrets — the actual security boundary is the api key. Set them in app environment config, not in the SDK bundle.
|
|
160
|
+
|
|
161
|
+
## Notes
|
|
162
|
+
|
|
163
|
+
- API keys are shown in full **only once** (on create/regenerate); store them securely. Regenerating a key invalidates the old one immediately.
|
|
164
|
+
- Generation is **polling‑based** (no webhooks): use `waitForResult`.
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|
package/dist/esm/index.js
CHANGED
|
@@ -2,52 +2,29 @@
|
|
|
2
2
|
* @kvidai/sdk — kvidai TypeScript SDK
|
|
3
3
|
*
|
|
4
4
|
* Covers the 4 core external-client flows documented in docs/external-client-guide.md:
|
|
5
|
-
* 1. Auth — login +
|
|
6
|
-
* 2. Generation — AI video/image/voice creation + status polling + result fetch (api.kvid.ai
|
|
7
|
-
* 3. Media — presigned upload → CDN URL (api.kvid.ai
|
|
8
|
-
* 4. Preset — CRUD (api.kvid.ai
|
|
5
|
+
* 1. Auth — login + api-key management (console.kvid.ai / Strapi JWT)
|
|
6
|
+
* 2. Generation — AI video/image/voice creation + status polling + result fetch (api.kvid.ai)
|
|
7
|
+
* 3. Media — presigned upload → CDN URL (api.kvid.ai)
|
|
8
|
+
* 4. Preset — CRUD (api.kvid.ai)
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
|
-
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<
|
|
11
|
+
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<api-key>' });
|
|
12
12
|
* const { requestId, model } = await client.generation.textToVideo({ prompt: '...', model: 'wan' });
|
|
13
13
|
* const result = await client.generation.waitForResult({ requestId, model });
|
|
14
14
|
*
|
|
15
15
|
* Canonical sources: docs/external-client-api-reference.md, docs/external-client-guide.md
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
staging: {
|
|
29
|
-
strapiBaseUrl: 'https://hometips-strapi-ts-staging1-405573518541.asia-northeast1.run.app',
|
|
30
|
-
apimBaseUrl: 'https://api.kvid.ai',
|
|
31
|
-
webBaseUrl: 'https://staging1.kvid.ai',
|
|
32
|
-
generationPath: '/ai/generation',
|
|
33
|
-
mediaPath: '/media',
|
|
34
|
-
presetPath: '/preset',
|
|
35
|
-
agentPath: '/agent',
|
|
36
|
-
videoProjectPath: '/video-project',
|
|
37
|
-
},
|
|
38
|
-
dev: {
|
|
39
|
-
strapiBaseUrl: 'http://localhost:1337',
|
|
40
|
-
apimBaseUrl: 'https://api.kvid.ai',
|
|
41
|
-
webBaseUrl: 'http://localhost:3000',
|
|
42
|
-
generationPath: '/ai/generation-clone',
|
|
43
|
-
mediaPath: '/media-dev',
|
|
44
|
-
presetPath: '/preset-dev',
|
|
45
|
-
// Agent + video-project use the same gateway paths across all envs (confirmed live 2026-10-30).
|
|
46
|
-
// No dev-clone equivalent exists for these endpoints.
|
|
47
|
-
agentPath: '/agent',
|
|
48
|
-
videoProjectPath: '/video-project',
|
|
49
|
-
},
|
|
50
|
-
};
|
|
17
|
+
function resolveUrls(opts) {
|
|
18
|
+
return {
|
|
19
|
+
consoleBaseUrl: opts.consoleBaseUrl ?? 'https://console.kvid.ai',
|
|
20
|
+
apiBaseUrl: opts.baseUrl ?? 'https://api.kvid.ai',
|
|
21
|
+
generationPath: opts.generationPath ?? '/ai/generation',
|
|
22
|
+
mediaPath: opts.mediaPath ?? '/media',
|
|
23
|
+
presetPath: opts.presetPath ?? '/preset',
|
|
24
|
+
agentPath: opts.agentPath ?? '/agent',
|
|
25
|
+
videoProjectPath: opts.videoProjectPath ?? '/video-project',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
51
28
|
export class KvidaiError extends Error {
|
|
52
29
|
constructor(code, message, status, details) {
|
|
53
30
|
super(message);
|
|
@@ -76,11 +53,7 @@ class Transport {
|
|
|
76
53
|
return headers;
|
|
77
54
|
}
|
|
78
55
|
async request(base, path, init = {}) {
|
|
79
|
-
const baseUrl = base === 'strapi'
|
|
80
|
-
? this.urls.strapiBaseUrl
|
|
81
|
-
: base === 'web'
|
|
82
|
-
? this.urls.webBaseUrl
|
|
83
|
-
: this.urls.apimBaseUrl;
|
|
56
|
+
const baseUrl = base === 'strapi' ? this.urls.consoleBaseUrl : this.urls.apiBaseUrl;
|
|
84
57
|
const authType = base === 'strapi' ? 'strapi' : 'apim';
|
|
85
58
|
let res;
|
|
86
59
|
try {
|
|
@@ -115,11 +88,7 @@ class Transport {
|
|
|
115
88
|
* No automatic timeout is applied since SSE streams are long-running.
|
|
116
89
|
*/
|
|
117
90
|
async requestText(base, path, init = {}) {
|
|
118
|
-
const baseUrl = base === 'strapi'
|
|
119
|
-
? this.urls.strapiBaseUrl
|
|
120
|
-
: base === 'web'
|
|
121
|
-
? this.urls.webBaseUrl
|
|
122
|
-
: this.urls.apimBaseUrl;
|
|
91
|
+
const baseUrl = base === 'strapi' ? this.urls.consoleBaseUrl : this.urls.apiBaseUrl;
|
|
123
92
|
const authType = base === 'strapi' ? 'strapi' : 'apim';
|
|
124
93
|
let res;
|
|
125
94
|
try {
|
|
@@ -168,7 +137,7 @@ class AuthModule {
|
|
|
168
137
|
async me() {
|
|
169
138
|
return this.t.request('strapi', '/api/users/me');
|
|
170
139
|
}
|
|
171
|
-
/** GET /api/apim-management/my-keys — list active keys (masked). */
|
|
140
|
+
/** GET /api/apim-management/my-keys — list active api keys (masked). */
|
|
172
141
|
async listKeys() {
|
|
173
142
|
const res = await this.t.request('strapi', '/api/apim-management/my-keys');
|
|
174
143
|
return Array.isArray(res) ? res : (res.data ?? []);
|
|
@@ -179,14 +148,14 @@ class AuthModule {
|
|
|
179
148
|
// Controller wraps in { data: ... }
|
|
180
149
|
return res.data ?? res;
|
|
181
150
|
}
|
|
182
|
-
/** GET /api/apim-management/products — available
|
|
151
|
+
/** GET /api/apim-management/products — available api products. */
|
|
183
152
|
async products() {
|
|
184
153
|
const res = await this.t.request('strapi', '/api/apim-management/products');
|
|
185
154
|
const data = res.data ?? res;
|
|
186
155
|
return data.products ?? [];
|
|
187
156
|
}
|
|
188
157
|
/**
|
|
189
|
-
* POST /api/apim-management/generate-key — issue a new
|
|
158
|
+
* POST /api/apim-management/generate-key — issue a new api key.
|
|
190
159
|
* ⚠️ primaryKey is shown only in this response — store it immediately.
|
|
191
160
|
*/
|
|
192
161
|
async generateKey(params) {
|
|
@@ -238,7 +207,7 @@ class AuthModule {
|
|
|
238
207
|
// No key — generate one
|
|
239
208
|
const products = await this.products();
|
|
240
209
|
if (!products.length)
|
|
241
|
-
throw new KvidaiError('NO_PRODUCT', 'No
|
|
210
|
+
throw new KvidaiError('NO_PRODUCT', 'No API products available', 404);
|
|
242
211
|
const { primaryKey } = await this.generateKey({ email: user.email, productId: products[0].id });
|
|
243
212
|
return { jwt, apiKey: primaryKey, user };
|
|
244
213
|
}
|
|
@@ -627,7 +596,7 @@ class AgentModule {
|
|
|
627
596
|
*
|
|
628
597
|
* @example
|
|
629
598
|
* // With existing credentials:
|
|
630
|
-
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<
|
|
599
|
+
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<api-key>' });
|
|
631
600
|
* const { requestId, model } = await client.generation.textToVideo({ prompt: 'Space', model: 'wan' });
|
|
632
601
|
* const result = await client.generation.waitForResult({ requestId, model });
|
|
633
602
|
*
|
|
@@ -636,11 +605,19 @@ class AgentModule {
|
|
|
636
605
|
* const client = new KvidaiClient({});
|
|
637
606
|
* const { jwt, apiKey } = await client.auth.loginAndGetApiKey('user@example.com', 'password');
|
|
638
607
|
* client.setCredentials({ jwt, apiKey });
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* // Custom base URL (for internal/dev environments):
|
|
611
|
+
* const client = new KvidaiClient({
|
|
612
|
+
* baseUrl: 'https://api.kvid.ai',
|
|
613
|
+
* consoleBaseUrl: 'http://localhost:1337',
|
|
614
|
+
* generationPath: '/ai/generation-clone',
|
|
615
|
+
* });
|
|
639
616
|
*/
|
|
640
617
|
export class KvidaiClient {
|
|
641
618
|
constructor(options = {}) {
|
|
642
|
-
this.opts = {
|
|
643
|
-
const urls =
|
|
619
|
+
this.opts = { timeoutMs: 30000, ...options };
|
|
620
|
+
const urls = resolveUrls(this.opts);
|
|
644
621
|
this.transport = new Transport(this.opts, urls);
|
|
645
622
|
this.auth = new AuthModule(this.transport, this.opts);
|
|
646
623
|
this.generation = new GenerationModule(this.transport, urls);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @kvidai/sdk — kvidai TypeScript SDK
|
|
3
3
|
*
|
|
4
4
|
* Covers the 4 core external-client flows documented in docs/external-client-guide.md:
|
|
5
|
-
* 1. Auth — login +
|
|
6
|
-
* 2. Generation — AI video/image/voice creation + status polling + result fetch (api.kvid.ai
|
|
7
|
-
* 3. Media — presigned upload → CDN URL (api.kvid.ai
|
|
8
|
-
* 4. Preset — CRUD (api.kvid.ai
|
|
5
|
+
* 1. Auth — login + api-key management (console.kvid.ai / Strapi JWT)
|
|
6
|
+
* 2. Generation — AI video/image/voice creation + status polling + result fetch (api.kvid.ai)
|
|
7
|
+
* 3. Media — presigned upload → CDN URL (api.kvid.ai)
|
|
8
|
+
* 4. Preset — CRUD (api.kvid.ai)
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
|
-
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<
|
|
11
|
+
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<api-key>' });
|
|
12
12
|
* const { requestId, model } = await client.generation.textToVideo({ prompt: '...', model: 'wan' });
|
|
13
13
|
* const result = await client.generation.waitForResult({ requestId, model });
|
|
14
14
|
*
|
|
@@ -17,24 +17,32 @@
|
|
|
17
17
|
export interface KvidaiClientOptions {
|
|
18
18
|
/** Strapi JWT — required for auth (login, key management). Obtain via `auth.login()`. */
|
|
19
19
|
jwt?: string;
|
|
20
|
-
/**
|
|
20
|
+
/** API key (32-hex) — required for generation, media, preset calls. Obtain from the dashboard or `auth.loginAndGetApiKey()`. */
|
|
21
21
|
apiKey?: string;
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/** Base URL for generation, media, preset and agent calls (default: 'https://api.kvid.ai'). */
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
/** Base URL for auth (login, key management) calls (default: 'https://console.kvid.ai'). */
|
|
25
|
+
consoleBaseUrl?: string;
|
|
26
|
+
/** Override generation endpoint path prefix (default: '/ai/generation'). */
|
|
27
|
+
generationPath?: string;
|
|
28
|
+
/** Override media endpoint path prefix (default: '/media'). */
|
|
29
|
+
mediaPath?: string;
|
|
30
|
+
/** Override preset endpoint path prefix (default: '/preset'). */
|
|
31
|
+
presetPath?: string;
|
|
32
|
+
/** Override agent endpoint path prefix (default: '/agent'). */
|
|
33
|
+
agentPath?: string;
|
|
34
|
+
/** Override video-project endpoint path prefix (default: '/video-project'). */
|
|
35
|
+
videoProjectPath?: string;
|
|
24
36
|
/** Per-request timeout ms (default: 30000). */
|
|
25
37
|
timeoutMs?: number;
|
|
26
38
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
apimBaseUrl: string;
|
|
31
|
-
webBaseUrl: string;
|
|
39
|
+
interface ResolvedUrls {
|
|
40
|
+
consoleBaseUrl: string;
|
|
41
|
+
apiBaseUrl: string;
|
|
32
42
|
generationPath: string;
|
|
33
43
|
mediaPath: string;
|
|
34
44
|
presetPath: string;
|
|
35
|
-
/** APIM path prefix for agent generate endpoint (e.g. /agent, /agent-dev). */
|
|
36
45
|
agentPath: string;
|
|
37
|
-
/** APIM path prefix for video-project endpoints (e.g. /video-project, /video-project-dev). */
|
|
38
46
|
videoProjectPath: string;
|
|
39
47
|
}
|
|
40
48
|
export declare class KvidaiError extends Error {
|
|
@@ -59,17 +67,17 @@ export interface LoginResponse {
|
|
|
59
67
|
email: string;
|
|
60
68
|
};
|
|
61
69
|
}
|
|
62
|
-
export interface
|
|
70
|
+
export interface ApiKeyItem {
|
|
63
71
|
subscriptionId: string;
|
|
64
72
|
state: 'active' | 'suspended' | 'cancelled';
|
|
65
73
|
primaryKey: string;
|
|
66
74
|
displayName?: string;
|
|
67
75
|
}
|
|
68
|
-
export interface
|
|
76
|
+
export interface ApiKeyDetail {
|
|
69
77
|
subscriptionId: string;
|
|
70
78
|
primaryKey: string;
|
|
71
79
|
}
|
|
72
|
-
export interface
|
|
80
|
+
export interface Product {
|
|
73
81
|
id: string;
|
|
74
82
|
name: string;
|
|
75
83
|
description?: string;
|
|
@@ -168,7 +176,7 @@ export interface WaitForResultOptions {
|
|
|
168
176
|
}
|
|
169
177
|
export interface PresignedUploadRequest {
|
|
170
178
|
filename: string;
|
|
171
|
-
/**
|
|
179
|
+
/** Media endpoint expects `mimeType` */
|
|
172
180
|
mimeType: string;
|
|
173
181
|
size?: number;
|
|
174
182
|
email?: string;
|
|
@@ -246,14 +254,14 @@ export interface AgentProjectResult {
|
|
|
246
254
|
declare class Transport {
|
|
247
255
|
private readonly options;
|
|
248
256
|
private readonly urls;
|
|
249
|
-
constructor(options: KvidaiClientOptions, urls:
|
|
257
|
+
constructor(options: KvidaiClientOptions, urls: ResolvedUrls);
|
|
250
258
|
private buildHeaders;
|
|
251
|
-
request<T>(base: 'strapi' | 'apim'
|
|
259
|
+
request<T>(base: 'strapi' | 'apim', path: string, init?: RequestInit): Promise<T>;
|
|
252
260
|
/**
|
|
253
261
|
* Like request() but returns the raw text body — for SSE streams.
|
|
254
262
|
* No automatic timeout is applied since SSE streams are long-running.
|
|
255
263
|
*/
|
|
256
|
-
requestText(base: 'strapi' | 'apim'
|
|
264
|
+
requestText(base: 'strapi' | 'apim', path: string, init?: RequestInit): Promise<string>;
|
|
257
265
|
/** Strapi JSON API envelope unwrap: `{ data: ... }` */
|
|
258
266
|
strapiGet<T>(path: string): Promise<T>;
|
|
259
267
|
}
|
|
@@ -265,14 +273,14 @@ declare class AuthModule {
|
|
|
265
273
|
login(params: LoginRequest): Promise<LoginResponse>;
|
|
266
274
|
/** GET /api/users/me — verify JWT and fetch user profile. */
|
|
267
275
|
me(): Promise<LoginResponse['user']>;
|
|
268
|
-
/** GET /api/apim-management/my-keys — list active keys (masked). */
|
|
269
|
-
listKeys(): Promise<
|
|
276
|
+
/** GET /api/apim-management/my-keys — list active api keys (masked). */
|
|
277
|
+
listKeys(): Promise<ApiKeyItem[]>;
|
|
270
278
|
/** GET /api/apim-management/key-detail/:subscriptionId — full 32-hex key. */
|
|
271
|
-
keyDetail(subscriptionId: string): Promise<
|
|
272
|
-
/** GET /api/apim-management/products — available
|
|
273
|
-
products(): Promise<
|
|
279
|
+
keyDetail(subscriptionId: string): Promise<ApiKeyDetail>;
|
|
280
|
+
/** GET /api/apim-management/products — available api products. */
|
|
281
|
+
products(): Promise<Product[]>;
|
|
274
282
|
/**
|
|
275
|
-
* POST /api/apim-management/generate-key — issue a new
|
|
283
|
+
* POST /api/apim-management/generate-key — issue a new api key.
|
|
276
284
|
* ⚠️ primaryKey is shown only in this response — store it immediately.
|
|
277
285
|
*/
|
|
278
286
|
generateKey(params: {
|
|
@@ -304,7 +312,7 @@ declare class AuthModule {
|
|
|
304
312
|
declare class GenerationModule {
|
|
305
313
|
private readonly t;
|
|
306
314
|
private readonly urls;
|
|
307
|
-
constructor(t: Transport, urls:
|
|
315
|
+
constructor(t: Transport, urls: ResolvedUrls);
|
|
308
316
|
private createJob;
|
|
309
317
|
textToVideo(params: TextToVideoParams): Promise<GenerationCreateResponse>;
|
|
310
318
|
imageToVideo(params: ImageToVideoParams): Promise<GenerationCreateResponse>;
|
|
@@ -336,7 +344,7 @@ declare class GenerationModule {
|
|
|
336
344
|
declare class MediaModule {
|
|
337
345
|
private readonly t;
|
|
338
346
|
private readonly urls;
|
|
339
|
-
constructor(t: Transport, urls:
|
|
347
|
+
constructor(t: Transport, urls: ResolvedUrls);
|
|
340
348
|
/** Presign a new upload slot. */
|
|
341
349
|
presign(params: PresignedUploadRequest): Promise<PresignedUploadResponse>;
|
|
342
350
|
/** Notify server that PUT to uploadUrl succeeded. */
|
|
@@ -363,7 +371,7 @@ declare class MediaModule {
|
|
|
363
371
|
declare class PresetModule {
|
|
364
372
|
private readonly t;
|
|
365
373
|
private readonly urls;
|
|
366
|
-
constructor(t: Transport, urls:
|
|
374
|
+
constructor(t: Transport, urls: ResolvedUrls);
|
|
367
375
|
list(email?: string): Promise<PresetItem[]>;
|
|
368
376
|
get(id: string): Promise<PresetItem>;
|
|
369
377
|
create(params: CreatePresetRequest): Promise<PresetItem>;
|
|
@@ -374,7 +382,7 @@ declare class PresetModule {
|
|
|
374
382
|
declare class AgentModule {
|
|
375
383
|
private readonly t;
|
|
376
384
|
private readonly urls;
|
|
377
|
-
constructor(t: Transport, urls:
|
|
385
|
+
constructor(t: Transport, urls: ResolvedUrls);
|
|
378
386
|
/** Creates an empty project to generate into. POST /video-project/create (APIM api-key). */
|
|
379
387
|
createProject(name: string): Promise<{
|
|
380
388
|
projectId: number;
|
|
@@ -399,7 +407,7 @@ declare class AgentModule {
|
|
|
399
407
|
*
|
|
400
408
|
* @example
|
|
401
409
|
* // With existing credentials:
|
|
402
|
-
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<
|
|
410
|
+
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<api-key>' });
|
|
403
411
|
* const { requestId, model } = await client.generation.textToVideo({ prompt: 'Space', model: 'wan' });
|
|
404
412
|
* const result = await client.generation.waitForResult({ requestId, model });
|
|
405
413
|
*
|
|
@@ -408,6 +416,14 @@ declare class AgentModule {
|
|
|
408
416
|
* const client = new KvidaiClient({});
|
|
409
417
|
* const { jwt, apiKey } = await client.auth.loginAndGetApiKey('user@example.com', 'password');
|
|
410
418
|
* client.setCredentials({ jwt, apiKey });
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* // Custom base URL (for internal/dev environments):
|
|
422
|
+
* const client = new KvidaiClient({
|
|
423
|
+
* baseUrl: 'https://api.kvid.ai',
|
|
424
|
+
* consoleBaseUrl: 'http://localhost:1337',
|
|
425
|
+
* generationPath: '/ai/generation-clone',
|
|
426
|
+
* });
|
|
411
427
|
*/
|
|
412
428
|
export declare class KvidaiClient {
|
|
413
429
|
private opts;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,WAAW,mBAAmB;IAClC,yFAAyF;IACzF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;IACzC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;AAE3D,UAAU,OAAO;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAqCD,qBAAa,WAAY,SAAQ,KAAK;aAElB,IAAI,EAAE,MAAM;aAEZ,MAAM,EAAE,MAAM;aACd,OAAO,CAAC,EAAE,OAAO;gB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AAQ,CACZ,KAAK,EAAE,kBAAkB,EACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GACpC,OAAO,CAAC,cAAc,CAAC;IAmB1B;;;OAGG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAkBvE;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAsB;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;gBAEhB,OAAO,GAAE,mBAAwB;IAW7C,4CAA4C;IAC5C,cAAc,CAAC,KAAK,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAI/D"}
|
package/dist/index.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* @kvidai/sdk — kvidai TypeScript SDK
|
|
4
4
|
*
|
|
5
5
|
* Covers the 4 core external-client flows documented in docs/external-client-guide.md:
|
|
6
|
-
* 1. Auth — login +
|
|
7
|
-
* 2. Generation — AI video/image/voice creation + status polling + result fetch (api.kvid.ai
|
|
8
|
-
* 3. Media — presigned upload → CDN URL (api.kvid.ai
|
|
9
|
-
* 4. Preset — CRUD (api.kvid.ai
|
|
6
|
+
* 1. Auth — login + api-key management (console.kvid.ai / Strapi JWT)
|
|
7
|
+
* 2. Generation — AI video/image/voice creation + status polling + result fetch (api.kvid.ai)
|
|
8
|
+
* 3. Media — presigned upload → CDN URL (api.kvid.ai)
|
|
9
|
+
* 4. Preset — CRUD (api.kvid.ai)
|
|
10
10
|
*
|
|
11
11
|
* Usage:
|
|
12
|
-
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<
|
|
12
|
+
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<api-key>' });
|
|
13
13
|
* const { requestId, model } = await client.generation.textToVideo({ prompt: '...', model: 'wan' });
|
|
14
14
|
* const result = await client.generation.waitForResult({ requestId, model });
|
|
15
15
|
*
|
|
@@ -17,40 +17,17 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.KvidaiClient = exports.KvidaiError = void 0;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
staging: {
|
|
32
|
-
strapiBaseUrl: 'https://hometips-strapi-ts-staging1-405573518541.asia-northeast1.run.app',
|
|
33
|
-
apimBaseUrl: 'https://api.kvid.ai',
|
|
34
|
-
webBaseUrl: 'https://staging1.kvid.ai',
|
|
35
|
-
generationPath: '/ai/generation',
|
|
36
|
-
mediaPath: '/media',
|
|
37
|
-
presetPath: '/preset',
|
|
38
|
-
agentPath: '/agent',
|
|
39
|
-
videoProjectPath: '/video-project',
|
|
40
|
-
},
|
|
41
|
-
dev: {
|
|
42
|
-
strapiBaseUrl: 'http://localhost:1337',
|
|
43
|
-
apimBaseUrl: 'https://api.kvid.ai',
|
|
44
|
-
webBaseUrl: 'http://localhost:3000',
|
|
45
|
-
generationPath: '/ai/generation-clone',
|
|
46
|
-
mediaPath: '/media-dev',
|
|
47
|
-
presetPath: '/preset-dev',
|
|
48
|
-
// Agent + video-project use the same gateway paths across all envs (confirmed live 2026-10-30).
|
|
49
|
-
// No dev-clone equivalent exists for these endpoints.
|
|
50
|
-
agentPath: '/agent',
|
|
51
|
-
videoProjectPath: '/video-project',
|
|
52
|
-
},
|
|
53
|
-
};
|
|
20
|
+
function resolveUrls(opts) {
|
|
21
|
+
return {
|
|
22
|
+
consoleBaseUrl: opts.consoleBaseUrl ?? 'https://console.kvid.ai',
|
|
23
|
+
apiBaseUrl: opts.baseUrl ?? 'https://api.kvid.ai',
|
|
24
|
+
generationPath: opts.generationPath ?? '/ai/generation',
|
|
25
|
+
mediaPath: opts.mediaPath ?? '/media',
|
|
26
|
+
presetPath: opts.presetPath ?? '/preset',
|
|
27
|
+
agentPath: opts.agentPath ?? '/agent',
|
|
28
|
+
videoProjectPath: opts.videoProjectPath ?? '/video-project',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
54
31
|
class KvidaiError extends Error {
|
|
55
32
|
constructor(code, message, status, details) {
|
|
56
33
|
super(message);
|
|
@@ -80,11 +57,7 @@ class Transport {
|
|
|
80
57
|
return headers;
|
|
81
58
|
}
|
|
82
59
|
async request(base, path, init = {}) {
|
|
83
|
-
const baseUrl = base === 'strapi'
|
|
84
|
-
? this.urls.strapiBaseUrl
|
|
85
|
-
: base === 'web'
|
|
86
|
-
? this.urls.webBaseUrl
|
|
87
|
-
: this.urls.apimBaseUrl;
|
|
60
|
+
const baseUrl = base === 'strapi' ? this.urls.consoleBaseUrl : this.urls.apiBaseUrl;
|
|
88
61
|
const authType = base === 'strapi' ? 'strapi' : 'apim';
|
|
89
62
|
let res;
|
|
90
63
|
try {
|
|
@@ -119,11 +92,7 @@ class Transport {
|
|
|
119
92
|
* No automatic timeout is applied since SSE streams are long-running.
|
|
120
93
|
*/
|
|
121
94
|
async requestText(base, path, init = {}) {
|
|
122
|
-
const baseUrl = base === 'strapi'
|
|
123
|
-
? this.urls.strapiBaseUrl
|
|
124
|
-
: base === 'web'
|
|
125
|
-
? this.urls.webBaseUrl
|
|
126
|
-
: this.urls.apimBaseUrl;
|
|
95
|
+
const baseUrl = base === 'strapi' ? this.urls.consoleBaseUrl : this.urls.apiBaseUrl;
|
|
127
96
|
const authType = base === 'strapi' ? 'strapi' : 'apim';
|
|
128
97
|
let res;
|
|
129
98
|
try {
|
|
@@ -172,7 +141,7 @@ class AuthModule {
|
|
|
172
141
|
async me() {
|
|
173
142
|
return this.t.request('strapi', '/api/users/me');
|
|
174
143
|
}
|
|
175
|
-
/** GET /api/apim-management/my-keys — list active keys (masked). */
|
|
144
|
+
/** GET /api/apim-management/my-keys — list active api keys (masked). */
|
|
176
145
|
async listKeys() {
|
|
177
146
|
const res = await this.t.request('strapi', '/api/apim-management/my-keys');
|
|
178
147
|
return Array.isArray(res) ? res : (res.data ?? []);
|
|
@@ -183,14 +152,14 @@ class AuthModule {
|
|
|
183
152
|
// Controller wraps in { data: ... }
|
|
184
153
|
return res.data ?? res;
|
|
185
154
|
}
|
|
186
|
-
/** GET /api/apim-management/products — available
|
|
155
|
+
/** GET /api/apim-management/products — available api products. */
|
|
187
156
|
async products() {
|
|
188
157
|
const res = await this.t.request('strapi', '/api/apim-management/products');
|
|
189
158
|
const data = res.data ?? res;
|
|
190
159
|
return data.products ?? [];
|
|
191
160
|
}
|
|
192
161
|
/**
|
|
193
|
-
* POST /api/apim-management/generate-key — issue a new
|
|
162
|
+
* POST /api/apim-management/generate-key — issue a new api key.
|
|
194
163
|
* ⚠️ primaryKey is shown only in this response — store it immediately.
|
|
195
164
|
*/
|
|
196
165
|
async generateKey(params) {
|
|
@@ -242,7 +211,7 @@ class AuthModule {
|
|
|
242
211
|
// No key — generate one
|
|
243
212
|
const products = await this.products();
|
|
244
213
|
if (!products.length)
|
|
245
|
-
throw new KvidaiError('NO_PRODUCT', 'No
|
|
214
|
+
throw new KvidaiError('NO_PRODUCT', 'No API products available', 404);
|
|
246
215
|
const { primaryKey } = await this.generateKey({ email: user.email, productId: products[0].id });
|
|
247
216
|
return { jwt, apiKey: primaryKey, user };
|
|
248
217
|
}
|
|
@@ -631,7 +600,7 @@ class AgentModule {
|
|
|
631
600
|
*
|
|
632
601
|
* @example
|
|
633
602
|
* // With existing credentials:
|
|
634
|
-
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<
|
|
603
|
+
* const client = new KvidaiClient({ jwt: '<strapi-jwt>', apiKey: '<api-key>' });
|
|
635
604
|
* const { requestId, model } = await client.generation.textToVideo({ prompt: 'Space', model: 'wan' });
|
|
636
605
|
* const result = await client.generation.waitForResult({ requestId, model });
|
|
637
606
|
*
|
|
@@ -640,11 +609,19 @@ class AgentModule {
|
|
|
640
609
|
* const client = new KvidaiClient({});
|
|
641
610
|
* const { jwt, apiKey } = await client.auth.loginAndGetApiKey('user@example.com', 'password');
|
|
642
611
|
* client.setCredentials({ jwt, apiKey });
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* // Custom base URL (for internal/dev environments):
|
|
615
|
+
* const client = new KvidaiClient({
|
|
616
|
+
* baseUrl: 'https://api.kvid.ai',
|
|
617
|
+
* consoleBaseUrl: 'http://localhost:1337',
|
|
618
|
+
* generationPath: '/ai/generation-clone',
|
|
619
|
+
* });
|
|
643
620
|
*/
|
|
644
621
|
class KvidaiClient {
|
|
645
622
|
constructor(options = {}) {
|
|
646
|
-
this.opts = {
|
|
647
|
-
const urls =
|
|
623
|
+
this.opts = { timeoutMs: 30000, ...options };
|
|
624
|
+
const urls = resolveUrls(this.opts);
|
|
648
625
|
this.transport = new Transport(this.opts, urls);
|
|
649
626
|
this.auth = new AuthModule(this.transport, this.opts);
|
|
650
627
|
this.generation = new GenerationModule(this.transport, urls);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvidai/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "kvidai TypeScript SDK — auth, AI video/image generation, media upload, agent chat",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,5 +41,6 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"registry": "https://npm.pkg.github.com",
|
|
43
43
|
"access": "restricted"
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://kvid.ai"
|
|
45
46
|
}
|