@hautechai/sdk 2.41.0 → 2.43.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 +55 -0
- package/dist/index.d.mts +434 -6
- package/dist/index.d.ts +434 -6
- package/dist/index.js +104 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,12 +85,67 @@ sdk.ws.disconnect();
|
|
|
85
85
|
|
|
86
86
|
Docs about how to use the SDK are available [here](https://docs.hautech.ai/)
|
|
87
87
|
|
|
88
|
+
#### Seedream v5 Lite imagine operations
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
// Text-to-image
|
|
92
|
+
const t2iOperation = await sdk.operations.run.imagine.seedream['5_lite_t2i'].v1({
|
|
93
|
+
input: {
|
|
94
|
+
prompt: 'A cinematic skyline at sunrise above a crystal bay',
|
|
95
|
+
width: 2048,
|
|
96
|
+
height: 2048,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Image edit
|
|
101
|
+
const editOperation = await sdk.operations.run.imagine.seedream['5_lite_edit'].v1({
|
|
102
|
+
input: {
|
|
103
|
+
prompt: 'Reimagine this scene as a watercolor illustration',
|
|
104
|
+
imageIds: ['existing-image-id'],
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Wait for the generated assets
|
|
109
|
+
const finalizedT2i = await sdk.operations.wait(t2iOperation);
|
|
110
|
+
const finalizedEdit = await sdk.operations.wait(editOperation);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Both variants accept dimensions up to 3072×3072. Pricing endpoints report a cost of **$0.04375 USD per run** for the text-to-image and edit models—use `sdk.pricing.list()` or `sdk.pricing.get('seedream.5_lite_t2i.v1')` / `sdk.pricing.get('seedream.5_lite_edit.v1')` to confirm the current catalog pricing.
|
|
114
|
+
|
|
115
|
+
#### Google Nano Banana prompt-only vs. edit mode
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
// Prompt-only generation (no source images required)
|
|
119
|
+
const promptOnly = await sdk.operations.run.google.nano_banana_pro.edit.v1({
|
|
120
|
+
input: {
|
|
121
|
+
prompt: 'Generate a high-fashion catalog shot of a model in neon streetwear',
|
|
122
|
+
// imageIds omitted on purpose
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Classic edit mode with at least one source image
|
|
127
|
+
const editFromImage = await sdk.operations.run.google.nano_banana_pro.edit.v1({
|
|
128
|
+
input: {
|
|
129
|
+
prompt: 'Apply a cinematic golden-hour lighting pass to this asset',
|
|
130
|
+
imageIds: ['existing-image-id'],
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The backend Swagger DTO (`GoogleNanoBananaProEditV1Input`) intentionally marks `imageIds` as optional so prompt-only runs remain valid. Provide one or more IDs when you need edit behavior; omit the field when you want the model to generate a fresh asset purely from text.
|
|
136
|
+
|
|
88
137
|
### Uploading files
|
|
89
138
|
|
|
90
139
|
- In browsers, prefer passing a `File` object to methods like `sdk.images.createFromFile` and `sdk.videos.createFromFile`. The `File.name` will be included in the multipart upload automatically.
|
|
91
140
|
- If you pass a `Blob` in the browser, some environments may set the filename to a default value (e.g., `"blob"`). To control the filename when using a `Blob`, wrap it in an object with explicit metadata on server-side, or construct a `File` from the `Blob`.
|
|
92
141
|
- In Node.js, when you pass a string path (e.g., `/path/to/image.png`), the SDK sets the multipart filename to the basename of the path (e.g., `image.png`). You can also pass an object with `{ stream, filename, contentType }` to control metadata explicitly.
|
|
93
142
|
|
|
143
|
+
You can also expire uploads automatically by specifying a TTL when finalizing image uploads:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
await sdk.images.createFromFile('/path/to/image.png', { ttlSeconds: 3600 });
|
|
147
|
+
```
|
|
148
|
+
|
|
94
149
|
## Development
|
|
95
150
|
|
|
96
151
|
### Prerequisites
|