seacloud-sdk 0.10.2 → 0.10.3
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 +51 -51
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
# SeaCloud SDK
|
|
2
2
|
|
|
3
|
-
SeaCloud SDK for JavaScript/TypeScript -
|
|
3
|
+
Official SeaCloud SDK for JavaScript/TypeScript - Call SeaCloud AI services with ease.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
- 🤖 **Agent Chat API** -
|
|
8
|
-
- 🎨
|
|
9
|
-
- 🎬
|
|
10
|
-
- 🎵
|
|
11
|
-
- 🔄
|
|
12
|
-
- 📦 **TypeScript
|
|
7
|
+
- 🤖 **Agent Chat API** - Multi-turn conversations, tool calling, streaming output
|
|
8
|
+
- 🎨 **Image Generation** - Support for multiple AI image generation models
|
|
9
|
+
- 🎬 **Video Generation** - Text-to-Video, Image-to-Video
|
|
10
|
+
- 🎵 **Music Generation** - Song and lyrics generation
|
|
11
|
+
- 🔄 **Streaming Response** - Real-time AI responses
|
|
12
|
+
- 📦 **TypeScript Support** - Complete type definitions
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
pnpm install seacloud-sdk
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Quick Start
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### Initialize SDK
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
25
|
import { initSeacloud, agentChatCompletions, createTextMessage } from 'seacloud-sdk';
|
|
26
26
|
|
|
27
|
-
//
|
|
27
|
+
// Initialize SDK
|
|
28
28
|
initSeacloud({
|
|
29
29
|
apiKey: 'your-api-key',
|
|
30
30
|
baseUrl: 'https://proxy-rs.seaverse.ai',
|
|
31
|
-
xProject: 'SeaArt', //
|
|
31
|
+
xProject: 'SeaArt', // Optional, defaults to 'SeaVerse'
|
|
32
32
|
});
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
###
|
|
35
|
+
### Simple Chat
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
38
|
const response = await agentChatCompletions({
|
|
@@ -46,7 +46,7 @@ const response = await agentChatCompletions({
|
|
|
46
46
|
console.log(response.choices[0].message.content);
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### Streaming Chat
|
|
50
50
|
|
|
51
51
|
```typescript
|
|
52
52
|
const stream = await agentChatCompletions({
|
|
@@ -66,102 +66,102 @@ for await (const chunk of stream) {
|
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
##
|
|
69
|
+
## Configuration Options
|
|
70
70
|
|
|
71
71
|
### initSeacloud(options)
|
|
72
72
|
|
|
73
|
-
|
|
|
74
|
-
|
|
75
|
-
| `apiKey` | `string` | - | API
|
|
76
|
-
| `baseUrl` | `string` | `https://proxy-rs.seaverse.ai` | API
|
|
77
|
-
| `timeout` | `number` | `30000` |
|
|
78
|
-
| `intervalMs` | `number` | `3000` |
|
|
79
|
-
| `maxAttempts` | `number` | `100` |
|
|
80
|
-
| `xProject` | `string` | `'SeaVerse'` | X-Project header
|
|
73
|
+
| Parameter | Type | Default | Description |
|
|
74
|
+
|-----------|------|---------|-------------|
|
|
75
|
+
| `apiKey` | `string` | - | API key, can also be set via `API_SERVICE_TOKEN` environment variable |
|
|
76
|
+
| `baseUrl` | `string` | `https://proxy-rs.seaverse.ai` | API server URL |
|
|
77
|
+
| `timeout` | `number` | `30000` | Request timeout in milliseconds |
|
|
78
|
+
| `intervalMs` | `number` | `3000` | Polling interval in milliseconds |
|
|
79
|
+
| `maxAttempts` | `number` | `100` | Maximum polling attempts |
|
|
80
|
+
| `xProject` | `string` | `'SeaVerse'` | X-Project header value for project identification |
|
|
81
81
|
|
|
82
|
-
### xProject
|
|
82
|
+
### xProject Parameter
|
|
83
83
|
|
|
84
|
-
`xProject`
|
|
84
|
+
The `xProject` parameter sets the `X-Project` request header to identify the source project. Different projects may have different quotas and permissions:
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
|
-
// SeaArt
|
|
87
|
+
// SeaArt project
|
|
88
88
|
initSeacloud({
|
|
89
89
|
apiKey: 'your-api-key',
|
|
90
90
|
xProject: 'SeaArt',
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
// KIIRA
|
|
93
|
+
// KIIRA project
|
|
94
94
|
initSeacloud({
|
|
95
95
|
apiKey: 'your-api-key',
|
|
96
96
|
xProject: 'KIIRA',
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
//
|
|
99
|
+
// Default: SeaVerse
|
|
100
100
|
initSeacloud({
|
|
101
101
|
apiKey: 'your-api-key',
|
|
102
|
-
// xProject
|
|
102
|
+
// xProject defaults to 'SeaVerse'
|
|
103
103
|
});
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
## Token
|
|
106
|
+
## Token Priority
|
|
107
107
|
|
|
108
|
-
SDK
|
|
108
|
+
The SDK retrieves API tokens in the following priority order:
|
|
109
109
|
|
|
110
|
-
1. `initSeacloud({ apiKey: '...' })`
|
|
111
|
-
2.
|
|
112
|
-
3. Node.js
|
|
110
|
+
1. `apiKey` passed to `initSeacloud({ apiKey: '...' })`
|
|
111
|
+
2. Browser environment: `localStorage.getItem('auth_token')`
|
|
112
|
+
3. Node.js environment: `process.env.API_SERVICE_TOKEN`
|
|
113
113
|
|
|
114
|
-
##
|
|
114
|
+
## Environment Variables
|
|
115
115
|
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
| `API_SERVICE_TOKEN` | API
|
|
119
|
-
| `SEACLOUD_BASE_URL` | API
|
|
116
|
+
| Variable | Description |
|
|
117
|
+
|----------|-------------|
|
|
118
|
+
| `API_SERVICE_TOKEN` | API key |
|
|
119
|
+
| `SEACLOUD_BASE_URL` | API server URL |
|
|
120
120
|
|
|
121
|
-
## API
|
|
121
|
+
## API Reference
|
|
122
122
|
|
|
123
123
|
### Agent Chat API
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
126
|
import { agentChatCompletions, createTextMessage, createImageMessage, createTool } from 'seacloud-sdk';
|
|
127
127
|
|
|
128
|
-
//
|
|
128
|
+
// Text message
|
|
129
129
|
const textMessage = createTextMessage('user', 'Hello!');
|
|
130
130
|
|
|
131
|
-
//
|
|
131
|
+
// Image message
|
|
132
132
|
const imageMessage = createImageMessage('user', 'What is this?', 'https://example.com/image.jpg');
|
|
133
133
|
|
|
134
|
-
//
|
|
134
|
+
// Create tool
|
|
135
135
|
const tool = createTool('seagen_text2image_flux1d_artifact_tool');
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
###
|
|
138
|
+
### Available Tools
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
**Image Generation:**
|
|
141
141
|
- `seagen_text2image_flux1d_artifact_tool`
|
|
142
142
|
- `seagen_text2image_seedream40_artifact_tool`
|
|
143
143
|
- `seagen_text2image_google_gemini3_pro_image_artifact_tool`
|
|
144
144
|
- `seagen_blackforestlabs_flux_2_pro_tool`
|
|
145
145
|
- `mm_volces_seedream_4_5_gateway_tool`
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
**Image Editing:**
|
|
148
148
|
- `seagen_edit_image_google_artifact_tool`
|
|
149
149
|
- `seagen_blackforestlabs_flux_2_pro_edit_tool`
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
**Video Generation:**
|
|
152
152
|
- `seagen_image2video_wanx26_artifact_tool`
|
|
153
153
|
- `seagen_text2video_wanx26_artifact_tool`
|
|
154
154
|
- `seagen_image2video_seedance_pro_fast_artifact_tool`
|
|
155
155
|
- `mm_text2video_kling_v2_6_gateway_tool`
|
|
156
156
|
- `mm_image2video_kling_v2_6_i2v_gateway_tool`
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
**Music Generation:**
|
|
159
159
|
- `seagen_text2song_mureka_artifact_tool`
|
|
160
160
|
- `seagen_text2lyrics_mureka_artifact_tool`
|
|
161
161
|
|
|
162
|
-
##
|
|
162
|
+
## Examples
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
For more examples, see [examples_agent.ts](./examples_agent.ts)
|
|
165
165
|
|
|
166
166
|
## License
|
|
167
167
|
|