@aigne/aigne-hub 0.8.4 → 0.8.6
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/CHANGELOG.md +51 -0
- package/README.md +127 -2
- package/lib/cjs/aigne-hub-model.js +8 -1
- package/lib/esm/aigne-hub-model.js +8 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.6](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.8.5...aigne-hub-v0.8.6) (2025-09-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **transport:** improve HTTP client option handling and error serialization ([#445](https://github.com/AIGNE-io/aigne-framework/issues/445)) ([d3bcdd2](https://github.com/AIGNE-io/aigne-framework/commit/d3bcdd23ab8011a7d40fc157fd61eb240494c7a5))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/anthropic bumped to 0.11.17
|
|
16
|
+
* @aigne/bedrock bumped to 0.9.17
|
|
17
|
+
* @aigne/core bumped to 1.57.5
|
|
18
|
+
* @aigne/deepseek bumped to 0.7.36
|
|
19
|
+
* @aigne/doubao bumped to 1.0.30
|
|
20
|
+
* @aigne/gemini bumped to 0.11.6
|
|
21
|
+
* @aigne/ideogram bumped to 0.3.6
|
|
22
|
+
* @aigne/ollama bumped to 0.7.36
|
|
23
|
+
* @aigne/open-router bumped to 0.7.36
|
|
24
|
+
* @aigne/openai bumped to 0.13.7
|
|
25
|
+
* @aigne/poe bumped to 1.0.16
|
|
26
|
+
* @aigne/transport bumped to 0.14.16
|
|
27
|
+
* @aigne/xai bumped to 0.7.36
|
|
28
|
+
* devDependencies
|
|
29
|
+
* @aigne/test-utils bumped to 0.5.43
|
|
30
|
+
|
|
31
|
+
## [0.8.5](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.8.4...aigne-hub-v0.8.5) (2025-08-30)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Dependencies
|
|
35
|
+
|
|
36
|
+
* The following workspace dependencies were updated
|
|
37
|
+
* dependencies
|
|
38
|
+
* @aigne/anthropic bumped to 0.11.16
|
|
39
|
+
* @aigne/bedrock bumped to 0.9.16
|
|
40
|
+
* @aigne/core bumped to 1.57.4
|
|
41
|
+
* @aigne/deepseek bumped to 0.7.35
|
|
42
|
+
* @aigne/doubao bumped to 1.0.29
|
|
43
|
+
* @aigne/gemini bumped to 0.11.5
|
|
44
|
+
* @aigne/ideogram bumped to 0.3.5
|
|
45
|
+
* @aigne/ollama bumped to 0.7.35
|
|
46
|
+
* @aigne/open-router bumped to 0.7.35
|
|
47
|
+
* @aigne/openai bumped to 0.13.6
|
|
48
|
+
* @aigne/poe bumped to 1.0.15
|
|
49
|
+
* @aigne/transport bumped to 0.14.15
|
|
50
|
+
* @aigne/xai bumped to 0.7.35
|
|
51
|
+
* devDependencies
|
|
52
|
+
* @aigne/test-utils bumped to 0.5.42
|
|
53
|
+
|
|
3
54
|
## [0.8.4](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.8.3...aigne-hub-v0.8.4) (2025-08-30)
|
|
4
55
|
|
|
5
56
|
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
[](https://www.npmjs.com/package/@aigne/aigne-hub)
|
|
15
15
|
[](https://github.com/AIGNE-io/aigne-framework/blob/main/LICENSE.md)
|
|
16
16
|
|
|
17
|
-
AIGNE SDK for accessing AI chat models via [AIGNE Hub](https://github.com/AIGNE-io/aigne-framework), a unified proxy layer for multiple LLM providers.
|
|
17
|
+
AIGNE SDK for accessing AI chat models and image generation via [AIGNE Hub](https://github.com/AIGNE-io/aigne-framework), a unified proxy layer for multiple LLM providers.
|
|
18
18
|
|
|
19
19
|
# Introduction
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ It enables you to switch providers without changing your client-side logic.
|
|
|
25
25
|
<picture>
|
|
26
26
|
<source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/assets/aigne-hub-dark.png" media="(prefers-color-scheme: dark)">
|
|
27
27
|
<source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/assets/aigne-hub.png" media="(prefers-color-scheme: light)">
|
|
28
|
-
<img src="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/aigne-hub.png" alt="AIGNE Arch" />
|
|
28
|
+
<img src="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/assets/aigne-hub.png" alt="AIGNE Arch" />
|
|
29
29
|
</picture>
|
|
30
30
|
|
|
31
31
|
## Supported Providers
|
|
@@ -60,6 +60,7 @@ type AIProvider =
|
|
|
60
60
|
* 🧠 Multi-provider Support: Choose from any supported vendor via the model name
|
|
61
61
|
* 🔐 API Key Security: Use accessKey to manage authentication and authorization
|
|
62
62
|
* 💬 Chat Completions: Works with standard messages format ({ role, content })
|
|
63
|
+
* 🎨 Image Generation: Generate images using OpenAI DALL-E, Google Gemini Imagen, and Ideogram models
|
|
63
64
|
* 🌊 Streaming Support: Enable streaming: true for real-time token-level responses
|
|
64
65
|
* 🧱 Framework Compatible: Seamless integration with the AIGNE Framework
|
|
65
66
|
|
|
@@ -111,6 +112,123 @@ console.log(result);
|
|
|
111
112
|
*/
|
|
112
113
|
```
|
|
113
114
|
|
|
115
|
+
## Image Generation
|
|
116
|
+
|
|
117
|
+
AIGNE Hub supports multiple image generation models from different providers. Here are examples for each supported platform with their available parameters:
|
|
118
|
+
|
|
119
|
+
### OpenAI DALL-E Models
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { AIGNEHubImageModel } from "@aigne/aigne-hub";
|
|
123
|
+
|
|
124
|
+
const model = new AIGNEHubImageModel({
|
|
125
|
+
url: "https://your-aigne-hub-instance/ai-kit",
|
|
126
|
+
accessKey: "your-access-key-secret",
|
|
127
|
+
model: "openai/dall-e-3",
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const result = await model.invoke({
|
|
131
|
+
prompt: "A futuristic cityscape with flying cars and neon lights",
|
|
132
|
+
n: 1,
|
|
133
|
+
size: "1024x1024",
|
|
134
|
+
quality: "standard",
|
|
135
|
+
style: "natural",
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
console.log(result);
|
|
139
|
+
/* Example Output:
|
|
140
|
+
{
|
|
141
|
+
images: [{ url: "https://..." }],
|
|
142
|
+
usage: { inputTokens: 0, outputTokens: 0 },
|
|
143
|
+
model: "openai/dall-e-3"
|
|
144
|
+
}
|
|
145
|
+
*/
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Available Parameters:**
|
|
149
|
+
- **DALL-E 2**: `prompt`, `size`, `n`
|
|
150
|
+
- **DALL-E 3**: `prompt`, `size`, `n`, `quality`, `style`, `user`
|
|
151
|
+
- **GPT-Image-1**: `prompt`, `size`, `background`, `moderation`, `outputCompression`, `outputFormat`, `quality`, `user`, `stream`
|
|
152
|
+
|
|
153
|
+
**Reference:** [OpenAI Images API Documentation](https://platform.openai.com/docs/guides/images)
|
|
154
|
+
|
|
155
|
+
### Google Gemini Imagen Models
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
import { AIGNEHubImageModel } from "@aigne/aigne-hub";
|
|
159
|
+
|
|
160
|
+
const model = new AIGNEHubImageModel({
|
|
161
|
+
url: "https://your-aigne-hub-instance/ai-kit",
|
|
162
|
+
accessKey: "your-access-key-secret",
|
|
163
|
+
model: "google/imagen-4.0-generate-001",
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const result = await model.invoke({
|
|
167
|
+
prompt: "A serene mountain landscape at sunset",
|
|
168
|
+
n: 1,
|
|
169
|
+
imageSize: "1024x1024",
|
|
170
|
+
aspectRatio: "1:1",
|
|
171
|
+
guidanceScale: 7.5,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
console.log(result);
|
|
175
|
+
/* Example Output:
|
|
176
|
+
{
|
|
177
|
+
images: [{ base64: "..." }],
|
|
178
|
+
usage: { inputTokens: 0, outputTokens: 0 },
|
|
179
|
+
model: "google/imagen-4.0-generate-001"
|
|
180
|
+
}
|
|
181
|
+
*/
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Available Parameters:**
|
|
185
|
+
- **Imagen Models**: `seed`, `safetyFilterLevel`, `personGeneration`, `outputMimeType`, `outputGcsUri`, `outputCompressionQuality`, `negativePrompt`, `language`, `includeSafetyAttributes`, `includeRaiReason`, `imageSize`, `guidanceScale`, `aspectRatio`, `addWatermark`
|
|
186
|
+
- **Gemini Models**: `seed`, `safetySettings`, `temperature`, `topP`, `topK`, `maxOutputTokens`, `stopSequences`, `systemInstruction`, `tools`, `toolConfig`, `safetySettings`, `responseSchema`, `responseJsonSchema`
|
|
187
|
+
|
|
188
|
+
**Note:** Gemini image models currently only support base64 format output.
|
|
189
|
+
|
|
190
|
+
**Reference:**
|
|
191
|
+
- **Imagen Models**: Refer to [Google GenAI Models.generateImages()](https://googleapis.github.io/js-genai/release_docs/classes/models.Models.html#generateimages)
|
|
192
|
+
- **Gemini Models**: Refer to [Google GenAI Models.generateContent()](https://googleapis.github.io/js-genai/release_docs/classes/models.Models.html#generatecontent)
|
|
193
|
+
|
|
194
|
+
### Ideogram Models
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import { AIGNEHubImageModel } from "@aigne/aigne-hub";
|
|
198
|
+
|
|
199
|
+
const model = new AIGNEHubImageModel({
|
|
200
|
+
url: "https://your-aigne-hub-instance/ai-kit",
|
|
201
|
+
accessKey: "your-access-key-secret",
|
|
202
|
+
model: "ideogram/ideogram-v3",
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const result = await model.invoke({
|
|
206
|
+
prompt: "A cyberpunk character with glowing blue eyes",
|
|
207
|
+
n: 1,
|
|
208
|
+
resolution: "1024x1024",
|
|
209
|
+
aspectRatio: "1:1",
|
|
210
|
+
renderingSpeed: "fast",
|
|
211
|
+
styleType: "cinematic",
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
console.log(result);
|
|
215
|
+
/* Example Output:
|
|
216
|
+
{
|
|
217
|
+
images: [{ url: "https://..." }],
|
|
218
|
+
usage: { inputTokens: 0, outputTokens: 0 },
|
|
219
|
+
model: "ideogram/ideogram-v3"
|
|
220
|
+
}
|
|
221
|
+
*/
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Available Parameters:**
|
|
225
|
+
- `prompt`, `seed`, `resolution`, `aspectRatio`, `renderingSpeed`, `magicPrompt`, `negativePrompt`, `colorPalette`, `styleCodes`, `styleType`
|
|
226
|
+
|
|
227
|
+
**Note:** Currently only supports `ideogram-v3` model.
|
|
228
|
+
|
|
229
|
+
**Reference:** [Ideogram API Documentation](https://developer.ideogram.ai/api-reference/api-reference/generate-v3)
|
|
230
|
+
|
|
231
|
+
|
|
114
232
|
## Streaming Usage
|
|
115
233
|
|
|
116
234
|
```typescript
|
|
@@ -153,6 +271,13 @@ interface ClientChatModelOptions {
|
|
|
153
271
|
model: string; // Model name with provider prefix (e.g. openai/gpt-4o-mini)
|
|
154
272
|
modelOptions?: object; // Optional model-specific parameters
|
|
155
273
|
}
|
|
274
|
+
|
|
275
|
+
interface ClientImageModelOptions {
|
|
276
|
+
url: string; // Your AIGNE Hub endpoint
|
|
277
|
+
accessKey: string; // API access key
|
|
278
|
+
model: string; // Model name with provider prefix (e.g. openai/dall-e-3)
|
|
279
|
+
modelOptions?: object; // Optional model-specific parameters
|
|
280
|
+
}
|
|
156
281
|
```
|
|
157
282
|
|
|
158
283
|
## License
|
|
@@ -56,7 +56,14 @@ class AIGNEHubChatModel extends core_1.ChatModel {
|
|
|
56
56
|
BLOCKLET_APP_PID ||
|
|
57
57
|
ABT_NODE_DID ||
|
|
58
58
|
`@aigne/aigne-hub:${typeof process !== "undefined" ? index_js_1.nodejs.os.hostname() : "unknown"}`;
|
|
59
|
-
return (await this.client).__invoke(undefined,
|
|
59
|
+
return (await this.client).__invoke(undefined, {
|
|
60
|
+
...input,
|
|
61
|
+
modelOptions: {
|
|
62
|
+
...this.options.modelOptions,
|
|
63
|
+
...input.modelOptions,
|
|
64
|
+
model: input.modelOptions?.model || (await this.credential).model,
|
|
65
|
+
},
|
|
66
|
+
}, {
|
|
60
67
|
...options,
|
|
61
68
|
fetchOptions: {
|
|
62
69
|
...options.fetchOptions,
|
|
@@ -53,7 +53,14 @@ export class AIGNEHubChatModel extends ChatModel {
|
|
|
53
53
|
BLOCKLET_APP_PID ||
|
|
54
54
|
ABT_NODE_DID ||
|
|
55
55
|
`@aigne/aigne-hub:${typeof process !== "undefined" ? nodejs.os.hostname() : "unknown"}`;
|
|
56
|
-
return (await this.client).__invoke(undefined,
|
|
56
|
+
return (await this.client).__invoke(undefined, {
|
|
57
|
+
...input,
|
|
58
|
+
modelOptions: {
|
|
59
|
+
...this.options.modelOptions,
|
|
60
|
+
...input.modelOptions,
|
|
61
|
+
model: input.modelOptions?.model || (await this.credential).model,
|
|
62
|
+
},
|
|
63
|
+
}, {
|
|
57
64
|
...options,
|
|
58
65
|
fetchOptions: {
|
|
59
66
|
...options.fetchOptions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/aigne-hub",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "AIGNE Hub SDK for integrating with Hub AI models",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"https-proxy-agent": "^7.0.6",
|
|
40
40
|
"ufo": "^1.6.1",
|
|
41
41
|
"zod": "^3.25.67",
|
|
42
|
-
"@aigne/
|
|
43
|
-
"@aigne/
|
|
44
|
-
"@aigne/
|
|
45
|
-
"@aigne/
|
|
46
|
-
"@aigne/
|
|
47
|
-
"@aigne/
|
|
48
|
-
"@aigne/ollama": "^0.7.
|
|
49
|
-
"@aigne/
|
|
42
|
+
"@aigne/anthropic": "^0.11.17",
|
|
43
|
+
"@aigne/bedrock": "^0.9.17",
|
|
44
|
+
"@aigne/deepseek": "^0.7.36",
|
|
45
|
+
"@aigne/core": "^1.57.5",
|
|
46
|
+
"@aigne/gemini": "^0.11.6",
|
|
47
|
+
"@aigne/ideogram": "^0.3.6",
|
|
48
|
+
"@aigne/ollama": "^0.7.36",
|
|
49
|
+
"@aigne/open-router": "^0.7.36",
|
|
50
|
+
"@aigne/doubao": "^1.0.30",
|
|
51
|
+
"@aigne/openai": "^0.13.7",
|
|
50
52
|
"@aigne/platform-helpers": "^0.6.2",
|
|
51
|
-
"@aigne/
|
|
52
|
-
"@aigne/
|
|
53
|
-
"@aigne/
|
|
54
|
-
"@aigne/xai": "^0.7.34",
|
|
55
|
-
"@aigne/poe": "^1.0.14"
|
|
53
|
+
"@aigne/poe": "^1.0.16",
|
|
54
|
+
"@aigne/transport": "^0.14.16",
|
|
55
|
+
"@aigne/xai": "^0.7.36"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/bun": "^1.2.18",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"npm-run-all": "^4.1.5",
|
|
62
62
|
"rimraf": "^6.0.1",
|
|
63
63
|
"typescript": "^5.8.3",
|
|
64
|
-
"@aigne/test-utils": "^0.5.
|
|
64
|
+
"@aigne/test-utils": "^0.5.43"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"lint": "tsc --noEmit",
|