vidjutsu 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.
- package/dist/client.d.ts +35 -0
- package/dist/client.js +54 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/methods.d.ts +89 -0
- package/dist/methods.js +109 -0
- package/package.json +45 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import createFetchClient from "openapi-fetch";
|
|
2
|
+
import type { paths } from "./schema.js";
|
|
3
|
+
import { type VidJutsuMethods } from "./methods.js";
|
|
4
|
+
export interface VidJutsuConfig {
|
|
5
|
+
/** API key. Falls back to VIDJUTSU_API_KEY env var, then ~/.vidjutsu/config.json. */
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
/** Base URL. Falls back to VIDJUTSU_API_URL env var, then ~/.vidjutsu/config.json, then https://api.vidjutsu.ai. */
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
/** The raw openapi-fetch client with typed GET/POST/PUT/DELETE */
|
|
11
|
+
type FetchClient = ReturnType<typeof createFetchClient<paths>>;
|
|
12
|
+
/** Combined client: typed convenience methods + raw openapi-fetch escape hatch */
|
|
13
|
+
export type VidJutsuClient = VidJutsuMethods & {
|
|
14
|
+
api: FetchClient;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Create a typed VidJutsu API client.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { createClient } from 'vidjutsu';
|
|
22
|
+
*
|
|
23
|
+
* const vj = createClient(); // reads ~/.vidjutsu/config.json or env vars
|
|
24
|
+
*
|
|
25
|
+
* // Convenience methods (fully typed):
|
|
26
|
+
* const { data } = await vj.watchMedia({ mediaUrl: 'https://...', prompt: '...' });
|
|
27
|
+
* const { data } = await vj.extractMedia({ mediaUrl: 'https://...', frames: 'auto' });
|
|
28
|
+
* const { data } = await vj.transcribeMedia({ mediaUrl: 'https://...' });
|
|
29
|
+
*
|
|
30
|
+
* // Raw openapi-fetch (escape hatch):
|
|
31
|
+
* const { data } = await vj.api.GET('/v1/balance');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function createClient(config?: VidJutsuConfig): VidJutsuClient;
|
|
35
|
+
export {};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import createFetchClient from "openapi-fetch";
|
|
2
|
+
import { bindMethods } from "./methods.js";
|
|
3
|
+
import { readFileSync, existsSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
function readConfigFile() {
|
|
7
|
+
try {
|
|
8
|
+
const configPath = join(homedir(), ".vidjutsu", "config.json");
|
|
9
|
+
if (existsSync(configPath)) {
|
|
10
|
+
return JSON.parse(readFileSync(configPath, "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// Non-Node environments (edge, browser) — config file not available
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a typed VidJutsu API client.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { createClient } from 'vidjutsu';
|
|
24
|
+
*
|
|
25
|
+
* const vj = createClient(); // reads ~/.vidjutsu/config.json or env vars
|
|
26
|
+
*
|
|
27
|
+
* // Convenience methods (fully typed):
|
|
28
|
+
* const { data } = await vj.watchMedia({ mediaUrl: 'https://...', prompt: '...' });
|
|
29
|
+
* const { data } = await vj.extractMedia({ mediaUrl: 'https://...', frames: 'auto' });
|
|
30
|
+
* const { data } = await vj.transcribeMedia({ mediaUrl: 'https://...' });
|
|
31
|
+
*
|
|
32
|
+
* // Raw openapi-fetch (escape hatch):
|
|
33
|
+
* const { data } = await vj.api.GET('/v1/balance');
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function createClient(config = {}) {
|
|
37
|
+
const configFile = readConfigFile();
|
|
38
|
+
const apiKey = config.apiKey ??
|
|
39
|
+
process.env.VIDJUTSU_API_KEY ??
|
|
40
|
+
configFile?.apiKey;
|
|
41
|
+
const baseUrl = config.baseUrl ??
|
|
42
|
+
process.env.VIDJUTSU_API_URL ??
|
|
43
|
+
configFile?.apiUrl ??
|
|
44
|
+
"https://api.vidjutsu.ai";
|
|
45
|
+
const fetchClient = createFetchClient({
|
|
46
|
+
baseUrl,
|
|
47
|
+
headers: {
|
|
48
|
+
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
|
|
49
|
+
"Content-Type": "application/json",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const methods = bindMethods(fetchClient);
|
|
53
|
+
return { ...methods, api: fetchClient };
|
|
54
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createClient } from "./client.js";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { paths } from "./schema.js";
|
|
2
|
+
import type createFetchClient from "openapi-fetch";
|
|
3
|
+
type Client = ReturnType<typeof createFetchClient<paths>>;
|
|
4
|
+
type ReqBody<P extends keyof paths, M extends keyof paths[P]> = paths[P][M] extends {
|
|
5
|
+
requestBody: {
|
|
6
|
+
content: {
|
|
7
|
+
"application/json": infer B;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
} ? B : never;
|
|
11
|
+
type QueryParams<P extends keyof paths, M extends keyof paths[P]> = paths[P][M] extends {
|
|
12
|
+
parameters: {
|
|
13
|
+
query?: infer Q;
|
|
14
|
+
};
|
|
15
|
+
} ? Q : never;
|
|
16
|
+
export interface VidJutsuMethods {
|
|
17
|
+
/** Create account Auth required. */
|
|
18
|
+
createAccount(body: ReqBody<"/v1/accounts", "post">): ReturnType<Client["POST"]>;
|
|
19
|
+
/** Update account Auth required. */
|
|
20
|
+
updateAccount(body: ReqBody<"/v1/accounts", "put">, query?: QueryParams<"/v1/accounts", "put">): ReturnType<Client["PUT"]>;
|
|
21
|
+
/** List accounts or get by ID Auth required. */
|
|
22
|
+
listOrGetAccounts(query?: QueryParams<"/v1/accounts", "get">): ReturnType<Client["GET"]>;
|
|
23
|
+
/** Delete account Auth required. */
|
|
24
|
+
deleteAccount(query?: QueryParams<"/v1/accounts", "delete">): ReturnType<Client["DELETE"]>;
|
|
25
|
+
/** Recover API key Public endpoint. */
|
|
26
|
+
recoverApiKey(body: ReqBody<"/v1/api_keys/recover", "post">): ReturnType<Client["POST"]>;
|
|
27
|
+
/** Rotate API key Auth required. */
|
|
28
|
+
rotateApiKey(): ReturnType<Client["POST"]>;
|
|
29
|
+
/** Create asset from existing URL Auth required. */
|
|
30
|
+
createAsset(body: ReqBody<"/v1/assets", "post">): ReturnType<Client["POST"]>;
|
|
31
|
+
/** Update asset metadata Auth required. */
|
|
32
|
+
updateAsset(body: ReqBody<"/v1/assets", "put">, query?: QueryParams<"/v1/assets", "put">): ReturnType<Client["PUT"]>;
|
|
33
|
+
/** List assets or get by ID Auth required. */
|
|
34
|
+
listOrGetAssets(query?: QueryParams<"/v1/assets", "get">): ReturnType<Client["GET"]>;
|
|
35
|
+
/** Delete asset (soft) Auth required. */
|
|
36
|
+
deleteAsset(query?: QueryParams<"/v1/assets", "delete">): ReturnType<Client["DELETE"]>;
|
|
37
|
+
/** Confirm email verification code Public endpoint. */
|
|
38
|
+
confirmVerification(body: ReqBody<"/v1/auth/verify/confirm", "post">): ReturnType<Client["POST"]>;
|
|
39
|
+
/** Request email verification code Public endpoint. */
|
|
40
|
+
requestVerification(body: ReqBody<"/v1/auth/verify/request", "post">): ReturnType<Client["POST"]>;
|
|
41
|
+
/** Get credit balance Auth required. */
|
|
42
|
+
getBalance(): ReturnType<Client["GET"]>;
|
|
43
|
+
/** Check spec Auth required. 5 credits. */
|
|
44
|
+
checkSpec(body: ReqBody<"/v1/check", "post">): ReturnType<Client["POST"]>;
|
|
45
|
+
/** Get check rules Auth required. */
|
|
46
|
+
getCheckRules(): ReturnType<Client["GET"]>;
|
|
47
|
+
/** Update check rules Auth required. */
|
|
48
|
+
updateCheckRules(body: ReqBody<"/v1/check/rules", "put">): ReturnType<Client["PUT"]>;
|
|
49
|
+
/** Create checkout session Public endpoint. */
|
|
50
|
+
createCheckout(body: ReqBody<"/v1/credits", "post">): ReturnType<Client["POST"]>;
|
|
51
|
+
/** Check checkout status Public endpoint. */
|
|
52
|
+
getCheckoutStatus(query?: QueryParams<"/v1/credits/status", "get">): ReturnType<Client["GET"]>;
|
|
53
|
+
/** Extract from media Auth required. 5 credits. */
|
|
54
|
+
extractMedia(body: ReqBody<"/v1/extract", "post">): ReturnType<Client["POST"]>;
|
|
55
|
+
/** API info Public endpoint. */
|
|
56
|
+
getInfo(): ReturnType<Client["GET"]>;
|
|
57
|
+
/** Burn text overlay onto video Auth required. 5 credits. */
|
|
58
|
+
createOverlay(body: ReqBody<"/v1/overlay", "post">): ReturnType<Client["POST"]>;
|
|
59
|
+
/** Create post Auth required. */
|
|
60
|
+
createPost(body: ReqBody<"/v1/posts", "post">): ReturnType<Client["POST"]>;
|
|
61
|
+
/** Update post Auth required. */
|
|
62
|
+
updatePost(body: ReqBody<"/v1/posts", "put">, query?: QueryParams<"/v1/posts", "put">): ReturnType<Client["PUT"]>;
|
|
63
|
+
/** List posts or get by ID Auth required. */
|
|
64
|
+
listOrGetPosts(query?: QueryParams<"/v1/posts", "get">): ReturnType<Client["GET"]>;
|
|
65
|
+
/** Delete post Auth required. */
|
|
66
|
+
deletePost(query?: QueryParams<"/v1/posts", "delete">): ReturnType<Client["DELETE"]>;
|
|
67
|
+
/** Get pricing Public endpoint. */
|
|
68
|
+
getPricing(): ReturnType<Client["GET"]>;
|
|
69
|
+
/** Create reference Auth required. */
|
|
70
|
+
createReference(body: ReqBody<"/v1/references", "post">): ReturnType<Client["POST"]>;
|
|
71
|
+
/** Update reference Auth required. */
|
|
72
|
+
updateReference(body: ReqBody<"/v1/references", "put">, query?: QueryParams<"/v1/references", "put">): ReturnType<Client["PUT"]>;
|
|
73
|
+
/** List references or get by ID Auth required. */
|
|
74
|
+
listOrGetReferences(query?: QueryParams<"/v1/references", "get">): ReturnType<Client["GET"]>;
|
|
75
|
+
/** Delete reference Auth required. */
|
|
76
|
+
deleteReference(query?: QueryParams<"/v1/references", "delete">): ReturnType<Client["DELETE"]>;
|
|
77
|
+
/** Create subscription Public endpoint. */
|
|
78
|
+
createSubscription(body: ReqBody<"/v1/subscribe", "post">): ReturnType<Client["POST"]>;
|
|
79
|
+
/** Transcribe media Auth required. 10 credits. */
|
|
80
|
+
transcribeMedia(body: ReqBody<"/v1/transcribe", "post">): ReturnType<Client["POST"]>;
|
|
81
|
+
/** Upload file Auth required. */
|
|
82
|
+
uploadFile(): ReturnType<Client["POST"]>;
|
|
83
|
+
/** Upload from URL Auth required. */
|
|
84
|
+
uploadFromUrl(body: ReqBody<"/v1/upload/url", "post">): ReturnType<Client["POST"]>;
|
|
85
|
+
/** Watch media Auth required. 10 credits. */
|
|
86
|
+
watchMedia(body: ReqBody<"/v1/watch", "post">): ReturnType<Client["POST"]>;
|
|
87
|
+
}
|
|
88
|
+
export declare function bindMethods(client: Client): VidJutsuMethods;
|
|
89
|
+
export {};
|
package/dist/methods.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export function bindMethods(client) {
|
|
2
|
+
return {
|
|
3
|
+
createAccount(body) {
|
|
4
|
+
return client.POST("/v1/accounts", { body });
|
|
5
|
+
},
|
|
6
|
+
updateAccount(body, query) {
|
|
7
|
+
return client.PUT("/v1/accounts", { body, params: { query } });
|
|
8
|
+
},
|
|
9
|
+
listOrGetAccounts(query) {
|
|
10
|
+
return client.GET("/v1/accounts", { params: { query } });
|
|
11
|
+
},
|
|
12
|
+
deleteAccount(query) {
|
|
13
|
+
return client.DELETE("/v1/accounts", { params: { query } });
|
|
14
|
+
},
|
|
15
|
+
recoverApiKey(body) {
|
|
16
|
+
return client.POST("/v1/api_keys/recover", { body });
|
|
17
|
+
},
|
|
18
|
+
rotateApiKey() {
|
|
19
|
+
return client.POST("/v1/api_keys/rotate", {});
|
|
20
|
+
},
|
|
21
|
+
createAsset(body) {
|
|
22
|
+
return client.POST("/v1/assets", { body });
|
|
23
|
+
},
|
|
24
|
+
updateAsset(body, query) {
|
|
25
|
+
return client.PUT("/v1/assets", { body, params: { query } });
|
|
26
|
+
},
|
|
27
|
+
listOrGetAssets(query) {
|
|
28
|
+
return client.GET("/v1/assets", { params: { query } });
|
|
29
|
+
},
|
|
30
|
+
deleteAsset(query) {
|
|
31
|
+
return client.DELETE("/v1/assets", { params: { query } });
|
|
32
|
+
},
|
|
33
|
+
confirmVerification(body) {
|
|
34
|
+
return client.POST("/v1/auth/verify/confirm", { body });
|
|
35
|
+
},
|
|
36
|
+
requestVerification(body) {
|
|
37
|
+
return client.POST("/v1/auth/verify/request", { body });
|
|
38
|
+
},
|
|
39
|
+
getBalance() {
|
|
40
|
+
return client.GET("/v1/balance", {});
|
|
41
|
+
},
|
|
42
|
+
checkSpec(body) {
|
|
43
|
+
return client.POST("/v1/check", { body });
|
|
44
|
+
},
|
|
45
|
+
getCheckRules() {
|
|
46
|
+
return client.GET("/v1/check/rules", {});
|
|
47
|
+
},
|
|
48
|
+
updateCheckRules(body) {
|
|
49
|
+
return client.PUT("/v1/check/rules", { body });
|
|
50
|
+
},
|
|
51
|
+
createCheckout(body) {
|
|
52
|
+
return client.POST("/v1/credits", { body });
|
|
53
|
+
},
|
|
54
|
+
getCheckoutStatus(query) {
|
|
55
|
+
return client.GET("/v1/credits/status", { params: { query } });
|
|
56
|
+
},
|
|
57
|
+
extractMedia(body) {
|
|
58
|
+
return client.POST("/v1/extract", { body });
|
|
59
|
+
},
|
|
60
|
+
getInfo() {
|
|
61
|
+
return client.GET("/v1/info", {});
|
|
62
|
+
},
|
|
63
|
+
createOverlay(body) {
|
|
64
|
+
return client.POST("/v1/overlay", { body });
|
|
65
|
+
},
|
|
66
|
+
createPost(body) {
|
|
67
|
+
return client.POST("/v1/posts", { body });
|
|
68
|
+
},
|
|
69
|
+
updatePost(body, query) {
|
|
70
|
+
return client.PUT("/v1/posts", { body, params: { query } });
|
|
71
|
+
},
|
|
72
|
+
listOrGetPosts(query) {
|
|
73
|
+
return client.GET("/v1/posts", { params: { query } });
|
|
74
|
+
},
|
|
75
|
+
deletePost(query) {
|
|
76
|
+
return client.DELETE("/v1/posts", { params: { query } });
|
|
77
|
+
},
|
|
78
|
+
getPricing() {
|
|
79
|
+
return client.GET("/v1/pricing", {});
|
|
80
|
+
},
|
|
81
|
+
createReference(body) {
|
|
82
|
+
return client.POST("/v1/references", { body });
|
|
83
|
+
},
|
|
84
|
+
updateReference(body, query) {
|
|
85
|
+
return client.PUT("/v1/references", { body, params: { query } });
|
|
86
|
+
},
|
|
87
|
+
listOrGetReferences(query) {
|
|
88
|
+
return client.GET("/v1/references", { params: { query } });
|
|
89
|
+
},
|
|
90
|
+
deleteReference(query) {
|
|
91
|
+
return client.DELETE("/v1/references", { params: { query } });
|
|
92
|
+
},
|
|
93
|
+
createSubscription(body) {
|
|
94
|
+
return client.POST("/v1/subscribe", { body });
|
|
95
|
+
},
|
|
96
|
+
transcribeMedia(body) {
|
|
97
|
+
return client.POST("/v1/transcribe", { body });
|
|
98
|
+
},
|
|
99
|
+
uploadFile() {
|
|
100
|
+
return client.POST("/v1/upload", {});
|
|
101
|
+
},
|
|
102
|
+
uploadFromUrl(body) {
|
|
103
|
+
return client.POST("/v1/upload/url", { body });
|
|
104
|
+
},
|
|
105
|
+
watchMedia(body) {
|
|
106
|
+
return client.POST("/v1/watch", { body });
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vidjutsu",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for the VidJutsu video intelligence API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"generate": "bun scripts/generate-schema.ts && bun scripts/generate-methods.ts",
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"prepublishOnly": "bun run generate && bun run build"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"openapi-fetch": "^0.13.5"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^25.6.0",
|
|
27
|
+
"openapi-typescript": "^7.8.0",
|
|
28
|
+
"typescript": "^5.7.0"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"vidjutsu",
|
|
32
|
+
"video",
|
|
33
|
+
"ai",
|
|
34
|
+
"api",
|
|
35
|
+
"sdk",
|
|
36
|
+
"watch",
|
|
37
|
+
"extract",
|
|
38
|
+
"transcribe"
|
|
39
|
+
],
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/tfcbot/vidjutsu-sdk"
|
|
44
|
+
}
|
|
45
|
+
}
|