@unityclaw/sdk 1.0.5 → 1.0.8
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 +17 -24
- package/dist/index.cjs +494 -118
- package/dist/index.d.cts +260 -97
- package/dist/index.d.ts +260 -97
- package/dist/index.js +479 -118
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @unityclaw/sdk
|
|
2
2
|
|
|
3
|
-
Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more.
|
|
3
|
+
Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, document processing, and more.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -20,7 +20,8 @@ const client = new UnityClawClient();
|
|
|
20
20
|
const client = new UnityClawClient({
|
|
21
21
|
apiKey: 'your-api-key',
|
|
22
22
|
baseUrl: 'https://unityclaw.com',
|
|
23
|
-
taskDir: './tasks'
|
|
23
|
+
taskDir: './tasks',
|
|
24
|
+
timeout: 900000 // 15 minutes
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
// Generate image
|
|
@@ -28,15 +29,17 @@ const imageResult = await client.image.gemini({
|
|
|
28
29
|
prompt: 'A beautiful sunset over mountains'
|
|
29
30
|
});
|
|
30
31
|
|
|
31
|
-
// Generate video
|
|
32
|
-
const videoResult = await client.video.
|
|
32
|
+
// Generate video (Kling)
|
|
33
|
+
const videoResult = await client.video.kling({
|
|
33
34
|
prompt: 'A cat playing piano',
|
|
34
|
-
|
|
35
|
+
model: 'kling-v2-6',
|
|
36
|
+
aspect_ratio: '16:9',
|
|
37
|
+
duration: '5'
|
|
35
38
|
});
|
|
36
39
|
|
|
37
|
-
// Translate document
|
|
40
|
+
// Translate document (local file will be auto-uploaded to get tmp_url)
|
|
38
41
|
const docResult = await client.document.translate({
|
|
39
|
-
attachment: [{
|
|
42
|
+
attachment: [{ path: './files/doc.pdf' }],
|
|
40
43
|
source_language: { value: 'en', label: 'English' },
|
|
41
44
|
target_language: { value: 'zh', label: 'Chinese' }
|
|
42
45
|
});
|
|
@@ -93,7 +96,7 @@ Each SDK execution creates a task folder with:
|
|
|
93
96
|
|
|
94
97
|
### Default Task Directory
|
|
95
98
|
|
|
96
|
-
Tasks are stored in
|
|
99
|
+
Tasks are stored in `~/Documents/tasks/` by default. You can override this:
|
|
97
100
|
|
|
98
101
|
```typescript
|
|
99
102
|
const client = new UnityClawClient({
|
|
@@ -122,21 +125,10 @@ await client.image.jimeng({
|
|
|
122
125
|
### Video Generation
|
|
123
126
|
|
|
124
127
|
```typescript
|
|
125
|
-
// Sora
|
|
126
|
-
await client.video.sora({
|
|
127
|
-
prompt: 'A cat playing piano',
|
|
128
|
-
orientation: 'landscape'
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Veo
|
|
132
|
-
await client.video.veo({
|
|
133
|
-
prompt: 'Ocean waves at sunset'
|
|
134
|
-
});
|
|
135
|
-
|
|
136
128
|
// Kling
|
|
137
129
|
await client.video.kling({
|
|
138
130
|
prompt: 'A dancing robot',
|
|
139
|
-
|
|
131
|
+
model: 'kling-v1-5'
|
|
140
132
|
});
|
|
141
133
|
```
|
|
142
134
|
|
|
@@ -152,8 +144,9 @@ await client.document.translate({
|
|
|
152
144
|
|
|
153
145
|
// Convert document
|
|
154
146
|
await client.document.convert({
|
|
155
|
-
attachment: [{
|
|
156
|
-
|
|
147
|
+
attachment: [{ path: './files/doc.pdf' }],
|
|
148
|
+
input_format: 'pdf',
|
|
149
|
+
output_format: 'docx'
|
|
157
150
|
});
|
|
158
151
|
```
|
|
159
152
|
|
|
@@ -164,8 +157,8 @@ const result = await client.media.analyze({
|
|
|
164
157
|
url: [{ link: 'https://youtube.com/watch?v=...' }]
|
|
165
158
|
});
|
|
166
159
|
|
|
167
|
-
console.log(result.data
|
|
168
|
-
console.log(result.data
|
|
160
|
+
console.log(result.response.data?.summary);
|
|
161
|
+
console.log(result.response.data?.subtitle);
|
|
169
162
|
```
|
|
170
163
|
|
|
171
164
|
## License
|