@scalix-world/sdk 0.0.1 → 1.1.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/LICENSE +21 -0
- package/README.md +155 -1
- package/dist/client.d.ts +56 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +71 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +61 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/services/account.d.ts +27 -0
- package/dist/services/account.d.ts.map +1 -0
- package/dist/services/account.js +16 -0
- package/dist/services/account.js.map +1 -0
- package/dist/services/audio.d.ts +27 -0
- package/dist/services/audio.d.ts.map +1 -0
- package/dist/services/audio.js +27 -0
- package/dist/services/audio.js.map +1 -0
- package/dist/services/base.d.ts +17 -0
- package/dist/services/base.d.ts.map +1 -0
- package/dist/services/base.js +169 -0
- package/dist/services/base.js.map +1 -0
- package/dist/services/docgen.d.ts +62 -0
- package/dist/services/docgen.d.ts.map +1 -0
- package/dist/services/docgen.js +43 -0
- package/dist/services/docgen.js.map +1 -0
- package/dist/services/images.d.ts +34 -0
- package/dist/services/images.d.ts.map +1 -0
- package/dist/services/images.js +23 -0
- package/dist/services/images.js.map +1 -0
- package/dist/services/index.d.ts +20 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +11 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/models.d.ts +16 -0
- package/dist/services/models.d.ts.map +1 -0
- package/dist/services/models.js +12 -0
- package/dist/services/models.js.map +1 -0
- package/dist/services/rag.d.ts +43 -0
- package/dist/services/rag.d.ts.map +1 -0
- package/dist/services/rag.js +20 -0
- package/dist/services/rag.js.map +1 -0
- package/dist/services/research.d.ts +23 -0
- package/dist/services/research.d.ts.map +1 -0
- package/dist/services/research.js +16 -0
- package/dist/services/research.js.map +1 -0
- package/dist/services/storage.d.ts +9 -0
- package/dist/services/storage.d.ts.map +1 -0
- package/dist/services/storage.js +9 -0
- package/dist/services/storage.js.map +1 -0
- package/dist/services/text.d.ts +61 -0
- package/dist/services/text.d.ts.map +1 -0
- package/dist/services/text.js +38 -0
- package/dist/services/text.js.map +1 -0
- package/package.json +55 -5
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Scalix World Private Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,155 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Scalix SDK — TypeScript
|
|
2
|
+
|
|
3
|
+
One SDK, one API key. `scalix.completions` gives you full OpenAI-compatible chat (tools, vision, streaming). The rest of the SDK gives you Research, RAG, DocGen, Audio, Images, Text — services that only Scalix has.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @scalix-world/sdk openai
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Scalix } from '@scalix-world/sdk';
|
|
15
|
+
|
|
16
|
+
const scalix = new Scalix('sk_scalix_...');
|
|
17
|
+
|
|
18
|
+
// Chat completions — full OpenAI-compatible (tools, vision, streaming)
|
|
19
|
+
const response = await scalix.completions.create({
|
|
20
|
+
model: 'scalix-world-ai',
|
|
21
|
+
messages: [{ role: 'user', content: 'Hello!' }],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Streaming
|
|
25
|
+
const stream = await scalix.completions.create({
|
|
26
|
+
model: 'scalix-world-ai',
|
|
27
|
+
messages: [{ role: 'user', content: 'Tell me a story' }],
|
|
28
|
+
stream: true,
|
|
29
|
+
});
|
|
30
|
+
for await (const chunk of stream) {
|
|
31
|
+
process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Platform Services
|
|
36
|
+
|
|
37
|
+
These are Scalix-only services — no other SDK can reach them.
|
|
38
|
+
|
|
39
|
+
### Research — web search and deep research
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
const results = await scalix.research.search('quantum computing');
|
|
43
|
+
const report = await scalix.research.deep('AI trends 2026');
|
|
44
|
+
const answer = await scalix.research.research('What is GraphQL?');
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Text — sentiment, summarization, translation, grammar, autocomplete
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const sentiment = await scalix.text.sentiment('I love this product!');
|
|
51
|
+
const summary = await scalix.text.summarize(longArticle);
|
|
52
|
+
const translated = await scalix.text.translate('Hello', 'es');
|
|
53
|
+
const grammar = await scalix.text.grammar('Me and him goes to store');
|
|
54
|
+
const completion = await scalix.text.autocomplete('The quick brown');
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Audio — transcription and text-to-speech
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
const transcript = await scalix.audio.transcribe(audioBlob);
|
|
61
|
+
const audio = await scalix.audio.speak('Hello world', { voice: 'af_heart' });
|
|
62
|
+
const voices = await scalix.audio.voices();
|
|
63
|
+
const languages = await scalix.audio.languages();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Images — generation with sync and async modes
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const image = await scalix.images.generate('A sunset over mountains');
|
|
70
|
+
const job = await scalix.images.generateAsync('A detailed cityscape');
|
|
71
|
+
const status = await scalix.images.getJob(job.job_id);
|
|
72
|
+
const models = await scalix.images.models();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Document Generation — PDF, DOCX, CSV, XLSX
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const doc = await scalix.docgen.create({ prompt: 'Q1 report', format: 'pdf' });
|
|
79
|
+
const history = await scalix.docgen.history();
|
|
80
|
+
const formats = await scalix.docgen.formats();
|
|
81
|
+
const templates = await scalix.docgen.templates();
|
|
82
|
+
await scalix.docgen.share(doc.doc_id, 'colleague@company.com');
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### RAG — upload and query documents
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const doc = await scalix.rag.upload(pdfBlob, { filename: 'report.pdf' });
|
|
89
|
+
const answer = await scalix.rag.query('revenue growth');
|
|
90
|
+
const docs = await scalix.rag.documents();
|
|
91
|
+
await scalix.rag.deleteDocument(docId);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Storage — presigned upload URLs
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const { uploadUrl } = await scalix.storage.getUploadUrl('application/pdf');
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Account — health, info, budget, usage
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const health = await scalix.account.health();
|
|
104
|
+
const info = await scalix.account.info(); // email, plan
|
|
105
|
+
const budget = await scalix.account.budget(); // credits remaining
|
|
106
|
+
const usage = await scalix.account.usage(); // usage stats
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Models — list available models
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
const models = await scalix.models.list();
|
|
113
|
+
// Each model includes: id, context_window, max_output_tokens, plan_required
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Configuration
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const scalix = new Scalix('sk_scalix_...', {
|
|
120
|
+
baseURL: 'https://api.scalix.world', // default
|
|
121
|
+
maxRetries: 2, // auto-retry with exponential backoff
|
|
122
|
+
timeout: 60000, // request timeout in ms
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Available Models
|
|
127
|
+
|
|
128
|
+
| Model | Description | Best For |
|
|
129
|
+
|-------|-------------|----------|
|
|
130
|
+
| `scalix-world-ai` | Default model — fast, balanced | General use, chat, quick tasks |
|
|
131
|
+
| `scalix-world-advanced` | Most capable — deep reasoning | Complex analysis, coding, agents |
|
|
132
|
+
|
|
133
|
+
Plus 12 more models — run `scalix.models.list()` to see all available for your plan.
|
|
134
|
+
|
|
135
|
+
## Error Handling
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { Scalix, ScalixError, AuthenticationError, RateLimitError } from '@scalix-world/sdk';
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
await scalix.research.search('...');
|
|
142
|
+
} catch (error) {
|
|
143
|
+
if (error instanceof AuthenticationError) {
|
|
144
|
+
console.error('Invalid API key');
|
|
145
|
+
} else if (error instanceof RateLimitError) {
|
|
146
|
+
console.error('Rate limited — SDK retries automatically');
|
|
147
|
+
} else if (error instanceof ScalixError) {
|
|
148
|
+
console.error('API error:', error.message);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT — see [LICENSE](./LICENSE) for details.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scalix — unified client for the Scalix platform.
|
|
3
|
+
*
|
|
4
|
+
* Chat completions delegate to the OpenAI SDK (Scalix's API is OpenAI-compatible).
|
|
5
|
+
* Platform services (research, RAG, database, etc.) use a native HTTP client.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { Scalix } from '@scalix-world/sdk';
|
|
10
|
+
*
|
|
11
|
+
* const scalix = new Scalix('sk_scalix_...');
|
|
12
|
+
*
|
|
13
|
+
* // Chat — full OpenAI-compatible (tools, vision, streaming)
|
|
14
|
+
* const response = await scalix.completions.create({
|
|
15
|
+
* model: 'scalix-world-ai',
|
|
16
|
+
* messages: [{ role: 'user', content: 'Hello!' }],
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Platform services
|
|
20
|
+
* const results = await scalix.research.search('AI trends');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import OpenAI from 'openai';
|
|
24
|
+
import { AccountService } from './services/account.js';
|
|
25
|
+
import { AudioService } from './services/audio.js';
|
|
26
|
+
import { DocGenService } from './services/docgen.js';
|
|
27
|
+
import { ImagesService } from './services/images.js';
|
|
28
|
+
import { ModelsService } from './services/models.js';
|
|
29
|
+
import { RAGService } from './services/rag.js';
|
|
30
|
+
import { ResearchService } from './services/research.js';
|
|
31
|
+
import { StorageService } from './services/storage.js';
|
|
32
|
+
import { TextService } from './services/text.js';
|
|
33
|
+
export interface ScalixOptions {
|
|
34
|
+
baseURL?: string;
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
timeout?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare class Scalix {
|
|
39
|
+
/** OpenAI-compatible chat completions — full tool calling, vision, streaming */
|
|
40
|
+
readonly completions: OpenAI['chat']['completions'];
|
|
41
|
+
/** Pre-configured OpenAI client for advanced usage (embeddings, raw access, etc.) */
|
|
42
|
+
readonly openai: OpenAI;
|
|
43
|
+
readonly account: AccountService;
|
|
44
|
+
readonly audio: AudioService;
|
|
45
|
+
readonly docgen: DocGenService;
|
|
46
|
+
readonly images: ImagesService;
|
|
47
|
+
readonly models: ModelsService;
|
|
48
|
+
readonly rag: RAGService;
|
|
49
|
+
readonly research: ResearchService;
|
|
50
|
+
readonly storage: StorageService;
|
|
51
|
+
readonly text: TextService;
|
|
52
|
+
constructor(apiKey: string, options?: ScalixOptions);
|
|
53
|
+
}
|
|
54
|
+
/** @deprecated Use `Scalix` instead */
|
|
55
|
+
export declare const ScalixClient: typeof Scalix;
|
|
56
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,MAAM;IACjB,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;IAEpD,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;gBAEf,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CAwBpD;AAED,uCAAuC;AACvC,eAAO,MAAM,YAAY,eAAS,CAAC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scalix — unified client for the Scalix platform.
|
|
3
|
+
*
|
|
4
|
+
* Chat completions delegate to the OpenAI SDK (Scalix's API is OpenAI-compatible).
|
|
5
|
+
* Platform services (research, RAG, database, etc.) use a native HTTP client.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { Scalix } from '@scalix-world/sdk';
|
|
10
|
+
*
|
|
11
|
+
* const scalix = new Scalix('sk_scalix_...');
|
|
12
|
+
*
|
|
13
|
+
* // Chat — full OpenAI-compatible (tools, vision, streaming)
|
|
14
|
+
* const response = await scalix.completions.create({
|
|
15
|
+
* model: 'scalix-world-ai',
|
|
16
|
+
* messages: [{ role: 'user', content: 'Hello!' }],
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Platform services
|
|
20
|
+
* const results = await scalix.research.search('AI trends');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import OpenAI from 'openai';
|
|
24
|
+
import { AccountService } from './services/account.js';
|
|
25
|
+
import { AudioService } from './services/audio.js';
|
|
26
|
+
import { DocGenService } from './services/docgen.js';
|
|
27
|
+
import { ImagesService } from './services/images.js';
|
|
28
|
+
import { ModelsService } from './services/models.js';
|
|
29
|
+
import { RAGService } from './services/rag.js';
|
|
30
|
+
import { ResearchService } from './services/research.js';
|
|
31
|
+
import { StorageService } from './services/storage.js';
|
|
32
|
+
import { TextService } from './services/text.js';
|
|
33
|
+
export class Scalix {
|
|
34
|
+
/** OpenAI-compatible chat completions — full tool calling, vision, streaming */
|
|
35
|
+
completions;
|
|
36
|
+
/** Pre-configured OpenAI client for advanced usage (embeddings, raw access, etc.) */
|
|
37
|
+
openai;
|
|
38
|
+
account;
|
|
39
|
+
audio;
|
|
40
|
+
docgen;
|
|
41
|
+
images;
|
|
42
|
+
models;
|
|
43
|
+
rag;
|
|
44
|
+
research;
|
|
45
|
+
storage;
|
|
46
|
+
text;
|
|
47
|
+
constructor(apiKey, options) {
|
|
48
|
+
const base = options?.baseURL ?? 'https://api.scalix.world';
|
|
49
|
+
const baseURL = base.endsWith('/v1') ? base : `${base}/v1`;
|
|
50
|
+
const baseUrl = baseURL.replace(/\/v1$/, '');
|
|
51
|
+
const config = { apiKey, baseUrl, maxRetries: options?.maxRetries, timeout: options?.timeout };
|
|
52
|
+
this.openai = new OpenAI({
|
|
53
|
+
baseURL,
|
|
54
|
+
apiKey,
|
|
55
|
+
defaultHeaders: { 'User-Agent': 'Scalix-SDK/2.0' },
|
|
56
|
+
});
|
|
57
|
+
this.completions = this.openai.chat.completions;
|
|
58
|
+
this.account = new AccountService(config);
|
|
59
|
+
this.audio = new AudioService(config);
|
|
60
|
+
this.docgen = new DocGenService(config);
|
|
61
|
+
this.images = new ImagesService(config);
|
|
62
|
+
this.models = new ModelsService(config);
|
|
63
|
+
this.rag = new RAGService(config);
|
|
64
|
+
this.research = new ResearchService(config);
|
|
65
|
+
this.storage = new StorageService(config);
|
|
66
|
+
this.text = new TextService(config);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** @deprecated Use `Scalix` instead */
|
|
70
|
+
export const ScalixClient = Scalix;
|
|
71
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAQjD,MAAM,OAAO,MAAM;IACjB,gFAAgF;IACvE,WAAW,CAAgC;IAEpD,qFAAqF;IAC5E,MAAM,CAAS;IAEf,OAAO,CAAiB;IACxB,KAAK,CAAe;IACpB,MAAM,CAAgB;IACtB,MAAM,CAAgB;IACtB,MAAM,CAAgB;IACtB,GAAG,CAAa;IAChB,QAAQ,CAAkB;IAC1B,OAAO,CAAiB;IACxB,IAAI,CAAc;IAE3B,YAAY,MAAc,EAAE,OAAuB;QACjD,MAAM,IAAI,GAAG,OAAO,EAAE,OAAO,IAAI,0BAA0B,CAAC;QAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC;QAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAE7C,MAAM,MAAM,GAAiB,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QAE7G,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC;YACvB,OAAO;YACP,MAAM;YACN,cAAc,EAAE,EAAE,YAAY,EAAE,gBAAgB,EAAE;SACnD,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;QAEhD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF;AAED,uCAAuC;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":""}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare class ScalixError extends Error {
|
|
2
|
+
code?: string;
|
|
3
|
+
status?: number;
|
|
4
|
+
requestId?: string;
|
|
5
|
+
constructor(message: string, options?: {
|
|
6
|
+
code?: string;
|
|
7
|
+
status?: number;
|
|
8
|
+
requestId?: string;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export declare class AuthenticationError extends ScalixError {
|
|
12
|
+
constructor(message: string, requestId?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class BadRequestError extends ScalixError {
|
|
15
|
+
constructor(message: string, requestId?: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class PermissionDeniedError extends ScalixError {
|
|
18
|
+
constructor(message: string, requestId?: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class NotFoundError extends ScalixError {
|
|
21
|
+
constructor(message: string, requestId?: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class ConflictError extends ScalixError {
|
|
24
|
+
constructor(message: string, requestId?: string);
|
|
25
|
+
}
|
|
26
|
+
export declare class UnprocessableEntityError extends ScalixError {
|
|
27
|
+
constructor(message: string, requestId?: string);
|
|
28
|
+
}
|
|
29
|
+
export declare class RateLimitError extends ScalixError {
|
|
30
|
+
constructor(message: string, requestId?: string);
|
|
31
|
+
}
|
|
32
|
+
export declare class InternalServerError extends ScalixError {
|
|
33
|
+
constructor(message: string, requestId?: string);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEP,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;CAO9F;AAED,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD;AAED,qBAAa,eAAgB,SAAQ,WAAW;gBAClC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;gBACxC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD;AAED,qBAAa,aAAc,SAAQ,WAAW;gBAChC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD;AAED,qBAAa,aAAc,SAAQ,WAAW;gBAChC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD;AAED,qBAAa,wBAAyB,SAAQ,WAAW;gBAC3C,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD;AAED,qBAAa,cAAe,SAAQ,WAAW;gBACjC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD;AAED,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAIhD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export class ScalixError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
status;
|
|
4
|
+
requestId;
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'ScalixError';
|
|
8
|
+
this.code = options?.code;
|
|
9
|
+
this.status = options?.status;
|
|
10
|
+
this.requestId = options?.requestId;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class AuthenticationError extends ScalixError {
|
|
14
|
+
constructor(message, requestId) {
|
|
15
|
+
super(message, { code: 'AUTHENTICATION_ERROR', status: 401, requestId });
|
|
16
|
+
this.name = 'AuthenticationError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class BadRequestError extends ScalixError {
|
|
20
|
+
constructor(message, requestId) {
|
|
21
|
+
super(message, { code: 'BAD_REQUEST', status: 400, requestId });
|
|
22
|
+
this.name = 'BadRequestError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class PermissionDeniedError extends ScalixError {
|
|
26
|
+
constructor(message, requestId) {
|
|
27
|
+
super(message, { code: 'PERMISSION_DENIED', status: 403, requestId });
|
|
28
|
+
this.name = 'PermissionDeniedError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class NotFoundError extends ScalixError {
|
|
32
|
+
constructor(message, requestId) {
|
|
33
|
+
super(message, { code: 'NOT_FOUND', status: 404, requestId });
|
|
34
|
+
this.name = 'NotFoundError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class ConflictError extends ScalixError {
|
|
38
|
+
constructor(message, requestId) {
|
|
39
|
+
super(message, { code: 'CONFLICT', status: 409, requestId });
|
|
40
|
+
this.name = 'ConflictError';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class UnprocessableEntityError extends ScalixError {
|
|
44
|
+
constructor(message, requestId) {
|
|
45
|
+
super(message, { code: 'UNPROCESSABLE_ENTITY', status: 422, requestId });
|
|
46
|
+
this.name = 'UnprocessableEntityError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export class RateLimitError extends ScalixError {
|
|
50
|
+
constructor(message, requestId) {
|
|
51
|
+
super(message, { code: 'RATE_LIMIT_ERROR', status: 429, requestId });
|
|
52
|
+
this.name = 'RateLimitError';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export class InternalServerError extends ScalixError {
|
|
56
|
+
constructor(message, requestId) {
|
|
57
|
+
super(message, { code: 'INTERNAL_SERVER_ERROR', status: 500, requestId });
|
|
58
|
+
this.name = 'InternalServerError';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,SAAS,CAAU;IAEnB,YAAY,OAAe,EAAE,OAAgE;QAC3F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IACvD,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scalix SDK — unified client for the Scalix platform.
|
|
3
|
+
*
|
|
4
|
+
* Chat completions delegate to the OpenAI SDK (Scalix's API is OpenAI-compatible).
|
|
5
|
+
* Platform services (research, RAG, database, etc.) use a native HTTP client.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { Scalix } from '@scalix-world/sdk';
|
|
10
|
+
*
|
|
11
|
+
* const scalix = new Scalix('sk_scalix_...');
|
|
12
|
+
*
|
|
13
|
+
* // Chat — full OpenAI-compatible (tools, vision, streaming)
|
|
14
|
+
* const response = await scalix.completions.create({
|
|
15
|
+
* model: 'scalix-world-ai',
|
|
16
|
+
* messages: [{ role: 'user', content: 'Hello!' }],
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Platform services
|
|
20
|
+
* const results = await scalix.research.search('AI trends');
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
export { Scalix, ScalixClient } from './client.js';
|
|
26
|
+
export type { ScalixOptions } from './client.js';
|
|
27
|
+
export type { ScalixConfig } from './config.js';
|
|
28
|
+
export { ScalixError, AuthenticationError, BadRequestError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from './errors.js';
|
|
29
|
+
export { AccountService, AudioService, DocGenService, ImagesService, ModelsService, RAGService, ResearchService, StorageService, TextService, } from './services/index.js';
|
|
30
|
+
export type { UserInfo, UserBudget, UserUsage, ScalixModel, DocFormat, DocStyle, DocGenOptions, DocGenResult, DocTemplate, DocFormatInfo, ImageGenerateOptions, ImageResult, ImageJobStatus, RAGDocument, RAGQueryResult, RAGUploadResult, SentimentResult, SummaryResult, TranslationResult, GrammarResult, AutocompleteResult, VectorSearchResult, UploadUrlResult, TranscriptionResult, SpeechOptions, SearchResult, ResearchResult, } from './services/index.js';
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,QAAQ,EACR,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scalix SDK — unified client for the Scalix platform.
|
|
3
|
+
*
|
|
4
|
+
* Chat completions delegate to the OpenAI SDK (Scalix's API is OpenAI-compatible).
|
|
5
|
+
* Platform services (research, RAG, database, etc.) use a native HTTP client.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { Scalix } from '@scalix-world/sdk';
|
|
10
|
+
*
|
|
11
|
+
* const scalix = new Scalix('sk_scalix_...');
|
|
12
|
+
*
|
|
13
|
+
* // Chat — full OpenAI-compatible (tools, vision, streaming)
|
|
14
|
+
* const response = await scalix.completions.create({
|
|
15
|
+
* model: 'scalix-world-ai',
|
|
16
|
+
* messages: [{ role: 'user', content: 'Hello!' }],
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Platform services
|
|
20
|
+
* const results = await scalix.research.search('AI trends');
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
export { Scalix, ScalixClient } from './client.js';
|
|
26
|
+
export { ScalixError, AuthenticationError, BadRequestError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from './errors.js';
|
|
27
|
+
export { AccountService, AudioService, DocGenService, ImagesService, ModelsService, RAGService, ResearchService, StorageService, TextService, } from './services/index.js';
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,GACZ,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseService } from './base.js';
|
|
2
|
+
export interface UserInfo {
|
|
3
|
+
id: string;
|
|
4
|
+
email: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
plan: string;
|
|
7
|
+
createdAt?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UserBudget {
|
|
10
|
+
creditsUsed: number;
|
|
11
|
+
creditsLimit: number;
|
|
12
|
+
creditsRemaining: number;
|
|
13
|
+
resetDate?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface UserUsage {
|
|
16
|
+
month: string;
|
|
17
|
+
totalRequests: number;
|
|
18
|
+
totalTokens: number;
|
|
19
|
+
breakdown: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export declare class AccountService extends BaseService {
|
|
22
|
+
health(): Promise<Record<string, unknown>>;
|
|
23
|
+
info(): Promise<UserInfo>;
|
|
24
|
+
budget(): Promise<UserBudget>;
|
|
25
|
+
usage(): Promise<UserUsage>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/services/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,qBAAa,cAAe,SAAQ,WAAW;IAEvC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI1C,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC;IAIzB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC;IAI7B,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC;CAGlC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseService } from './base.js';
|
|
2
|
+
export class AccountService extends BaseService {
|
|
3
|
+
async health() {
|
|
4
|
+
return this.request('GET', '/health');
|
|
5
|
+
}
|
|
6
|
+
async info() {
|
|
7
|
+
return this.request('GET', '/v1/user/info');
|
|
8
|
+
}
|
|
9
|
+
async budget() {
|
|
10
|
+
return this.request('GET', '/v1/user/budget');
|
|
11
|
+
}
|
|
12
|
+
async usage() {
|
|
13
|
+
return this.request('GET', '/v1/user/stats');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/services/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAwBxC,MAAM,OAAO,cAAe,SAAQ,WAAW;IAE7C,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,OAAO,CAAW,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,OAAO,CAAa,KAAK,EAAE,iBAAiB,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,CAAC,OAAO,CAAY,KAAK,EAAE,gBAAgB,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseService } from './base.js';
|
|
2
|
+
export interface TranscriptionResult {
|
|
3
|
+
text: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
duration?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SpeechOptions {
|
|
8
|
+
voice?: string;
|
|
9
|
+
format?: string;
|
|
10
|
+
speed?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class AudioService extends BaseService {
|
|
13
|
+
transcribe(file: Blob, options?: {
|
|
14
|
+
language?: string;
|
|
15
|
+
}): Promise<TranscriptionResult>;
|
|
16
|
+
speak(text: string, options?: SpeechOptions): Promise<Response>;
|
|
17
|
+
voices(): Promise<{
|
|
18
|
+
voices: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
languages(): Promise<{
|
|
24
|
+
languages: string[];
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/services/audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,YAAa,SAAQ,WAAW;IACrC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOrF,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAQ/D,MAAM,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IAIlE,SAAS,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAGpD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseService } from './base.js';
|
|
2
|
+
export class AudioService extends BaseService {
|
|
3
|
+
async transcribe(file, options) {
|
|
4
|
+
const formData = new FormData();
|
|
5
|
+
formData.append('file', file);
|
|
6
|
+
if (options?.language)
|
|
7
|
+
formData.append('language', options.language);
|
|
8
|
+
return this.requestMultipart('/v1/audio/transcribe', formData);
|
|
9
|
+
}
|
|
10
|
+
async speak(text, options) {
|
|
11
|
+
const params = new URLSearchParams({ text });
|
|
12
|
+
if (options?.voice)
|
|
13
|
+
params.set('voice', options.voice);
|
|
14
|
+
if (options?.format)
|
|
15
|
+
params.set('format', options.format);
|
|
16
|
+
if (options?.speed != null)
|
|
17
|
+
params.set('speed', String(options.speed));
|
|
18
|
+
return this.requestRaw('POST', `/v1/audio/speak/kokoro?${params}`);
|
|
19
|
+
}
|
|
20
|
+
async voices() {
|
|
21
|
+
return this.request('GET', '/v1/audio/kokoro/voices');
|
|
22
|
+
}
|
|
23
|
+
async languages() {
|
|
24
|
+
return this.request('GET', '/v1/audio/kokoro/languages');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/services/audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAcxC,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,KAAK,CAAC,UAAU,CAAC,IAAU,EAAE,OAA+B;QAC1D,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9B,IAAI,OAAO,EAAE,QAAQ;YAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,gBAAgB,CAAsB,sBAAsB,EAAE,QAAQ,CAAC,CAAC;IACtF,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,OAAuB;QAC/C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7C,IAAI,OAAO,EAAE,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,OAAO,EAAE,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,OAAO,EAAE,KAAK,IAAI,IAAI;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,0BAA0B,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ScalixConfig } from '../config.js';
|
|
2
|
+
export declare class BaseService {
|
|
3
|
+
protected config: ScalixConfig;
|
|
4
|
+
constructor(config: ScalixConfig);
|
|
5
|
+
private get maxRetries();
|
|
6
|
+
private get timeout();
|
|
7
|
+
protected request<T>(method: string, path: string, options?: {
|
|
8
|
+
body?: unknown;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
}): Promise<T>;
|
|
11
|
+
protected requestRaw(method: string, path: string, options?: {
|
|
12
|
+
body?: unknown;
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
}): Promise<Response>;
|
|
15
|
+
protected requestMultipart<T>(path: string, formData: FormData): Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=base.d.ts.map
|