bios-sdk 0.1.0-dev.7 → 0.1.0-rc.2
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 +6 -22
- package/dist/client.d.ts +0 -4
- package/dist/client.js +3 -24
- package/dist/index.d.ts +3 -6
- package/dist/index.js +3 -6
- package/dist/resources/inference.js +2 -2
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm install bios-sdk
|
|
|
14
14
|
import { BiOS } from 'bios-sdk';
|
|
15
15
|
|
|
16
16
|
const client = new BiOS({
|
|
17
|
-
apiKey: '
|
|
17
|
+
apiKey: 'usf-...',
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
// Search for models
|
|
@@ -40,28 +40,12 @@ console.log(`Job ${job.id} created`);
|
|
|
40
40
|
|
|
41
41
|
### API Key (recommended)
|
|
42
42
|
|
|
43
|
-
API keys start with `bios-` (legacy `usf-` keys stay valid).
|
|
44
|
-
|
|
45
43
|
```typescript
|
|
46
44
|
const client = new BiOS({
|
|
47
|
-
apiKey: '
|
|
45
|
+
apiKey: 'usf-...',
|
|
48
46
|
});
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
### Environment Variables
|
|
52
|
-
|
|
53
|
-
When `apiKey` or `baseUrl` is omitted from the config, the SDK reads them
|
|
54
|
-
from the environment:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
export BIOS_API_KEY=bios-...
|
|
58
|
-
export BIOS_BASE_URL=https://api.usbios.ai # optional; this is the default
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
const client = new BiOS({}); // uses BIOS_API_KEY / BIOS_BASE_URL
|
|
63
|
-
```
|
|
64
|
-
|
|
65
49
|
### JWT Access Token
|
|
66
50
|
|
|
67
51
|
```typescript
|
|
@@ -84,8 +68,8 @@ without an explicit replay acknowledgement from the endpoint.
|
|
|
84
68
|
|
|
85
69
|
```typescript
|
|
86
70
|
const client = new BiOS({
|
|
87
|
-
apiKey: '
|
|
88
|
-
inferenceKey: 'sk-
|
|
71
|
+
apiKey: 'usf-control-plane-key',
|
|
72
|
+
inferenceKey: 'sk-usf-deployment-key',
|
|
89
73
|
// inferenceBaseUrl: 'https://api-dev.usbios.ai', // explicit in dev
|
|
90
74
|
});
|
|
91
75
|
|
|
@@ -291,11 +275,11 @@ try {
|
|
|
291
275
|
|
|
292
276
|
| Option | Default | Description |
|
|
293
277
|
|--------|---------|-------------|
|
|
294
|
-
| `apiKey` |
|
|
278
|
+
| `apiKey` | — | API key (`usf-...`) |
|
|
295
279
|
| `accessToken` | — | JWT access token |
|
|
296
280
|
| `orgId` | — | Organization ID (auto-resolved with API keys) |
|
|
297
281
|
| `workspaceId` | — | Workspace ID (auto-resolved with API keys) |
|
|
298
|
-
| `baseUrl` | `
|
|
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. |
|
|
299
283
|
| `timeout` | `30000` | Request timeout in ms |
|
|
300
284
|
|
|
301
285
|
## Requirements
|
package/dist/client.d.ts
CHANGED
|
@@ -22,10 +22,6 @@ export declare class ApiError extends Error {
|
|
|
22
22
|
readonly requestId: string | undefined;
|
|
23
23
|
constructor(status: number, body: ApiErrorBody);
|
|
24
24
|
}
|
|
25
|
-
/** Default API key from `BIOS_API_KEY` when the config omits one. @internal */
|
|
26
|
-
export declare function envApiKey(): string | undefined;
|
|
27
|
-
/** Default base URL from `BIOS_BASE_URL` when the config omits one. @internal */
|
|
28
|
-
export declare function envBaseUrl(): string | undefined;
|
|
29
25
|
export declare class HttpClient {
|
|
30
26
|
private readonly baseUrl;
|
|
31
27
|
private readonly apiKey;
|
package/dist/client.js
CHANGED
|
@@ -39,27 +39,6 @@ export class ApiError extends Error {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
// ============================================================================
|
|
42
|
-
// Environment defaults
|
|
43
|
-
// ============================================================================
|
|
44
|
-
/**
|
|
45
|
-
* Read an environment variable, tolerating browser bundles where `process`
|
|
46
|
-
* does not exist. Returns undefined for missing or empty values.
|
|
47
|
-
*/
|
|
48
|
-
function envVar(name) {
|
|
49
|
-
if (typeof process === 'undefined' || !process.env)
|
|
50
|
-
return undefined;
|
|
51
|
-
const value = process.env[name];
|
|
52
|
-
return value && value.trim() !== '' ? value.trim() : undefined;
|
|
53
|
-
}
|
|
54
|
-
/** Default API key from `BIOS_API_KEY` when the config omits one. @internal */
|
|
55
|
-
export function envApiKey() {
|
|
56
|
-
return envVar('BIOS_API_KEY');
|
|
57
|
-
}
|
|
58
|
-
/** Default base URL from `BIOS_BASE_URL` when the config omits one. @internal */
|
|
59
|
-
export function envBaseUrl() {
|
|
60
|
-
return envVar('BIOS_BASE_URL');
|
|
61
|
-
}
|
|
62
|
-
// ============================================================================
|
|
63
42
|
// HttpClient — shared HTTP transport used by resource modules via composition
|
|
64
43
|
// ============================================================================
|
|
65
44
|
export class HttpClient {
|
|
@@ -70,14 +49,14 @@ export class HttpClient {
|
|
|
70
49
|
workspaceIdValue;
|
|
71
50
|
timeout;
|
|
72
51
|
constructor(config) {
|
|
73
|
-
this.baseUrl = (config.baseUrl ||
|
|
74
|
-
this.apiKey = config.apiKey
|
|
52
|
+
this.baseUrl = (config.baseUrl || 'https://api-staging.usbios.ai').replace(/\/+$/, '');
|
|
53
|
+
this.apiKey = config.apiKey;
|
|
75
54
|
this.accessToken = config.accessToken;
|
|
76
55
|
this.orgId = config.orgId;
|
|
77
56
|
this.workspaceIdValue = config.workspaceId;
|
|
78
57
|
this.timeout = config.timeout ?? 30_000;
|
|
79
58
|
if (!this.apiKey && !this.accessToken) {
|
|
80
|
-
throw new Error('BiOS: either apiKey or accessToken is required
|
|
59
|
+
throw new Error('BiOS: either apiKey or accessToken is required');
|
|
81
60
|
}
|
|
82
61
|
}
|
|
83
62
|
/** Workspace configured on the client, used by multipart/control-plane helpers. */
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* import { BiOS } from 'bios-sdk';
|
|
7
7
|
*
|
|
8
8
|
* const client = new BiOS({
|
|
9
|
-
* apiKey: '
|
|
9
|
+
* apiKey: 'usf-...',
|
|
10
10
|
* });
|
|
11
11
|
*
|
|
12
12
|
* // Search for models
|
|
@@ -30,11 +30,8 @@ import { Training } from './resources/training.js';
|
|
|
30
30
|
import { Wallet } from './resources/wallet.js';
|
|
31
31
|
import { GPU } from './resources/gpu.js';
|
|
32
32
|
import { Inference } from './resources/inference.js';
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
* Must match package.json "version" -- enforced by a contract test.
|
|
36
|
-
*/
|
|
37
|
-
export declare const VERSION = "0.1.0";
|
|
33
|
+
/** SDK version. Sent as part of the User-Agent header. */
|
|
34
|
+
export declare const VERSION = "1.0.2";
|
|
38
35
|
export declare class BiOS {
|
|
39
36
|
/** Search models, fetch configs, check adapter compatibility. */
|
|
40
37
|
readonly models: Models;
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* import { BiOS } from 'bios-sdk';
|
|
7
7
|
*
|
|
8
8
|
* const client = new BiOS({
|
|
9
|
-
* apiKey: '
|
|
9
|
+
* apiKey: 'usf-...',
|
|
10
10
|
* });
|
|
11
11
|
*
|
|
12
12
|
* // Search for models
|
|
@@ -30,11 +30,8 @@ import { Training } from './resources/training.js';
|
|
|
30
30
|
import { Wallet } from './resources/wallet.js';
|
|
31
31
|
import { GPU } from './resources/gpu.js';
|
|
32
32
|
import { Inference } from './resources/inference.js';
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
* Must match package.json "version" -- enforced by a contract test.
|
|
36
|
-
*/
|
|
37
|
-
export const VERSION = '0.1.0';
|
|
33
|
+
/** SDK version. Sent as part of the User-Agent header. */
|
|
34
|
+
export const VERSION = '1.0.2';
|
|
38
35
|
export class BiOS {
|
|
39
36
|
/** Search models, fetch configs, check adapter compatibility. */
|
|
40
37
|
models;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiError
|
|
1
|
+
import { ApiError } from '../client.js';
|
|
2
2
|
import { normalizeGPUPlacement } from './gpu-priorities.js';
|
|
3
3
|
const FUNCTION_NAME = /^[A-Za-z0-9_-]{1,64}$/;
|
|
4
4
|
const ROLES = new Set(['system', 'developer', 'user', 'assistant', 'tool', 'function']);
|
|
@@ -280,7 +280,7 @@ export class Inference {
|
|
|
280
280
|
_http;
|
|
281
281
|
constructor(config = {}, http) {
|
|
282
282
|
this.key = config.inferenceKey;
|
|
283
|
-
this.baseUrl = (config.baseUrl ||
|
|
283
|
+
this.baseUrl = (config.baseUrl || 'https://api-staging.usbios.ai').replace(/\/+$/, '');
|
|
284
284
|
this.timeout = config.timeout ?? 900_000;
|
|
285
285
|
this._http = http;
|
|
286
286
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Configuration for initializing the BIOS SDK client. */
|
|
2
2
|
export interface BiOSConfig {
|
|
3
|
-
/** API key for authentication (prefix:
|
|
3
|
+
/** API key for authentication (prefix: usf-). Mutually exclusive with accessToken. */
|
|
4
4
|
apiKey?: string;
|
|
5
5
|
/** JWT access token for authentication. Mutually exclusive with apiKey. */
|
|
6
6
|
accessToken?: string;
|
|
@@ -8,13 +8,13 @@ export interface BiOSConfig {
|
|
|
8
8
|
orgId?: string;
|
|
9
9
|
/** Workspace ID. Optional when using API keys (resolved from the key). Can override for multi-workspace keys. */
|
|
10
10
|
workspaceId?: string;
|
|
11
|
-
/** Base URL for the API.
|
|
11
|
+
/** Base URL for the API. Defaults to the canonical https://api-staging.usbios.ai hostname. */
|
|
12
12
|
baseUrl?: string;
|
|
13
13
|
/** Request timeout in milliseconds. Defaults to 30000. */
|
|
14
14
|
timeout?: number;
|
|
15
15
|
/** Default per-deployment inference key. Can be overridden per inference call. */
|
|
16
16
|
inferenceKey?: string;
|
|
17
|
-
/** Inference base URL. Defaults to baseUrl, then https://api-
|
|
17
|
+
/** Inference base URL. Defaults to baseUrl, then https://api-staging.usbios.ai. */
|
|
18
18
|
inferenceBaseUrl?: string;
|
|
19
19
|
/** End-to-end inference timeout in milliseconds. Defaults to 15 minutes. */
|
|
20
20
|
inferenceTimeout?: number;
|