vidjutsu 0.1.0 → 0.2.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 ADDED
@@ -0,0 +1,139 @@
1
+ # vidjutsu
2
+
3
+ TypeScript SDK for the [VidJutsu](https://vidjutsu.ai) video intelligence API.
4
+
5
+ Watch, extract, transcribe, and overlay — fully typed, auto-generated from the [OpenAPI spec](https://raw.githubusercontent.com/tfcbot/vidjutsu-openapi/main/openapi/spec.json).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install vidjutsu
11
+ ```
12
+
13
+ ## Get your API key
14
+
15
+ ```bash
16
+ curl -fsSL https://vidjutsu.ai/install.sh | bash
17
+ vidjutsu subscribe --email you@example.com
18
+ ```
19
+
20
+ Your key saves to `~/.vidjutsu/config.json` automatically. The SDK reads it from there — no extra setup needed.
21
+
22
+ ## Quick start
23
+
24
+ ```ts
25
+ import { createClient } from "vidjutsu";
26
+
27
+ const vj = createClient();
28
+
29
+ // Watch — AI analyzes a video and answers your prompt (10 credits)
30
+ const { data: watch } = await vj.watchMedia({
31
+ mediaUrl: "https://cdn.example.com/video.mp4",
32
+ prompt: "Is the hook strong enough for fitness TikTok?",
33
+ });
34
+ console.log(watch.response);
35
+
36
+ // Extract — pull frames, audio, and metadata (5 credits)
37
+ const { data: extract } = await vj.extractMedia({
38
+ mediaUrl: "https://cdn.example.com/video.mp4",
39
+ frames: "auto",
40
+ audio: true,
41
+ });
42
+ console.log(extract.frames, extract.metadata);
43
+
44
+ // Transcribe — speech-to-text with word-level timing (10 credits)
45
+ const { data: transcript } = await vj.transcribeMedia({
46
+ mediaUrl: "https://cdn.example.com/video.mp4",
47
+ });
48
+ console.log(transcript.transcript, transcript.words);
49
+
50
+ // Overlay — burn text onto video (5 credits)
51
+ const { data: overlay } = await vj.createOverlay({
52
+ videoUrl: "https://cdn.example.com/video.mp4",
53
+ text: "Follow for more tips",
54
+ position: "bottom",
55
+ });
56
+ console.log(overlay.resultUrl);
57
+ ```
58
+
59
+ ## Authentication
60
+
61
+ The client resolves your API key in this order:
62
+
63
+ 1. **Explicit** — `createClient({ apiKey: "vj_live_..." })`
64
+ 2. **Environment variable** — `VIDJUTSU_API_KEY`
65
+ 3. **Config file** — `~/.vidjutsu/config.json` (written by `vidjutsu auth`)
66
+
67
+ ```ts
68
+ // Reads from env or config file
69
+ const vj = createClient();
70
+
71
+ // Or pass explicitly
72
+ const vj = createClient({ apiKey: "vj_live_..." });
73
+
74
+ // Custom base URL
75
+ const vj = createClient({ baseUrl: "https://staging.api.vidjutsu.ai" });
76
+ ```
77
+
78
+ ## All methods
79
+
80
+ ### Video intelligence (paid)
81
+
82
+ | Method | Credits | Description |
83
+ |--------|---------|-------------|
84
+ | `watchMedia(body)` | 10 | AI watches a video/image and answers your prompt |
85
+ | `extractMedia(body)` | 5 | Extract frames, audio, and metadata from video |
86
+ | `transcribeMedia(body)` | 10 | Speech-to-text with word-level timing |
87
+ | `checkSpec(body)` | 5 | Validate a VidLang spec against rules |
88
+ | `createOverlay(body)` | 5 | Burn text overlay onto video |
89
+
90
+ ### Resources (free)
91
+
92
+ | Method | Description |
93
+ |--------|-------------|
94
+ | `createAccount(body)` / `updateAccount(body, query)` / `listOrGetAccounts(query)` / `deleteAccount(query)` | Manage accounts |
95
+ | `createPost(body)` / `updatePost(body, query)` / `listOrGetPosts(query)` / `deletePost(query)` | Manage posts |
96
+ | `createAsset(body)` / `updateAsset(body, query)` / `listOrGetAssets(query)` / `deleteAsset(query)` | Manage assets |
97
+ | `createReference(body)` / `updateReference(body, query)` / `listOrGetReferences(query)` / `deleteReference(query)` | Manage references |
98
+ | `uploadFile(body)` / `uploadFromUrl(body)` | Upload media to CDN |
99
+ | `getBalance()` | Check credit balance |
100
+
101
+ ### Utilities (free)
102
+
103
+ | Method | Description |
104
+ |--------|-------------|
105
+ | `getInfo()` | API info and endpoint discovery |
106
+ | `getPricing()` | Current pricing |
107
+ | `createCheckout(body)` | Create Stripe checkout session |
108
+ | `getCheckoutStatus(query)` | Check checkout status |
109
+ | `createSubscription(body)` | Subscribe ($99/mo) |
110
+ | `rotateApiKey()` | Rotate API key (invalidates current key) |
111
+ | `recoverApiKey(body)` | Recover key via email |
112
+
113
+ ## Raw client
114
+
115
+ Every method returns the `openapi-fetch` response shape: `{ data, error, response }`. For endpoints not covered by convenience methods, use the raw client:
116
+
117
+ ```ts
118
+ const { data, error } = await vj.api.GET("/v1/balance");
119
+ const { data, error } = await vj.api.POST("/v1/watch", {
120
+ body: { mediaUrl: "...", prompt: "..." },
121
+ });
122
+ ```
123
+
124
+ ## Credits & billing
125
+
126
+ - **$99/month** — 1,000 credits included
127
+ - **Extra credits** — $0.10 each
128
+ - No overage charges — API returns 402 when credits run out
129
+
130
+ ## Links
131
+
132
+ - [Documentation](https://docs.vidjutsu.ai)
133
+ - [API Reference](https://docs.vidjutsu.ai/api-reference/introduction)
134
+ - [CLI](https://github.com/tfcbot/vidjutsu-cli)
135
+ - [OpenAPI Spec](https://raw.githubusercontent.com/tfcbot/vidjutsu-openapi/main/openapi/spec.json)
136
+
137
+ ## License
138
+
139
+ MIT
package/dist/client.d.ts CHANGED
@@ -28,7 +28,7 @@ export type VidJutsuClient = VidJutsuMethods & {
28
28
  * const { data } = await vj.transcribeMedia({ mediaUrl: 'https://...' });
29
29
  *
30
30
  * // Raw openapi-fetch (escape hatch):
31
- * const { data } = await vj.api.GET('/v1/balance');
31
+ * const { data } = await vj.api.GET('/v1/usage');
32
32
  * ```
33
33
  */
34
34
  export declare function createClient(config?: VidJutsuConfig): VidJutsuClient;
package/dist/client.js CHANGED
@@ -30,7 +30,7 @@ function readConfigFile() {
30
30
  * const { data } = await vj.transcribeMedia({ mediaUrl: 'https://...' });
31
31
  *
32
32
  * // Raw openapi-fetch (escape hatch):
33
- * const { data } = await vj.api.GET('/v1/balance');
33
+ * const { data } = await vj.api.GET('/v1/usage');
34
34
  * ```
35
35
  */
36
36
  export function createClient(config = {}) {
package/dist/methods.d.ts CHANGED
@@ -38,16 +38,14 @@ export interface VidJutsuMethods {
38
38
  confirmVerification(body: ReqBody<"/v1/auth/verify/confirm", "post">): ReturnType<Client["POST"]>;
39
39
  /** Request email verification code Public endpoint. */
40
40
  requestVerification(body: ReqBody<"/v1/auth/verify/request", "post">): ReturnType<Client["POST"]>;
41
- /** Get credit balance Auth required. */
42
- getBalance(): ReturnType<Client["GET"]>;
41
+ /** Get daily usage and rate limits */
42
+ getUsage(): ReturnType<Client["GET"]>;
43
43
  /** Check spec Auth required. 5 credits. */
44
44
  checkSpec(body: ReqBody<"/v1/check", "post">): ReturnType<Client["POST"]>;
45
45
  /** Get check rules Auth required. */
46
46
  getCheckRules(): ReturnType<Client["GET"]>;
47
47
  /** Update check rules Auth required. */
48
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
49
  /** Check checkout status Public endpoint. */
52
50
  getCheckoutStatus(query?: QueryParams<"/v1/credits/status", "get">): ReturnType<Client["GET"]>;
53
51
  /** Extract from media Auth required. 5 credits. */
package/dist/methods.js CHANGED
@@ -36,8 +36,8 @@ export function bindMethods(client) {
36
36
  requestVerification(body) {
37
37
  return client.POST("/v1/auth/verify/request", { body });
38
38
  },
39
- getBalance() {
40
- return client.GET("/v1/balance", {});
39
+ getUsage() {
40
+ return client.GET("/v1/usage", {});
41
41
  },
42
42
  checkSpec(body) {
43
43
  return client.POST("/v1/check", { body });
@@ -48,9 +48,6 @@ export function bindMethods(client) {
48
48
  updateCheckRules(body) {
49
49
  return client.PUT("/v1/check/rules", { body });
50
50
  },
51
- createCheckout(body) {
52
- return client.POST("/v1/credits", { body });
53
- },
54
51
  getCheckoutStatus(query) {
55
52
  return client.GET("/v1/credits/status", { params: { query } });
56
53
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidjutsu",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript SDK for the VidJutsu video intelligence API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",