bios-sdk 0.1.0-dev.1

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 ADDED
@@ -0,0 +1,292 @@
1
+ # bios-sdk
2
+
3
+ Official TypeScript/Node.js SDK for the [BIOS](https://bios.us.com) fine-tuning platform API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install bios-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { BiOS } from 'bios-sdk';
15
+
16
+ const client = new BiOS({
17
+ apiKey: 'usf-...',
18
+ });
19
+
20
+ // Search for models
21
+ const models = await client.models.search({ query: 'llama', type: 'llm' });
22
+ console.log(`Found ${models.total} models`);
23
+
24
+ // Create a training job
25
+ const job = await client.training.create({
26
+ idempotencyKey: 'training-create-20260711-0001',
27
+ model: 'meta-llama/Llama-3.1-8B-Instruct',
28
+ datasetId: 'ds_abc123',
29
+ method: 'sft',
30
+ adapter: 'lora',
31
+ epochs: 3,
32
+ learningRate: 2e-4,
33
+ loraRank: 16,
34
+ gpuType: 'A100_80GB',
35
+ });
36
+ console.log(`Job ${job.id} created`);
37
+ ```
38
+
39
+ ## Authentication
40
+
41
+ ### API Key (recommended)
42
+
43
+ ```typescript
44
+ const client = new BiOS({
45
+ apiKey: 'usf-...',
46
+ });
47
+ ```
48
+
49
+ ### JWT Access Token
50
+
51
+ ```typescript
52
+ const client = new BiOS({
53
+ accessToken: 'eyJhbG...',
54
+ orgId: 'org_abc123',
55
+ });
56
+ ```
57
+
58
+ ## Resources
59
+
60
+ ### Inference
61
+
62
+ Use a deployment inference key, never the control-plane API key. The async
63
+ iterator parses SSE across arbitrary chunk boundaries and aborts the upstream
64
+ request when iteration is stopped. Inference POSTs are not retried implicitly;
65
+ reuse an explicit `idempotencyKey` only when retrying the same request. The SDK
66
+ propagates the header but does not promise server-side replay/deduplication
67
+ without an explicit replay acknowledgement from the endpoint.
68
+
69
+ ```typescript
70
+ const client = new BiOS({
71
+ apiKey: 'usf-control-plane-key',
72
+ inferenceKey: 'sk-usf-deployment-key',
73
+ // inferenceBaseUrl: 'https://api-dev.usbios.ai', // explicit in dev
74
+ });
75
+
76
+ const controller = new AbortController();
77
+ for await (const chunk of client.inference.streamChatCompletions({
78
+ messages: [{ role: 'user', content: 'Look up record 42' }],
79
+ tools: [{
80
+ type: 'function',
81
+ function: {
82
+ name: 'lookup',
83
+ parameters: { type: 'object', properties: { id: { type: 'integer' } } },
84
+ },
85
+ }],
86
+ idempotencyKey: 'chat-42-attempt-1',
87
+ signal: controller.signal,
88
+ })) {
89
+ console.log(chunk);
90
+ }
91
+ // controller.abort() cancels an unfinished generation.
92
+ ```
93
+
94
+ ### Models
95
+
96
+ ```typescript
97
+ // Search models
98
+ const results = await client.models.search({ query: 'llama', limit: 10 });
99
+
100
+ // Get model config
101
+ const config = await client.models.getConfig('meta-llama/Llama-3.1-8B');
102
+
103
+ // Check adapter compatibility
104
+ const compat = await client.models.getAdapterCompatibility({
105
+ modelType: 'llama',
106
+ trainingMethod: 'sft',
107
+ });
108
+ ```
109
+
110
+ ### Datasets
111
+
112
+ ```typescript
113
+ // List datasets
114
+ const datasets = await client.datasets.list();
115
+
116
+ // Upload a dataset
117
+ const uploaded = await client.datasets.upload({
118
+ filePath: './data.jsonl',
119
+ name: 'My Dataset',
120
+ });
121
+
122
+ // Preview rows
123
+ const preview = await client.datasets.preview('ds_abc123', { pageSize: 5 });
124
+
125
+ // Import from HuggingFace
126
+ const imported = await client.datasets.importFromHuggingFace({
127
+ repoId: 'databricks/dolly-15k',
128
+ integrationId: 'int_abc123',
129
+ name: 'Dolly 15k',
130
+ });
131
+
132
+ // Validate before upload
133
+ const validation = await client.datasets.validate('./data.jsonl');
134
+ ```
135
+
136
+ ### Training
137
+
138
+ ```typescript
139
+ const request = {
140
+ idempotencyKey: 'training-create-20260711-0001',
141
+ model: 'meta-llama/Llama-3.1-8B-Instruct',
142
+ datasetIds: ['ds_abc123', 'ds_def456'],
143
+ method: 'sft',
144
+ adapter: 'lora',
145
+ queueIfUnavailable: true,
146
+ queueDeadline: '2026-07-18T00:00:00Z',
147
+ maxPriceHourCents: 500,
148
+ gpuPriorities: [
149
+ { gpuType: 'H100_80GB', gpuCount: 1 },
150
+ { gpuType: 'A100_80GB', gpuCount: 1 },
151
+ { gpuType: 'L40S', gpuCount: 1 },
152
+ ],
153
+ } as const;
154
+
155
+ // Side-effect-free validation, canonical sizing, live stock and alternatives
156
+ const check = await client.training.preflight(request);
157
+ console.log(check.request_hash, check.recommended, check.queue_eligible);
158
+
159
+ // Create the paid job only after reviewing preflight
160
+ const job = await client.training.create(request);
161
+
162
+ // List jobs
163
+ const jobs = await client.training.list({ status: 'running' });
164
+ const page = await client.training.listPage({ limit: 50, offset: 0 });
165
+
166
+ // Get metrics
167
+ const metrics = await client.training.getMetrics('job_abc123');
168
+ for (const point of metrics.metrics) console.log(point.step, point.loss);
169
+
170
+ // Get checkpoints
171
+ const checkpoints = await client.training.getCheckpoints('job_abc123');
172
+
173
+ // Structured logs
174
+ const logs = await client.training.getLogs('job_abc123');
175
+ for (const entry of logs.logs) console.log(entry.level, entry.message);
176
+
177
+ // Stop / Resume
178
+ await client.training.stop('job_abc123');
179
+ await client.training.resume('job_abc123', 'training-resume-20260711-0001');
180
+ ```
181
+
182
+ ### Wallet
183
+
184
+ ```typescript
185
+ // Get balance
186
+ const balance = await client.wallet.getBalance();
187
+ console.log(`$${(balance.balance_cents / 100).toFixed(2)}`);
188
+
189
+ // Transaction history
190
+ const txns = await client.wallet.getTransactions({ limit: 20 });
191
+ ```
192
+
193
+ ### Inference deployments
194
+
195
+ ```typescript
196
+ const request = {
197
+ name: 'llama-api',
198
+ sourceType: 'hf_model',
199
+ hfModelId: 'meta-llama/Llama-3.1-8B-Instruct',
200
+ gpuType: 'H100_80GB',
201
+ gpuCount: 1,
202
+ allowCapacityQueue: true,
203
+ maxPriceHourCents: 500,
204
+ } as const;
205
+
206
+ // No wallet mutation and no GPU allocation.
207
+ const check = await client.inference.preflight(request);
208
+ console.log(check.selected_gpu, check.alternatives, check.billing);
209
+
210
+ // Creates only after your automation accepts the live price/queue terms.
211
+ const deployment = await client.inference.create(request, 'deploy-create-20260711-0001');
212
+ console.log(deployment.inference_key); // returned once; store securely
213
+
214
+ const status = await client.inference.status(deployment.id);
215
+ console.log(status.status, status.status_reason, status.queue_expires_at, status.wallet_authorization_status);
216
+ // status remains "failed" for existing filters when status_reason is "queue_expired".
217
+ const notificationHistory = await client.inference.notifications(deployment.id);
218
+ console.log(notificationHistory.map(({ event_type, state, attempt_count }) => ({ event_type, state, attempt_count })));
219
+
220
+ // Bounded newest-first listing. Reuse next_cursor with unchanged filters.
221
+ const page = await client.inference.listPage({ limit: 100, status: 'running', search: 'llama' });
222
+ if (page.has_more && page.next_cursor) {
223
+ const older = await client.inference.listPage({ limit: 100, status: 'running', search: 'llama', cursor: page.next_cursor });
224
+ console.log(older.deployments);
225
+ }
226
+ // Or traverse lazily without one unbounded response.
227
+ for await (const item of client.inference.iterate({ status: 'running' })) console.log(item.name);
228
+
229
+ await client.inference.stop(deployment.id);
230
+ await client.inference.delete(deployment.id);
231
+ ```
232
+
233
+ ### GPU
234
+
235
+ ```typescript
236
+ // Get pricing
237
+ const pricing = await client.gpu.getPricing();
238
+
239
+ // Authoritative model-aware choices, live stock, total pricing, and alternatives
240
+ const options = await client.gpu.getOptions({
241
+ modelId: 'meta-llama/Llama-3.1-8B',
242
+ trainType: 'qlora',
243
+ method: 'sft',
244
+ });
245
+
246
+ // Get recommendation for a model
247
+ const rec = await client.gpu.getRecommended('meta-llama/Llama-3.1-8B');
248
+ ```
249
+
250
+ ### Key Introspection
251
+
252
+ ```typescript
253
+ const info = await client.introspect();
254
+ console.log(`Org: ${info.org.name}`);
255
+ console.log(`Scopes: ${info.scopes.join(', ')}`);
256
+ ```
257
+
258
+ ## Error Handling
259
+
260
+ ```typescript
261
+ import { BiOS, ApiError } from 'bios-sdk';
262
+
263
+ try {
264
+ await client.training.get('bad_id');
265
+ } catch (err) {
266
+ if (err instanceof ApiError) {
267
+ console.log(`Status: ${err.status}`);
268
+ console.log(`Message: ${err.message}`);
269
+ console.log(`Code: ${err.code}`);
270
+ }
271
+ }
272
+ ```
273
+
274
+ ## Configuration
275
+
276
+ | Option | Default | Description |
277
+ |--------|---------|-------------|
278
+ | `apiKey` | — | API key (`usf-...`) |
279
+ | `accessToken` | — | JWT access token |
280
+ | `orgId` | — | Organization ID (auto-resolved with API keys) |
281
+ | `workspaceId` | — | Workspace ID (auto-resolved with API keys) |
282
+ | `baseUrl` | `https://api.usbios.ai` | Canonical production hostname (release-gated; this documentation does not assert current availability). During prelaunch/dev, pass `https://api-dev.usbios.ai` explicitly. |
283
+ | `timeout` | `30000` | Request timeout in ms |
284
+
285
+ ## Requirements
286
+
287
+ - Node.js >= 18.0.0
288
+ - ESM modules
289
+
290
+ ## License
291
+
292
+ MIT
@@ -0,0 +1,57 @@
1
+ import type { BiOSConfig, ApiErrorBody } from './types.js';
2
+ /**
3
+ * Typed error thrown by every SDK method when the API returns a non-2xx status.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * try {
8
+ * await client.training.get('bad_id');
9
+ * } catch (err) {
10
+ * if (err instanceof ApiError && err.status === 404) {
11
+ * console.log('Job not found');
12
+ * }
13
+ * }
14
+ * ```
15
+ */
16
+ export declare class ApiError extends Error {
17
+ /** HTTP status code (e.g. 401, 404, 500). */
18
+ readonly status: number;
19
+ /** Machine-readable error code from the API, if provided. */
20
+ readonly code: string | undefined;
21
+ /** Server-assigned request ID for support / debugging. */
22
+ readonly requestId: string | undefined;
23
+ constructor(status: number, body: ApiErrorBody);
24
+ }
25
+ export declare class HttpClient {
26
+ private readonly baseUrl;
27
+ private readonly apiKey;
28
+ private readonly accessToken;
29
+ private readonly orgId;
30
+ private readonly workspaceIdValue;
31
+ private readonly timeout;
32
+ constructor(config: BiOSConfig);
33
+ /** Workspace configured on the client, used by multipart/control-plane helpers. */
34
+ get workspaceId(): string | undefined;
35
+ private buildHeaders;
36
+ /**
37
+ * Send a JSON request and parse the response.
38
+ * Throws {@link ApiError} on non-2xx responses.
39
+ */
40
+ request<T>(method: string, path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
41
+ /** Send a GET request. */
42
+ fetchGet<T>(path: string, extraHeaders?: Record<string, string>): Promise<T>;
43
+ /** Send a POST request with a JSON body. */
44
+ fetchPost<T>(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
45
+ /** Send a PATCH request with a JSON body. */
46
+ fetchPatch<T>(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
47
+ /** Send a PUT request with a JSON body. */
48
+ fetchPut<T>(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
49
+ /** Send a DELETE request. */
50
+ fetchDelete<T>(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
51
+ /**
52
+ * Upload a file via multipart/form-data.
53
+ * The caller is responsible for constructing the FormData.
54
+ * Throws {@link ApiError} on non-2xx responses.
55
+ */
56
+ fetchUpload<T>(path: string, formData: FormData): Promise<T>;
57
+ }
package/dist/client.js ADDED
@@ -0,0 +1,181 @@
1
+ import { VERSION } from './index.js';
2
+ // ============================================================================
3
+ // ApiError
4
+ // ============================================================================
5
+ /**
6
+ * Typed error thrown by every SDK method when the API returns a non-2xx status.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * try {
11
+ * await client.training.get('bad_id');
12
+ * } catch (err) {
13
+ * if (err instanceof ApiError && err.status === 404) {
14
+ * console.log('Job not found');
15
+ * }
16
+ * }
17
+ * ```
18
+ */
19
+ export class ApiError extends Error {
20
+ /** HTTP status code (e.g. 401, 404, 500). */
21
+ status;
22
+ /** Machine-readable error code from the API, if provided. */
23
+ code;
24
+ /** Server-assigned request ID for support / debugging. */
25
+ requestId;
26
+ constructor(status, body) {
27
+ const err = body.error;
28
+ const nested = typeof err === 'object' && err !== null ? err : null;
29
+ const msg = body.detail
30
+ || (nested ? String(nested.message || nested.detail || '') : '')
31
+ || (typeof err === 'string' ? err : '')
32
+ || body.message
33
+ || `API error ${status}`;
34
+ super(msg);
35
+ this.name = 'ApiError';
36
+ this.status = status;
37
+ this.code = (nested ? String(nested.code || '') : body.code) || undefined;
38
+ this.requestId = body.request_id;
39
+ }
40
+ }
41
+ // ============================================================================
42
+ // HttpClient — shared HTTP transport used by resource modules via composition
43
+ // ============================================================================
44
+ export class HttpClient {
45
+ baseUrl;
46
+ apiKey;
47
+ accessToken;
48
+ orgId;
49
+ workspaceIdValue;
50
+ timeout;
51
+ constructor(config) {
52
+ this.baseUrl = (config.baseUrl || 'https://api-dev.usbios.ai').replace(/\/+$/, '');
53
+ this.apiKey = config.apiKey;
54
+ this.accessToken = config.accessToken;
55
+ this.orgId = config.orgId;
56
+ this.workspaceIdValue = config.workspaceId;
57
+ this.timeout = config.timeout ?? 30_000;
58
+ if (!this.apiKey && !this.accessToken) {
59
+ throw new Error('BiOS: either apiKey or accessToken is required');
60
+ }
61
+ }
62
+ /** Workspace configured on the client, used by multipart/control-plane helpers. */
63
+ get workspaceId() {
64
+ return this.workspaceIdValue;
65
+ }
66
+ // --------------------------------------------------------------------------
67
+ // Internal helpers
68
+ // --------------------------------------------------------------------------
69
+ buildHeaders(extra) {
70
+ const h = {
71
+ 'User-Agent': `bios-sdk/${VERSION}`,
72
+ ...extra,
73
+ };
74
+ if (this.apiKey) {
75
+ h['X-API-Key'] = this.apiKey;
76
+ }
77
+ else if (this.accessToken) {
78
+ h['Authorization'] = `Bearer ${this.accessToken}`;
79
+ }
80
+ if (this.orgId)
81
+ h['X-Org-ID'] = this.orgId;
82
+ if (this.workspaceIdValue)
83
+ h['X-Workspace-ID'] = this.workspaceIdValue;
84
+ return h;
85
+ }
86
+ // --------------------------------------------------------------------------
87
+ // Public request methods — used by resource classes via composition
88
+ // --------------------------------------------------------------------------
89
+ /**
90
+ * Send a JSON request and parse the response.
91
+ * Throws {@link ApiError} on non-2xx responses.
92
+ */
93
+ async request(method, path, body, extraHeaders) {
94
+ const url = `${this.baseUrl}${path}`;
95
+ const headers = this.buildHeaders({
96
+ 'Content-Type': 'application/json',
97
+ 'Accept': 'application/json',
98
+ ...extraHeaders,
99
+ });
100
+ const controller = new AbortController();
101
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
102
+ let res;
103
+ try {
104
+ res = await fetch(url, {
105
+ method,
106
+ headers,
107
+ body: body !== undefined ? JSON.stringify(body) : undefined,
108
+ signal: controller.signal,
109
+ });
110
+ }
111
+ catch (err) {
112
+ if (err instanceof DOMException && err.name === 'AbortError') {
113
+ throw new ApiError(0, { error: `Request timed out after ${this.timeout}ms` });
114
+ }
115
+ throw err;
116
+ }
117
+ finally {
118
+ clearTimeout(timeoutId);
119
+ }
120
+ const data = await res.json().catch(() => ({}));
121
+ if (!res.ok) {
122
+ throw new ApiError(res.status, data);
123
+ }
124
+ return data;
125
+ }
126
+ /** Send a GET request. */
127
+ fetchGet(path, extraHeaders) {
128
+ return this.request('GET', path, undefined, extraHeaders);
129
+ }
130
+ /** Send a POST request with a JSON body. */
131
+ fetchPost(path, body, extraHeaders) {
132
+ return this.request('POST', path, body, extraHeaders);
133
+ }
134
+ /** Send a PATCH request with a JSON body. */
135
+ fetchPatch(path, body, extraHeaders) {
136
+ return this.request('PATCH', path, body, extraHeaders);
137
+ }
138
+ /** Send a PUT request with a JSON body. */
139
+ fetchPut(path, body, extraHeaders) {
140
+ return this.request('PUT', path, body, extraHeaders);
141
+ }
142
+ /** Send a DELETE request. */
143
+ fetchDelete(path, body, extraHeaders) {
144
+ return this.request('DELETE', path, body, extraHeaders);
145
+ }
146
+ /**
147
+ * Upload a file via multipart/form-data.
148
+ * The caller is responsible for constructing the FormData.
149
+ * Throws {@link ApiError} on non-2xx responses.
150
+ */
151
+ async fetchUpload(path, formData) {
152
+ const url = `${this.baseUrl}${path}`;
153
+ // Do NOT set Content-Type — fetch sets the boundary automatically for FormData.
154
+ const headers = this.buildHeaders({ 'Accept': 'application/json' });
155
+ const controller = new AbortController();
156
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
157
+ let res;
158
+ try {
159
+ res = await fetch(url, {
160
+ method: 'POST',
161
+ headers,
162
+ body: formData,
163
+ signal: controller.signal,
164
+ });
165
+ }
166
+ catch (err) {
167
+ if (err instanceof DOMException && err.name === 'AbortError') {
168
+ throw new ApiError(0, { error: `Upload timed out after ${this.timeout}ms` });
169
+ }
170
+ throw err;
171
+ }
172
+ finally {
173
+ clearTimeout(timeoutId);
174
+ }
175
+ const data = await res.json().catch(() => ({}));
176
+ if (!res.ok) {
177
+ throw new ApiError(res.status, data);
178
+ }
179
+ return data;
180
+ }
181
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * bios-sdk -- Official TypeScript SDK for the BIOS fine-tuning platform.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { BiOS } from 'bios-sdk';
7
+ *
8
+ * const client = new BiOS({
9
+ * apiKey: 'usf-...',
10
+ * });
11
+ *
12
+ * // Search for models
13
+ * const models = await client.models.search({ query: 'llama' });
14
+ *
15
+ * // Create a training job
16
+ * const job = await client.training.create({
17
+ * model: 'meta-llama/Llama-3.1-8B-Instruct',
18
+ * datasetId: 'ds_abc123',
19
+ * method: 'sft',
20
+ * adapter: 'lora',
21
+ * });
22
+ * ```
23
+ *
24
+ * @packageDocumentation
25
+ */
26
+ import type { BiOSConfig, ApiKeyIntrospection } from './types.js';
27
+ import { Models } from './resources/models.js';
28
+ import { Datasets } from './resources/datasets.js';
29
+ import { Training } from './resources/training.js';
30
+ import { Wallet } from './resources/wallet.js';
31
+ import { GPU } from './resources/gpu.js';
32
+ import { Inference } from './resources/inference.js';
33
+ /** SDK version. Sent as part of the User-Agent header. */
34
+ export declare const VERSION = "1.0.2";
35
+ export declare class BiOS {
36
+ /** Search models, fetch configs, check adapter compatibility. */
37
+ readonly models: Models;
38
+ /** Upload, import, preview, and manage training datasets. */
39
+ readonly datasets: Datasets;
40
+ /** Create, monitor, stop, and resume fine-tuning jobs. */
41
+ readonly training: Training;
42
+ /** Check wallet balance. */
43
+ readonly wallet: Wallet;
44
+ /** View GPU pricing and get hardware recommendations. */
45
+ readonly gpu: GPU;
46
+ /**
47
+ * Model-serving inference. Validate, create, monitor, stop, and delete
48
+ * serving deployments, plus OpenAI-compatible non-streaming and SSE calls.
49
+ */
50
+ readonly inference: Inference;
51
+ /** @internal */
52
+ private readonly _http;
53
+ constructor(config: BiOSConfig);
54
+ introspect(): Promise<ApiKeyIntrospection>;
55
+ }
56
+ export { ApiError } from './client.js';
57
+ export { Models } from './resources/models.js';
58
+ export { Datasets } from './resources/datasets.js';
59
+ export { Training } from './resources/training.js';
60
+ export { Wallet } from './resources/wallet.js';
61
+ export { GPU, type GPURecommendation } from './resources/gpu.js';
62
+ export { Inference, validateChatRequest, parseSSE, type ChatMessage, type FunctionTool, type ChatCompletionParams, type ChatCompletionResponse, type ChatCompletionChunk, } from './resources/inference.js';
63
+ export type { BiOSConfig, PaginatedResponse, ApiErrorBody, Model, ModelSearchParams, ModelSearchResponse, ModelConfig, Dataset, DatasetListParams, DatasetListResponse, DatasetUploadParams, DatasetPreview, DatasetPreviewParams, DatasetImportHFParams, DatasetRegisterHFParams, DatasetHubSearchParams, DatasetHubPreviewParams, DatasetValidation, DatasetFormatVariant, DatasetFormatSpec, DatasetFormatSpecs, DatasetStorageUsage, TrainingMethod, RLHFAlgorithm, AdapterType, TrainingJobStatus, TrainingStatusFilter, TrainingCreateParams, TrainingListParams, TrainingListResponse, TrainingJob, TrainingMetrics, MetricPoint, MetricGraphConfig, TrainingCheckpoint, TrainingLogs, TrainingLogEntry, TrainingStopResponse, TrainingResumeResponse, CanonicalTrainingRequest, TrainingPreflightDataset, TrainingPreflightWarning, TrainingPreflightResponse, TrainingCapabilityChoice, TrainingConfigFieldCapability, TrainingCapabilities, GPUChoice, WalletBalance, Transaction, TransactionListParams, GPUInfo, GPUPricingResponse, GPUOptionsParams, GPUOption, GPUOptionSuggestion, GPUOptionsResponse, InferenceStatus, InferenceCreateParams, InferenceUpdateParams, InferenceDeployment, InferenceCreateResponse, InferenceListResponse, InferenceUpdateResponse, InferenceLifecycleResponse, InferenceDeleteResponse, InferenceGPUOptionMarket, InferenceGPUOption, InferenceGPUAlternative, InferenceGPUOptionsParams, InferenceGPUOptionsResponse, InferenceCanonicalRequest, InferencePreflightWarning, InferencePreflightResponse, AdapterCompatibility, AdapterCompatibilityResponse, AdapterCompatibilityParams, SupportedArchitecture, ArchitectureScope, SupportedArchitecturesResponse, ApiKey, ApiKeyScope, ApiKeyIntrospection, Organization, OrgMember, OrgInvite, Workspace, Integration, IntegrationCreateParams, StorageUsage, StorageObject, } from './types.js';
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ /**
2
+ * bios-sdk -- Official TypeScript SDK for the BIOS fine-tuning platform.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { BiOS } from 'bios-sdk';
7
+ *
8
+ * const client = new BiOS({
9
+ * apiKey: 'usf-...',
10
+ * });
11
+ *
12
+ * // Search for models
13
+ * const models = await client.models.search({ query: 'llama' });
14
+ *
15
+ * // Create a training job
16
+ * const job = await client.training.create({
17
+ * model: 'meta-llama/Llama-3.1-8B-Instruct',
18
+ * datasetId: 'ds_abc123',
19
+ * method: 'sft',
20
+ * adapter: 'lora',
21
+ * });
22
+ * ```
23
+ *
24
+ * @packageDocumentation
25
+ */
26
+ import { HttpClient } from './client.js';
27
+ import { Models } from './resources/models.js';
28
+ import { Datasets } from './resources/datasets.js';
29
+ import { Training } from './resources/training.js';
30
+ import { Wallet } from './resources/wallet.js';
31
+ import { GPU } from './resources/gpu.js';
32
+ import { Inference } from './resources/inference.js';
33
+ /** SDK version. Sent as part of the User-Agent header. */
34
+ export const VERSION = '1.0.2';
35
+ export class BiOS {
36
+ /** Search models, fetch configs, check adapter compatibility. */
37
+ models;
38
+ /** Upload, import, preview, and manage training datasets. */
39
+ datasets;
40
+ /** Create, monitor, stop, and resume fine-tuning jobs. */
41
+ training;
42
+ /** Check wallet balance. */
43
+ wallet;
44
+ /** View GPU pricing and get hardware recommendations. */
45
+ gpu;
46
+ /**
47
+ * Model-serving inference. Validate, create, monitor, stop, and delete
48
+ * serving deployments, plus OpenAI-compatible non-streaming and SSE calls.
49
+ */
50
+ inference;
51
+ /** @internal */
52
+ _http;
53
+ constructor(config) {
54
+ const http = new HttpClient(config);
55
+ this._http = http;
56
+ this.models = new Models(http);
57
+ this.datasets = new Datasets(http);
58
+ this.training = new Training(http);
59
+ this.wallet = new Wallet(http);
60
+ this.gpu = new GPU(http);
61
+ this.inference = new Inference({
62
+ inferenceKey: config.inferenceKey,
63
+ baseUrl: config.inferenceBaseUrl || config.baseUrl,
64
+ timeout: config.inferenceTimeout,
65
+ }, http);
66
+ }
67
+ async introspect() {
68
+ return this._http.fetchGet('/api/api-keys/introspect');
69
+ }
70
+ }
71
+ // ---------------------------------------------------------------------------
72
+ // Re-exports
73
+ // ---------------------------------------------------------------------------
74
+ export { ApiError } from './client.js';
75
+ export { Models } from './resources/models.js';
76
+ export { Datasets } from './resources/datasets.js';
77
+ export { Training } from './resources/training.js';
78
+ export { Wallet } from './resources/wallet.js';
79
+ export { GPU } from './resources/gpu.js';
80
+ export { Inference, validateChatRequest, parseSSE, } from './resources/inference.js';