runbios-sdk 0.2.1-dev.62
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 +460 -0
- package/dist/client.d.ts +202 -0
- package/dist/client.js +408 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +93 -0
- package/dist/resources/datasets.d.ts +180 -0
- package/dist/resources/datasets.js +358 -0
- package/dist/resources/gpu-priorities.d.ts +23 -0
- package/dist/resources/gpu-priorities.js +63 -0
- package/dist/resources/gpu.d.ts +60 -0
- package/dist/resources/gpu.js +101 -0
- package/dist/resources/inference.d.ts +224 -0
- package/dist/resources/inference.js +794 -0
- package/dist/resources/models.d.ts +113 -0
- package/dist/resources/models.js +171 -0
- package/dist/resources/training.d.ts +166 -0
- package/dist/resources/training.js +419 -0
- package/dist/resources/wallet.d.ts +53 -0
- package/dist/resources/wallet.js +61 -0
- package/dist/types.d.ts +1916 -0
- package/dist/types.js +4 -0
- package/package.json +52 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,1916 @@
|
|
|
1
|
+
/** Configuration for initializing the Run BiOS SDK client. */
|
|
2
|
+
export interface BiOSConfig {
|
|
3
|
+
/** API key for authentication (prefix: bios-; legacy usf- keys stay valid). Falls back to the RUNBIOS_API_KEY environment variable (legacy: BIOS_API_KEY). Mutually exclusive with accessToken. */
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
/** JWT access token for authentication. Mutually exclusive with apiKey. */
|
|
6
|
+
accessToken?: string;
|
|
7
|
+
/** Organization ID. Optional when using API keys (resolved from the key). Required for JWT auth. */
|
|
8
|
+
orgId?: string;
|
|
9
|
+
/** Workspace ID. Optional when using API keys (resolved from the key). Can override for multi-workspace keys. */
|
|
10
|
+
workspaceId?: string;
|
|
11
|
+
/** Base URL for the API. Falls back to the RUNBIOS_BASE_URL environment variable (legacy: BIOS_BASE_URL), then the canonical https://api-dev.runbios.ai hostname. */
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
/** Request timeout in milliseconds. Defaults to 30000. */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
/** Default per-deployment inference key. Can be overridden per inference call. */
|
|
16
|
+
inferenceKey?: string;
|
|
17
|
+
/** Inference base URL. Defaults to baseUrl, then https://api-dev.runbios.ai. */
|
|
18
|
+
inferenceBaseUrl?: string;
|
|
19
|
+
/** End-to-end inference timeout in milliseconds. Defaults to 15 minutes. */
|
|
20
|
+
inferenceTimeout?: number;
|
|
21
|
+
}
|
|
22
|
+
/** Paginated list response wrapper. */
|
|
23
|
+
export interface PaginatedResponse<T> {
|
|
24
|
+
items: T[];
|
|
25
|
+
total: number;
|
|
26
|
+
offset: number;
|
|
27
|
+
limit: number;
|
|
28
|
+
hasMore: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Standard API error response body. */
|
|
31
|
+
export interface ApiErrorBody {
|
|
32
|
+
error?: string | {
|
|
33
|
+
code?: string;
|
|
34
|
+
message?: string;
|
|
35
|
+
detail?: string;
|
|
36
|
+
};
|
|
37
|
+
detail?: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
code?: string;
|
|
40
|
+
request_id?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Bookable-now GPU alternatives, present on availability rejections
|
|
43
|
+
* (SELECTED_GPU_UNAVAILABLE / CAPACITY_UNAVAILABLE): each entry fits the
|
|
44
|
+
* requested model's minimum requirements and was in stock at `checked_at`.
|
|
45
|
+
* Pick one and resubmit — nothing else about the request needs to change.
|
|
46
|
+
*/
|
|
47
|
+
available_gpus?: AvailableGpuAlternative[];
|
|
48
|
+
/** Same contract as `available_gpus`; some surfaces use this field name. */
|
|
49
|
+
available_alternatives?: AvailableGpuAlternative[];
|
|
50
|
+
/** When the availability snapshot behind the rejection was taken. */
|
|
51
|
+
checked_at?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Rejection class on the standard GPU-rejection contract:
|
|
54
|
+
* insufficient_stock | below_model_minimum | invalid_gpu_count |
|
|
55
|
+
* model_too_large | gpu_unsupported. Only insufficient_stock is transient.
|
|
56
|
+
*/
|
|
57
|
+
reason?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Explicit server-computed minimum block on any GPU rejection: the selected
|
|
60
|
+
* type's minimum + valid counts and the per-type table for the model.
|
|
61
|
+
* Client-supplied facts can never lower these.
|
|
62
|
+
*/
|
|
63
|
+
minimum_requirement?: CapacityMinimumRequirement;
|
|
64
|
+
/** The selection the rejection was about. */
|
|
65
|
+
selected?: {
|
|
66
|
+
gpu_type: string;
|
|
67
|
+
gpu_count: number;
|
|
68
|
+
tier?: string;
|
|
69
|
+
availability_status?: 'available' | 'out_of_stock' | 'unknown';
|
|
70
|
+
available_count?: number;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Whether waiting for capacity is a real option at all. False on every
|
|
74
|
+
* permanent rejection (the model does not fit that GPU type, the count is
|
|
75
|
+
* below the minimum or cannot split the model, the engine cannot run the
|
|
76
|
+
* card): stock will never change the answer. This is the field to branch on,
|
|
77
|
+
* not the status or the code.
|
|
78
|
+
*/
|
|
79
|
+
queue_offered?: boolean;
|
|
80
|
+
/** Whether the capacity queue may be joined for this request. */
|
|
81
|
+
queue_eligible?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 1-based rank of the gpu_priorities entry the rejection is about, when the
|
|
84
|
+
* request carried a ranked ladder.
|
|
85
|
+
*/
|
|
86
|
+
gpu_priorities_entry?: number;
|
|
87
|
+
}
|
|
88
|
+
/** The explicit minimum-requirement block of the standard capacity contract. */
|
|
89
|
+
export interface CapacityMinimumRequirement {
|
|
90
|
+
selected_gpu_min: number;
|
|
91
|
+
selected_valid_counts?: number[];
|
|
92
|
+
per_type: Array<{
|
|
93
|
+
gpu_type: string;
|
|
94
|
+
min_gpus: number;
|
|
95
|
+
valid_counts: number[];
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
98
|
+
/** One bookable-now GPU alternative carried on an availability rejection. */
|
|
99
|
+
export interface AvailableGpuAlternative {
|
|
100
|
+
gpu_type: string;
|
|
101
|
+
gpu_count?: number;
|
|
102
|
+
/** The model's minimum GPU count for this type (never pick below it). */
|
|
103
|
+
min_gpus?: number;
|
|
104
|
+
/** Every pickable count for this type (>= min and tensor-parallel-valid). */
|
|
105
|
+
valid_counts?: number[];
|
|
106
|
+
available_count?: number;
|
|
107
|
+
price_per_hour_cents?: number;
|
|
108
|
+
/** Total hourly price at `gpu_count` on the inference contract. */
|
|
109
|
+
price_hour_cents?: number;
|
|
110
|
+
provider?: string;
|
|
111
|
+
region?: string;
|
|
112
|
+
tier?: string;
|
|
113
|
+
recommended?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A model from the Run BiOS model catalog. The catalog is served from the
|
|
117
|
+
* platform's own registry: every listed model is hosted in Run BiOS storage,
|
|
118
|
+
* verified end-to-end, and can be trained and deployed. It is never a live
|
|
119
|
+
* Hugging Face search result — a model that is not listed is not hosted.
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* One row of the Run BiOS model registry (`GET /api/models`).
|
|
123
|
+
*
|
|
124
|
+
* The catalog is the platform's own registry: every listed model is hosted in
|
|
125
|
+
* Run BiOS storage, verified end to end, and can be trained and deployed. It is
|
|
126
|
+
* never a live Hugging Face search result.
|
|
127
|
+
*
|
|
128
|
+
* Field names are the registry's own snake_case, with two long-standing
|
|
129
|
+
* camelCase exceptions (`maxContext` / `weightBytes`). Everything is optional
|
|
130
|
+
* because a partner/private model has its weight-revealing fields stripped
|
|
131
|
+
* before the row leaves the service.
|
|
132
|
+
*/
|
|
133
|
+
export interface Model {
|
|
134
|
+
/**
|
|
135
|
+
* Registry UUID -- NOT the model handle. Pass `repo_id` to training and
|
|
136
|
+
* deployment; `id` is only useful for registry-internal joins.
|
|
137
|
+
*/
|
|
138
|
+
id?: string;
|
|
139
|
+
/**
|
|
140
|
+
* "author/name" -- the handle every other API accepts (hfModelId,
|
|
141
|
+
* baseModelId, training `model`, gpu-options `model`).
|
|
142
|
+
*/
|
|
143
|
+
repo_id?: string;
|
|
144
|
+
author?: string;
|
|
145
|
+
name?: string;
|
|
146
|
+
/** Model family slug from the registry (e.g. "gemma", "qwen3"). */
|
|
147
|
+
family?: string;
|
|
148
|
+
/** Architecture class from the hosted config.json (e.g. "LlamaForCausalLM"). */
|
|
149
|
+
architecture?: string;
|
|
150
|
+
/** Raw model_type from the hosted config.json (e.g. "gemma4"). */
|
|
151
|
+
model_type?: string;
|
|
152
|
+
/** Serving surface: "llm" (text) or "vlm" (vision-language). */
|
|
153
|
+
surface_type?: 'llm' | 'vlm';
|
|
154
|
+
is_moe?: boolean;
|
|
155
|
+
/** Total params in billions (all experts resident for MoE). */
|
|
156
|
+
params_total_b?: number;
|
|
157
|
+
/** Active params in billions; equals params_total_b for dense models. */
|
|
158
|
+
params_active_b?: number;
|
|
159
|
+
precision?: string;
|
|
160
|
+
license?: string;
|
|
161
|
+
/**
|
|
162
|
+
* False once Run BiOS mirrors a weight revision -- which is every catalog model,
|
|
163
|
+
* so hosted weights never need a Hugging Face account.
|
|
164
|
+
*/
|
|
165
|
+
gated?: boolean;
|
|
166
|
+
summary?: string;
|
|
167
|
+
source?: string;
|
|
168
|
+
origin_url?: string;
|
|
169
|
+
/**
|
|
170
|
+
* "public", or "partner"/"private" (weight-revealing fields, including
|
|
171
|
+
* maxContext and weightBytes, are stripped for the latter).
|
|
172
|
+
*/
|
|
173
|
+
visibility?: string;
|
|
174
|
+
/** Always "verified" on user-facing reads; the registry lists nothing else. */
|
|
175
|
+
status?: string;
|
|
176
|
+
downloads?: number;
|
|
177
|
+
likes?: number;
|
|
178
|
+
/** Run BiOS-side usage rollups for this model. */
|
|
179
|
+
train_count?: number;
|
|
180
|
+
inference_count?: number;
|
|
181
|
+
verified_at?: string | null;
|
|
182
|
+
/** Per-surface verification badges plus the image build that passed. */
|
|
183
|
+
training_verified?: boolean;
|
|
184
|
+
training_verified_at?: string | null;
|
|
185
|
+
training_verified_image?: string;
|
|
186
|
+
inference_verified?: boolean;
|
|
187
|
+
inference_verified_at?: string | null;
|
|
188
|
+
inference_verified_image?: string;
|
|
189
|
+
updated_at?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Native max context window in tokens -- the ceiling a deployment's
|
|
192
|
+
* `contextLength` can never exceed. Omitted when unknown or stripped for a
|
|
193
|
+
* protected model.
|
|
194
|
+
*/
|
|
195
|
+
maxContext?: number;
|
|
196
|
+
/**
|
|
197
|
+
* On-disk weight size of the primary hosted revision, in bytes. Omitted
|
|
198
|
+
* when no primary revision is mirrored or stripped for a protected model.
|
|
199
|
+
*/
|
|
200
|
+
weightBytes?: number;
|
|
201
|
+
}
|
|
202
|
+
/** Response from `GET /api/models/{author}/{name}`. */
|
|
203
|
+
export interface ModelDetailResponse {
|
|
204
|
+
model: Model;
|
|
205
|
+
/** Whether the file/config viewer applies -- public models only. */
|
|
206
|
+
files_viewable?: boolean;
|
|
207
|
+
/** Cached model card; present only for public models that have one. */
|
|
208
|
+
readme_md?: string;
|
|
209
|
+
/**
|
|
210
|
+
* The revision this card and file list describe -- the one hosted in our
|
|
211
|
+
* mirror. Public models only, and only once something is mirrored.
|
|
212
|
+
*/
|
|
213
|
+
primary_revision?: string;
|
|
214
|
+
}
|
|
215
|
+
export interface ModelSearchParams {
|
|
216
|
+
/**
|
|
217
|
+
* Search text. Becomes the registry's `q` filter -- the ONLY search
|
|
218
|
+
* parameter it reads. (`search` / `query` are not recognized on the wire and
|
|
219
|
+
* are silently ignored, returning every model, which is why the SDK maps the
|
|
220
|
+
* name for you.)
|
|
221
|
+
*/
|
|
222
|
+
query?: string;
|
|
223
|
+
/** Filter by model surface: "all", "llm", or "vlm". */
|
|
224
|
+
type?: 'all' | 'llm' | 'vlm';
|
|
225
|
+
/** Pagination offset. Defaults to 0. */
|
|
226
|
+
offset?: number;
|
|
227
|
+
/** Number of results to return. Server defaults to 24 and clamps to 60. */
|
|
228
|
+
limit?: number;
|
|
229
|
+
/** Minimum parameter count in billions. */
|
|
230
|
+
minParams?: number;
|
|
231
|
+
/** Maximum parameter count in billions. */
|
|
232
|
+
maxParams?: number;
|
|
233
|
+
/** Sort order accepted by the registry. */
|
|
234
|
+
sort?: 'downloads' | 'likes' | 'params' | 'name' | 'trending';
|
|
235
|
+
/**
|
|
236
|
+
* @deprecated Ignored by the registry-backed catalog. Include the author in
|
|
237
|
+
* `query` instead — model ids are "author/name" and match as text.
|
|
238
|
+
*/
|
|
239
|
+
author?: string;
|
|
240
|
+
/**
|
|
241
|
+
* @deprecated Ignored by the registry-backed catalog — hosted models are
|
|
242
|
+
* visible to every workspace (partner models are labeled via `visibility`).
|
|
243
|
+
*/
|
|
244
|
+
visibility?: 'all' | 'public' | 'private';
|
|
245
|
+
/**
|
|
246
|
+
* @deprecated Ignored by the registry-backed catalog — it carries verified
|
|
247
|
+
* full base models only, so no adapter/quantized filtering is needed.
|
|
248
|
+
*/
|
|
249
|
+
kind?: 'full' | 'adapter';
|
|
250
|
+
/**
|
|
251
|
+
* @deprecated Ignored by the registry-backed catalog — hosted models never
|
|
252
|
+
* require a Hugging Face integration (legacy from the live-HF era).
|
|
253
|
+
*/
|
|
254
|
+
integrationId?: string;
|
|
255
|
+
}
|
|
256
|
+
/** Response from a model search. */
|
|
257
|
+
export interface ModelSearchResponse {
|
|
258
|
+
models: Model[];
|
|
259
|
+
total: number;
|
|
260
|
+
offset: number;
|
|
261
|
+
limit: number;
|
|
262
|
+
hasMore: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* @deprecated Legacy field from the live-Hugging-Face era. The registry-
|
|
265
|
+
* backed catalog no longer returns it — hosted models need no HF account.
|
|
266
|
+
*/
|
|
267
|
+
hfUsername?: string;
|
|
268
|
+
}
|
|
269
|
+
/** Model configuration resolved from the registry's hosted copy of the model. */
|
|
270
|
+
export interface ModelConfig {
|
|
271
|
+
/** Full model id. */
|
|
272
|
+
modelId: string;
|
|
273
|
+
/** Model type from config.json (e.g. "llama", "qwen2"). */
|
|
274
|
+
model_type: string | null;
|
|
275
|
+
/** Model architecture classes. */
|
|
276
|
+
architectures: string[];
|
|
277
|
+
/** Total parameter count in billions. */
|
|
278
|
+
totalParams: number;
|
|
279
|
+
/** Active parameter count in billions. */
|
|
280
|
+
activeParams: number;
|
|
281
|
+
/** Whether this is a Mixture-of-Experts model. */
|
|
282
|
+
isMoE: boolean;
|
|
283
|
+
/** Whether config was successfully resolved. */
|
|
284
|
+
resolved: boolean;
|
|
285
|
+
}
|
|
286
|
+
/** A dataset in the user's workspace. */
|
|
287
|
+
export interface Dataset {
|
|
288
|
+
id: string;
|
|
289
|
+
name: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
workspace_id?: string;
|
|
292
|
+
source?: string;
|
|
293
|
+
hf_dataset_id?: string | null;
|
|
294
|
+
hf_subset?: string | null;
|
|
295
|
+
hf_split?: string | null;
|
|
296
|
+
dataset_type?: string;
|
|
297
|
+
detected_format?: string | null;
|
|
298
|
+
num_samples?: number | null;
|
|
299
|
+
num_columns?: number | null;
|
|
300
|
+
column_info?: Array<Record<string, unknown>>;
|
|
301
|
+
column_mapping?: Record<string, string> | null;
|
|
302
|
+
compatible_training_methods?: string[];
|
|
303
|
+
compatible_rlhf_algorithms?: string[];
|
|
304
|
+
detected_fields?: string[];
|
|
305
|
+
file_format?: string | null;
|
|
306
|
+
file_size_bytes?: number;
|
|
307
|
+
status?: string;
|
|
308
|
+
max_samples?: number | null;
|
|
309
|
+
error_message?: string | null;
|
|
310
|
+
progress_percent?: number;
|
|
311
|
+
progress_message?: string;
|
|
312
|
+
storage_mode?: string;
|
|
313
|
+
num_shards?: number | null;
|
|
314
|
+
method_usable_counts?: Record<string, number> | null;
|
|
315
|
+
consistency_info?: Record<string, unknown> | null;
|
|
316
|
+
validation_warnings?: string[];
|
|
317
|
+
created_at?: string;
|
|
318
|
+
/** @deprecated Use file_size_bytes. Populated as a compatibility alias. */
|
|
319
|
+
file_size?: number;
|
|
320
|
+
/** @deprecated Use num_samples. Populated as a compatibility alias. */
|
|
321
|
+
row_count?: number;
|
|
322
|
+
/** @deprecated Use num_columns. Populated as a compatibility alias. */
|
|
323
|
+
column_count?: number;
|
|
324
|
+
/** @deprecated Use file_format or detected_format. Populated as a compatibility alias. */
|
|
325
|
+
format?: string;
|
|
326
|
+
}
|
|
327
|
+
/** Parameters for listing datasets. */
|
|
328
|
+
export interface DatasetListParams {
|
|
329
|
+
/** Filter by workspace ID. */
|
|
330
|
+
workspaceId?: string;
|
|
331
|
+
/** Filter by dataset type. */
|
|
332
|
+
datasetType?: string;
|
|
333
|
+
/** Lifecycle bucket: ready, processing, or failed. */
|
|
334
|
+
status?: 'ready' | 'processing' | 'failed';
|
|
335
|
+
/** Case-insensitive name search. */
|
|
336
|
+
query?: string;
|
|
337
|
+
/** Server-side ordering. */
|
|
338
|
+
sort?: 'newest' | 'oldest' | 'name' | 'size';
|
|
339
|
+
/** Page size (maximum 200). */
|
|
340
|
+
limit?: number;
|
|
341
|
+
/** Page offset. */
|
|
342
|
+
offset?: number;
|
|
343
|
+
}
|
|
344
|
+
/** Server-driven dataset page returned by GET /api/datasets. */
|
|
345
|
+
export interface DatasetListResponse {
|
|
346
|
+
datasets: Dataset[];
|
|
347
|
+
total: number;
|
|
348
|
+
counts: {
|
|
349
|
+
all: number;
|
|
350
|
+
ready: number;
|
|
351
|
+
processing: number;
|
|
352
|
+
failed: number;
|
|
353
|
+
};
|
|
354
|
+
total_samples: number;
|
|
355
|
+
limit: number;
|
|
356
|
+
offset: number;
|
|
357
|
+
}
|
|
358
|
+
/** Parameters for uploading a dataset. */
|
|
359
|
+
export interface DatasetUploadParams {
|
|
360
|
+
/** Path to the file on disk (Node.js only). */
|
|
361
|
+
filePath: string;
|
|
362
|
+
/** Display name for the dataset. */
|
|
363
|
+
name: string;
|
|
364
|
+
/** Optional description. */
|
|
365
|
+
description?: string;
|
|
366
|
+
/** Target workspace ID. */
|
|
367
|
+
workspaceId?: string;
|
|
368
|
+
/** Dataset format hint (e.g. "jsonl", "csv", "parquet"). */
|
|
369
|
+
format?: string;
|
|
370
|
+
/** Maximum number of samples to retain. */
|
|
371
|
+
maxSamples?: number;
|
|
372
|
+
/** Optional source-to-canonical column mapping. */
|
|
373
|
+
columnMapping?: Record<string, string>;
|
|
374
|
+
}
|
|
375
|
+
/** Parameters for previewing dataset rows. */
|
|
376
|
+
export interface DatasetPreviewParams {
|
|
377
|
+
/** Page number (1-indexed). Defaults to 1. */
|
|
378
|
+
page?: number;
|
|
379
|
+
/** Number of rows per page. Defaults to 10. */
|
|
380
|
+
pageSize?: number;
|
|
381
|
+
}
|
|
382
|
+
/** Dataset preview response. */
|
|
383
|
+
export interface DatasetPreview {
|
|
384
|
+
samples: Record<string, unknown>[];
|
|
385
|
+
total: number;
|
|
386
|
+
page: number;
|
|
387
|
+
page_size: number;
|
|
388
|
+
total_pages: number;
|
|
389
|
+
/** @deprecated Use samples. Populated as a compatibility alias. */
|
|
390
|
+
rows?: Record<string, unknown>[];
|
|
391
|
+
/** @deprecated Use total. Populated as a compatibility alias. */
|
|
392
|
+
total_rows?: number;
|
|
393
|
+
}
|
|
394
|
+
/** Parameters for importing a dataset from HuggingFace Hub. */
|
|
395
|
+
export interface DatasetImportHFParams {
|
|
396
|
+
/** HuggingFace dataset repository ID (e.g. "databricks/dolly-15k"). */
|
|
397
|
+
repoId: string;
|
|
398
|
+
/** Display name for the imported dataset. */
|
|
399
|
+
name?: string;
|
|
400
|
+
/** Dataset subset/config to import. */
|
|
401
|
+
subset?: string;
|
|
402
|
+
/** Dataset split to import (e.g. "train", "test"). */
|
|
403
|
+
split?: string;
|
|
404
|
+
/** Maximum number of samples to import. */
|
|
405
|
+
maxSamples?: number;
|
|
406
|
+
/** HuggingFace integration ID for private datasets. */
|
|
407
|
+
integrationId?: string;
|
|
408
|
+
/** Sampling strategy used with maxSamples. */
|
|
409
|
+
sampleStrategy?: 'first' | 'random';
|
|
410
|
+
/** Optional source-to-canonical column mapping. */
|
|
411
|
+
columnMapping?: Record<string, string>;
|
|
412
|
+
/** Whether to reference or materialize the source dataset. */
|
|
413
|
+
importMode?: 'auto' | 'reference' | 'materialize';
|
|
414
|
+
}
|
|
415
|
+
/** Parameters for registering a HuggingFace dataset without an integration. */
|
|
416
|
+
export interface DatasetRegisterHFParams {
|
|
417
|
+
repoId: string;
|
|
418
|
+
name?: string;
|
|
419
|
+
workspaceId?: string;
|
|
420
|
+
description?: string;
|
|
421
|
+
subset?: string;
|
|
422
|
+
split?: string;
|
|
423
|
+
maxSamples?: number;
|
|
424
|
+
sampleStrategy?: 'first' | 'random';
|
|
425
|
+
columnMapping?: Record<string, string>;
|
|
426
|
+
importMode?: 'auto' | 'reference' | 'materialize';
|
|
427
|
+
}
|
|
428
|
+
/** Parameters for searching HuggingFace Hub datasets. */
|
|
429
|
+
export interface DatasetHubSearchParams {
|
|
430
|
+
/** Search query. */
|
|
431
|
+
query?: string;
|
|
432
|
+
/** Page number (1-indexed). Defaults to 1. */
|
|
433
|
+
page?: number;
|
|
434
|
+
/** Sort order. Defaults to "downloads". */
|
|
435
|
+
sort?: 'downloads' | 'likes' | 'trending';
|
|
436
|
+
}
|
|
437
|
+
/** Parameters for previewing a HuggingFace Hub dataset. */
|
|
438
|
+
export interface DatasetHubPreviewParams {
|
|
439
|
+
/** HuggingFace dataset ID. */
|
|
440
|
+
datasetId: string;
|
|
441
|
+
/** Split to preview. Defaults to "train". */
|
|
442
|
+
split?: string;
|
|
443
|
+
/** Subset/config name. */
|
|
444
|
+
subset?: string;
|
|
445
|
+
/** Number of rows to preview. Defaults to 10. */
|
|
446
|
+
limit?: number;
|
|
447
|
+
}
|
|
448
|
+
/** Dataset validation result. */
|
|
449
|
+
export interface DatasetValidation {
|
|
450
|
+
dataset_type: string;
|
|
451
|
+
detected_format?: string | null;
|
|
452
|
+
confidence: number;
|
|
453
|
+
format_valid: boolean;
|
|
454
|
+
num_samples: number;
|
|
455
|
+
num_columns: number;
|
|
456
|
+
detected_fields: string[];
|
|
457
|
+
column_info: Array<Record<string, unknown>>;
|
|
458
|
+
compatible_training_methods: string[];
|
|
459
|
+
compatible_rlhf_algorithms: string[];
|
|
460
|
+
method_usable_counts?: Record<string, number> | null;
|
|
461
|
+
validation_errors: string[];
|
|
462
|
+
validation_warnings: string[];
|
|
463
|
+
consistency?: Record<string, unknown> | null;
|
|
464
|
+
preview_samples: Record<string, unknown>[];
|
|
465
|
+
}
|
|
466
|
+
/** One accepted row shape for a dataset type. */
|
|
467
|
+
export interface DatasetFormatVariant {
|
|
468
|
+
name: string;
|
|
469
|
+
required_fields: string[];
|
|
470
|
+
description: string;
|
|
471
|
+
example: string;
|
|
472
|
+
needs_conversion?: boolean;
|
|
473
|
+
}
|
|
474
|
+
/** Dataset format specification for one training family. */
|
|
475
|
+
export interface DatasetFormatSpec {
|
|
476
|
+
label: string;
|
|
477
|
+
formats: DatasetFormatVariant[];
|
|
478
|
+
}
|
|
479
|
+
/** Mapping keyed by dataset type (sft, rlhf_offline_preference, pt, etc.). */
|
|
480
|
+
export type DatasetFormatSpecs = Record<string, DatasetFormatSpec>;
|
|
481
|
+
/** Dataset storage usage info. */
|
|
482
|
+
export interface DatasetStorageUsage {
|
|
483
|
+
total_bytes: number;
|
|
484
|
+
total_mb?: number;
|
|
485
|
+
total_gb?: number;
|
|
486
|
+
dataset_count: number;
|
|
487
|
+
workspace_id?: string | null;
|
|
488
|
+
pricing?: Record<string, number>;
|
|
489
|
+
recent_charges?: Array<Record<string, unknown>>;
|
|
490
|
+
}
|
|
491
|
+
/** Supported training methods. */
|
|
492
|
+
export type TrainingMethod = 'sft' | 'rlhf' | 'pt' | 'vlm';
|
|
493
|
+
/** Supported RLHF algorithms. */
|
|
494
|
+
export type RLHFAlgorithm = 'dpo' | 'simpo' | 'cpo' | 'orpo' | 'kto' | 'rm';
|
|
495
|
+
/** Supported adapter types. */
|
|
496
|
+
export type AdapterType = 'lora' | 'qlora' | 'adalora' | 'full' | 'loha' | 'lokr' | 'boft' | 'oft' | 'vera' | 'fourierft' | 'bone' | 'adapter' | 'reft' | 'llamapro' | 'longlora';
|
|
497
|
+
/** Training job status values. */
|
|
498
|
+
export type TrainingJobStatus = 'pending' | 'queued' | 'securing' | 'booked' | 'provisioning' | 'preparing' | 'starting' | 'downloading' | 'running' | 'completed' | 'failed' | 'interrupted' | 'saving' | 'stopped' | 'stopping' | 'resuming' | 'cancelled';
|
|
499
|
+
/** Status values accepted by GET /api/training/jobs?status=. */
|
|
500
|
+
export type TrainingStatusFilter = 'pending' | 'queued' | 'securing' | 'booked' | 'provisioning' | 'preparing' | 'starting' | 'running' | 'interrupted' | 'saving' | 'completed' | 'failed' | 'stopped';
|
|
501
|
+
/** One ranked GPU fallback choice. The first choice is the primary. */
|
|
502
|
+
export interface GPUChoice {
|
|
503
|
+
gpuType: string;
|
|
504
|
+
gpuCount: number;
|
|
505
|
+
/** Neutral USF Cloud placement selector; omit to let the platform choose. */
|
|
506
|
+
provider?: string;
|
|
507
|
+
/** Placement region; omit for the default global market. */
|
|
508
|
+
region?: string;
|
|
509
|
+
/** Native market tier; training and deployment capacity are secure-only. */
|
|
510
|
+
tier?: 'secure';
|
|
511
|
+
}
|
|
512
|
+
/** Parameters for creating a training job. */
|
|
513
|
+
export interface TrainingCreateParams {
|
|
514
|
+
/** Stable retry key. Reuse it after a timeout; a new value creates a new job. Auto-generated when omitted. */
|
|
515
|
+
idempotencyKey?: string;
|
|
516
|
+
/**
|
|
517
|
+
* Model id to fine-tune. Must be hosted on Run BiOS — pick from the platform's
|
|
518
|
+
* own catalog (client.models.search); arbitrary Hugging Face ids are
|
|
519
|
+
* rejected. Training FROM a fine-tuned model (adapter stacking) is not
|
|
520
|
+
* supported; every job starts from a catalog base model.
|
|
521
|
+
*/
|
|
522
|
+
model: string;
|
|
523
|
+
/** Optional model branch, tag, or commit; the API canonicalizes it to an exact commit. */
|
|
524
|
+
modelRevision?: string;
|
|
525
|
+
/** One dataset ID to train on. Kept for compatibility with single-dataset jobs. */
|
|
526
|
+
datasetId?: string;
|
|
527
|
+
/** Ordered dataset IDs for multi-dataset training. */
|
|
528
|
+
datasetIds?: string[];
|
|
529
|
+
/**
|
|
530
|
+
* Optional per-dataset row cap: keep only the first N rows of a dataset
|
|
531
|
+
* (key = a dataset ID from datasetIds, value = row count). Omit an entry, or
|
|
532
|
+
* use 0, to train on the whole dataset. Useful for training on a slice of a
|
|
533
|
+
* large dataset without importing a trimmed copy.
|
|
534
|
+
*/
|
|
535
|
+
datasetSampleLimits?: Record<string, number>;
|
|
536
|
+
/** Training method. */
|
|
537
|
+
method: TrainingMethod;
|
|
538
|
+
/** Adapter type. */
|
|
539
|
+
adapter: AdapterType;
|
|
540
|
+
/** RLHF algorithm (required when method is "rlhf"). */
|
|
541
|
+
rlhfAlgorithm?: RLHFAlgorithm;
|
|
542
|
+
/** GPU type identifier. */
|
|
543
|
+
gpuType?: string;
|
|
544
|
+
/** Number of GPUs to use. */
|
|
545
|
+
gpuCount?: number;
|
|
546
|
+
/** Primary and backup GPU choices, in priority order (maximum five). */
|
|
547
|
+
gpuPriorities?: GPUChoice[];
|
|
548
|
+
/** Consent to try 3-5 ranked, distinct GPU types when the primary is unavailable. */
|
|
549
|
+
queueIfUnavailable?: boolean;
|
|
550
|
+
/** Optional RFC 3339 queue deadline, from one minute through seven days in the future. */
|
|
551
|
+
queueDeadline?: string | Date;
|
|
552
|
+
/** Maximum accepted total hourly price for the complete GPU count, in cents. */
|
|
553
|
+
maxPriceHourCents?: number;
|
|
554
|
+
/** Display name for the job. */
|
|
555
|
+
name?: string;
|
|
556
|
+
/** Target workspace ID. */
|
|
557
|
+
workspaceId?: string;
|
|
558
|
+
/** Number of training epochs. */
|
|
559
|
+
epochs?: number;
|
|
560
|
+
/** Training batch size per device. */
|
|
561
|
+
batchSize?: number;
|
|
562
|
+
/** Gradient accumulation steps. */
|
|
563
|
+
gradientAccumulation?: number;
|
|
564
|
+
/** Learning rate. */
|
|
565
|
+
learningRate?: number;
|
|
566
|
+
/** Learning rate scheduler type. */
|
|
567
|
+
lrScheduler?: string;
|
|
568
|
+
/** Warmup ratio (0-1). */
|
|
569
|
+
warmupRatio?: number;
|
|
570
|
+
/** Warmup steps (overrides warmupRatio). */
|
|
571
|
+
warmupSteps?: number;
|
|
572
|
+
/** Weight decay. */
|
|
573
|
+
weightDecay?: number;
|
|
574
|
+
/** Maximum gradient norm for clipping. */
|
|
575
|
+
maxGradNorm?: number;
|
|
576
|
+
/** Maximum sequence length. */
|
|
577
|
+
maxSeqLength?: number;
|
|
578
|
+
/** Enable gradient checkpointing. */
|
|
579
|
+
gradientCheckpointing?: boolean;
|
|
580
|
+
/** Enable mixed precision training (bf16/fp16). */
|
|
581
|
+
mixedPrecision?: 'bf16' | 'fp16' | 'no';
|
|
582
|
+
/** Random seed. */
|
|
583
|
+
seed?: number;
|
|
584
|
+
/** LoRA rank. */
|
|
585
|
+
loraRank?: number;
|
|
586
|
+
/** LoRA alpha scaling factor. */
|
|
587
|
+
loraAlpha?: number;
|
|
588
|
+
/** LoRA dropout rate. */
|
|
589
|
+
loraDropout?: number;
|
|
590
|
+
/** LoRA target modules (comma-separated or array). */
|
|
591
|
+
loraTargetModules?: string | string[];
|
|
592
|
+
/** Quantization bit width (4 or 8). */
|
|
593
|
+
quantizationBit?: 4 | 8;
|
|
594
|
+
/** DeepSpeed stage ("zero2" or "zero3"). */
|
|
595
|
+
deepspeed?: 'zero2' | 'zero3';
|
|
596
|
+
/** Storage size in GB. */
|
|
597
|
+
storageGb?: number;
|
|
598
|
+
/** Number of checkpoints to retain at the platform level. */
|
|
599
|
+
numCheckpoints?: number;
|
|
600
|
+
/** Model parameter hint in billions; the server resolves and floors it. */
|
|
601
|
+
modelParamsB?: number;
|
|
602
|
+
/** Active-parameter hint for MoE models in billions. */
|
|
603
|
+
modelActiveParamsB?: number;
|
|
604
|
+
/** Integration used for gated/private model access. */
|
|
605
|
+
integrationId?: string;
|
|
606
|
+
/** Existing network volume to attach. */
|
|
607
|
+
networkVolumeId?: string;
|
|
608
|
+
/** Cache the composed dataset for retry/resume. Defaults to true server-side. */
|
|
609
|
+
cacheDataset?: boolean;
|
|
610
|
+
/** Legacy dataset ordering mode. Prefer mixing for weighted/phased plans. */
|
|
611
|
+
datasetMixing?: 'shuffle' | 'sequential' | 'interleave' | 'random' | 'curriculum';
|
|
612
|
+
/** Structured multi-dataset mixing plan. */
|
|
613
|
+
mixing?: Record<string, unknown>;
|
|
614
|
+
/** Save checkpoint every N steps. */
|
|
615
|
+
saveSteps?: number;
|
|
616
|
+
/** Save checkpoint every N epochs. */
|
|
617
|
+
saveEpochs?: number;
|
|
618
|
+
/** Maximum number of checkpoints to keep. */
|
|
619
|
+
maxCheckpoints?: number;
|
|
620
|
+
/** Evaluate every N steps. */
|
|
621
|
+
evalSteps?: number;
|
|
622
|
+
/** Evaluation dataset split. */
|
|
623
|
+
evalSplit?: string | number;
|
|
624
|
+
/** Additional configuration passed directly to the training backend. */
|
|
625
|
+
extraConfig?: Record<string, unknown>;
|
|
626
|
+
}
|
|
627
|
+
/** Parameters for listing training jobs. */
|
|
628
|
+
export interface TrainingListParams {
|
|
629
|
+
/** Filter by workspace ID. */
|
|
630
|
+
workspaceId?: string;
|
|
631
|
+
/** Filter by status. */
|
|
632
|
+
status?: TrainingStatusFilter;
|
|
633
|
+
/** Page size (maximum 100). */
|
|
634
|
+
limit?: number;
|
|
635
|
+
/** Page offset. */
|
|
636
|
+
offset?: number;
|
|
637
|
+
}
|
|
638
|
+
/** One phase of a training job's lifecycle (Progress Frame v2). */
|
|
639
|
+
export interface TrainingJobPhase {
|
|
640
|
+
/** Canonical phase id, e.g. "dataset_download", "model_load", "training", "checkpoint_upload". */
|
|
641
|
+
phase: string;
|
|
642
|
+
state: 'pending' | 'active' | 'done' | 'failed' | 'skipped';
|
|
643
|
+
/** Percent complete for the active phase, 0-100. */
|
|
644
|
+
pct?: number;
|
|
645
|
+
done_bytes?: number;
|
|
646
|
+
total_bytes?: number;
|
|
647
|
+
done_units?: number;
|
|
648
|
+
total_units?: number;
|
|
649
|
+
/** Unit for done_units/total_units, e.g. "bytes", "shards", "steps", "examples". */
|
|
650
|
+
units?: string;
|
|
651
|
+
/** Measured throughput in units per second. */
|
|
652
|
+
rate?: number;
|
|
653
|
+
eta_seconds?: number;
|
|
654
|
+
/** Per-item breakdown for fan-out phases (one entry per dataset in dataset_download). */
|
|
655
|
+
items?: Array<Record<string, unknown>>;
|
|
656
|
+
started_at?: string;
|
|
657
|
+
ended_at?: string;
|
|
658
|
+
updated_at?: string;
|
|
659
|
+
}
|
|
660
|
+
/** A training job. */
|
|
661
|
+
export interface TrainingJob {
|
|
662
|
+
id: string;
|
|
663
|
+
/** Present on create/resume responses; id is always normalized from this value. */
|
|
664
|
+
job_id?: string;
|
|
665
|
+
name?: string;
|
|
666
|
+
model_id?: string;
|
|
667
|
+
model_revision?: string;
|
|
668
|
+
training_method?: TrainingMethod;
|
|
669
|
+
train_type?: AdapterType;
|
|
670
|
+
rlhf_type?: RLHFAlgorithm | null;
|
|
671
|
+
dataset_ids?: string[];
|
|
672
|
+
gpu_type?: string;
|
|
673
|
+
gpu_count?: number;
|
|
674
|
+
storage_gb?: number;
|
|
675
|
+
status: TrainingJobStatus;
|
|
676
|
+
error_message?: string | null;
|
|
677
|
+
error_code?: string | null;
|
|
678
|
+
current_step?: number;
|
|
679
|
+
total_steps?: number;
|
|
680
|
+
current_loss?: number | null;
|
|
681
|
+
best_loss?: number | null;
|
|
682
|
+
config?: Record<string, unknown>;
|
|
683
|
+
started_at?: string;
|
|
684
|
+
completed_at?: string;
|
|
685
|
+
created_at?: string;
|
|
686
|
+
billing_started_at?: string;
|
|
687
|
+
resume_from_job_id?: string | null;
|
|
688
|
+
resume_count?: number;
|
|
689
|
+
can_resume?: boolean;
|
|
690
|
+
has_cached_dataset?: boolean;
|
|
691
|
+
final_model_s3_key?: string | null;
|
|
692
|
+
mix_manifest?: Record<string, unknown> | null;
|
|
693
|
+
preserve_on_stop?: boolean;
|
|
694
|
+
desired_state?: 'running' | 'stopped';
|
|
695
|
+
stop_state?: 'idle' | 'requested' | 'signalled' | 'terminating' | 'applied' | 'superseded';
|
|
696
|
+
stop_requested_at?: string | null;
|
|
697
|
+
stop_bios_accepted_at?: string | null;
|
|
698
|
+
stop_last_error?: string | null;
|
|
699
|
+
s3_upload_status?: string | null;
|
|
700
|
+
progress?: unknown;
|
|
701
|
+
stage?: string;
|
|
702
|
+
stage_detail?: string;
|
|
703
|
+
attempt?: number;
|
|
704
|
+
attempts_max?: number;
|
|
705
|
+
billed_cents?: number;
|
|
706
|
+
billable_seconds?: number;
|
|
707
|
+
stage_elapsed_seconds?: number;
|
|
708
|
+
stage_estimate_seconds?: number;
|
|
709
|
+
dl_done_bytes?: number;
|
|
710
|
+
dl_total_bytes?: number;
|
|
711
|
+
ds_done_bytes?: number;
|
|
712
|
+
ds_total_bytes?: number;
|
|
713
|
+
checkpoint_count?: number;
|
|
714
|
+
/** The current machine attempt's per-phase records, in canonical order. */
|
|
715
|
+
phases?: TrainingJobPhase[];
|
|
716
|
+
/** Estimated seconds until the job finishes (absent when unknown). */
|
|
717
|
+
eta_seconds?: number;
|
|
718
|
+
/** How the ETA was derived: measured on the machine, or from historical medians. */
|
|
719
|
+
eta_confidence?: 'measured' | 'historical';
|
|
720
|
+
/** Most recent per-phase update time. */
|
|
721
|
+
last_phase_update_at?: string;
|
|
722
|
+
/**
|
|
723
|
+
* The current machine attempt id. Quote this when contacting support — it
|
|
724
|
+
* identifies the exact machine attempt behind a run.
|
|
725
|
+
*/
|
|
726
|
+
attempt_id?: string;
|
|
727
|
+
/** Last time the machine reported in. */
|
|
728
|
+
last_callback_at?: string;
|
|
729
|
+
/** How the platform is hearing from the machine right now. */
|
|
730
|
+
push_channel_state?: 'live' | 'delayed' | 'poll_only';
|
|
731
|
+
/** @deprecated Use model_id. Populated as a compatibility alias when known. */
|
|
732
|
+
model?: string;
|
|
733
|
+
/** @deprecated Use training_method. Populated as a compatibility alias when known. */
|
|
734
|
+
method?: TrainingMethod;
|
|
735
|
+
/** @deprecated Use train_type. Populated as a compatibility alias when known. */
|
|
736
|
+
adapter?: AdapterType;
|
|
737
|
+
/** @deprecated Use rlhf_type. Populated as a compatibility alias when known. */
|
|
738
|
+
rlhf_algorithm?: RLHFAlgorithm;
|
|
739
|
+
/** @deprecated Use dataset_ids. Populated from the first dataset when known. */
|
|
740
|
+
dataset_id?: string;
|
|
741
|
+
/** @deprecated Use error_message. */
|
|
742
|
+
error?: string;
|
|
743
|
+
}
|
|
744
|
+
/** Paginated response from GET /api/training/jobs. */
|
|
745
|
+
export interface TrainingListResponse {
|
|
746
|
+
jobs: TrainingJob[];
|
|
747
|
+
total: number;
|
|
748
|
+
limit: number;
|
|
749
|
+
offset: number;
|
|
750
|
+
}
|
|
751
|
+
/** Training metrics for a job. */
|
|
752
|
+
export interface TrainingMetrics {
|
|
753
|
+
metrics: MetricPoint[];
|
|
754
|
+
training_method?: string | null;
|
|
755
|
+
rlhf_type?: string | null;
|
|
756
|
+
graph_configs: MetricGraphConfig[];
|
|
757
|
+
/** @deprecated Use metrics. Populated as a compatibility alias. */
|
|
758
|
+
steps?: MetricPoint[];
|
|
759
|
+
}
|
|
760
|
+
/** A single metric data point. */
|
|
761
|
+
export interface MetricPoint {
|
|
762
|
+
step: number;
|
|
763
|
+
epoch?: number;
|
|
764
|
+
loss?: number;
|
|
765
|
+
eval_loss?: number;
|
|
766
|
+
learning_rate?: number;
|
|
767
|
+
grad_norm?: number;
|
|
768
|
+
reward?: number;
|
|
769
|
+
gpu_memory_mb?: number;
|
|
770
|
+
gpu_utilization_pct?: number;
|
|
771
|
+
extra_metrics?: Record<string, unknown>;
|
|
772
|
+
timestamp: string;
|
|
773
|
+
[key: string]: unknown;
|
|
774
|
+
}
|
|
775
|
+
/** Metric series configuration returned for the selected training method. */
|
|
776
|
+
export interface MetricGraphConfig {
|
|
777
|
+
key: string;
|
|
778
|
+
label: string;
|
|
779
|
+
color: string;
|
|
780
|
+
}
|
|
781
|
+
/** A training checkpoint. */
|
|
782
|
+
export interface TrainingCheckpoint {
|
|
783
|
+
id: string;
|
|
784
|
+
name: string;
|
|
785
|
+
step: number;
|
|
786
|
+
epoch?: number | null;
|
|
787
|
+
size_bytes: number;
|
|
788
|
+
is_final: boolean;
|
|
789
|
+
is_best: boolean;
|
|
790
|
+
base_model_id: string;
|
|
791
|
+
base_model_revision: string;
|
|
792
|
+
created_at: string;
|
|
793
|
+
}
|
|
794
|
+
/** Training logs response. */
|
|
795
|
+
export interface TrainingLogs {
|
|
796
|
+
logs: TrainingLogEntry[];
|
|
797
|
+
/** Plain-text compatibility view of logs, oldest API clients can migrate to entries. */
|
|
798
|
+
lines?: string[];
|
|
799
|
+
}
|
|
800
|
+
/** One structured training log entry. */
|
|
801
|
+
export interface TrainingLogEntry {
|
|
802
|
+
level: string;
|
|
803
|
+
message: string;
|
|
804
|
+
timestamp: string;
|
|
805
|
+
}
|
|
806
|
+
/** Response from stopping a training job. */
|
|
807
|
+
export interface TrainingStopResponse {
|
|
808
|
+
message: string;
|
|
809
|
+
job_id: string;
|
|
810
|
+
status: TrainingJobStatus;
|
|
811
|
+
desired_state: 'stopped';
|
|
812
|
+
stop_state: 'requested' | 'signalled' | 'terminating' | 'applied';
|
|
813
|
+
keep_data: boolean;
|
|
814
|
+
requested_at?: string | null;
|
|
815
|
+
}
|
|
816
|
+
/** Response from resuming a training job into a new job. */
|
|
817
|
+
export interface TrainingResumeResponse {
|
|
818
|
+
id: string;
|
|
819
|
+
job_id: string;
|
|
820
|
+
name: string;
|
|
821
|
+
status: TrainingJobStatus;
|
|
822
|
+
resume_from: string;
|
|
823
|
+
checkpoint: string;
|
|
824
|
+
resume_count: number;
|
|
825
|
+
model_id: string;
|
|
826
|
+
model_revision: string;
|
|
827
|
+
}
|
|
828
|
+
/** Canonical snake_case request echoed by the side-effect-free preflight API. */
|
|
829
|
+
export interface CanonicalTrainingRequest {
|
|
830
|
+
workspace_id: string;
|
|
831
|
+
name: string;
|
|
832
|
+
dataset_id: string;
|
|
833
|
+
dataset_ids: string[];
|
|
834
|
+
hf_dataset_ids?: string;
|
|
835
|
+
dataset_mixing?: string;
|
|
836
|
+
mixing?: Record<string, unknown>;
|
|
837
|
+
model_id: string;
|
|
838
|
+
model_revision?: string;
|
|
839
|
+
training_method: TrainingMethod;
|
|
840
|
+
train_type: AdapterType;
|
|
841
|
+
rlhf_type?: RLHFAlgorithm;
|
|
842
|
+
gpu_type: string;
|
|
843
|
+
gpu_count: number;
|
|
844
|
+
gpu_priorities?: Array<{
|
|
845
|
+
gpu_type: string;
|
|
846
|
+
gpu_count: number;
|
|
847
|
+
provider?: string;
|
|
848
|
+
region?: string;
|
|
849
|
+
tier?: 'secure';
|
|
850
|
+
}>;
|
|
851
|
+
queue_if_unavailable?: boolean;
|
|
852
|
+
queue_deadline?: string;
|
|
853
|
+
max_price_hour_cents?: number;
|
|
854
|
+
storage_gb: number;
|
|
855
|
+
num_checkpoints?: number;
|
|
856
|
+
model_params_b?: number;
|
|
857
|
+
model_active_params_b?: number;
|
|
858
|
+
integration_id?: string;
|
|
859
|
+
network_volume_id?: string;
|
|
860
|
+
cache_dataset?: boolean;
|
|
861
|
+
config: Record<string, unknown>;
|
|
862
|
+
}
|
|
863
|
+
export interface TrainingPreflightDataset {
|
|
864
|
+
id: string;
|
|
865
|
+
status: string;
|
|
866
|
+
dataset_type?: string;
|
|
867
|
+
storage_mode?: string;
|
|
868
|
+
method_usable_counts?: Record<string, number>;
|
|
869
|
+
requires_revalidation: boolean;
|
|
870
|
+
}
|
|
871
|
+
export interface TrainingPreflightWarning {
|
|
872
|
+
code: string;
|
|
873
|
+
message: string;
|
|
874
|
+
}
|
|
875
|
+
/** Side-effect-free validation/sizing result; this endpoint never creates or bills a job. */
|
|
876
|
+
export interface TrainingPreflightResponse {
|
|
877
|
+
valid: boolean;
|
|
878
|
+
contract_version: string;
|
|
879
|
+
request_hash: string;
|
|
880
|
+
canonical_request: CanonicalTrainingRequest;
|
|
881
|
+
datasets: TrainingPreflightDataset[];
|
|
882
|
+
model_params_b: number;
|
|
883
|
+
model_active_params_b?: number;
|
|
884
|
+
minimum_vram_gb: number;
|
|
885
|
+
minimum_storage_gb: number;
|
|
886
|
+
gpu_options: GPUOption[];
|
|
887
|
+
recommended?: GPUOption;
|
|
888
|
+
suggestions: GPUOptionSuggestion[];
|
|
889
|
+
availability_known: boolean;
|
|
890
|
+
availability_checked_at?: string;
|
|
891
|
+
queue_eligible: boolean;
|
|
892
|
+
warnings: TrainingPreflightWarning[];
|
|
893
|
+
checked_at: string;
|
|
894
|
+
}
|
|
895
|
+
/** One method, algorithm, or adapter reported by the pinned training engine. */
|
|
896
|
+
export interface TrainingCapabilityChoice {
|
|
897
|
+
id: string;
|
|
898
|
+
name: string;
|
|
899
|
+
enabled: boolean;
|
|
900
|
+
engine_supported: boolean;
|
|
901
|
+
disabled_reason?: string;
|
|
902
|
+
aliases?: string[];
|
|
903
|
+
supported_methods?: string[];
|
|
904
|
+
supported_algorithms?: string[];
|
|
905
|
+
dependencies?: string[];
|
|
906
|
+
}
|
|
907
|
+
/** JSON-schema-like description of one accepted config field. */
|
|
908
|
+
export interface TrainingConfigFieldCapability {
|
|
909
|
+
name: string;
|
|
910
|
+
label: string;
|
|
911
|
+
type: 'integer' | 'number' | 'boolean' | 'string' | 'string_array' | 'string_or_string_array' | 'object';
|
|
912
|
+
default: unknown;
|
|
913
|
+
enabled: boolean;
|
|
914
|
+
disabled_reason?: string;
|
|
915
|
+
aliases?: string[];
|
|
916
|
+
enum?: string[];
|
|
917
|
+
minimum?: number;
|
|
918
|
+
maximum?: number;
|
|
919
|
+
exclusive_minimum?: boolean;
|
|
920
|
+
methods?: string[];
|
|
921
|
+
algorithms?: string[];
|
|
922
|
+
adapters?: string[];
|
|
923
|
+
description?: string;
|
|
924
|
+
}
|
|
925
|
+
/** Dynamic contract returned by GET /api/training/capabilities. */
|
|
926
|
+
export interface TrainingCapabilities {
|
|
927
|
+
contract_version: string;
|
|
928
|
+
schema_version: string;
|
|
929
|
+
methods: TrainingCapabilityChoice[];
|
|
930
|
+
algorithms: TrainingCapabilityChoice[];
|
|
931
|
+
adapters: TrainingCapabilityChoice[];
|
|
932
|
+
fields: TrainingConfigFieldCapability[];
|
|
933
|
+
incompatibilities: Array<{
|
|
934
|
+
code: string;
|
|
935
|
+
when: Record<string, unknown>;
|
|
936
|
+
message: string;
|
|
937
|
+
}>;
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Wallet balance (`GET /api/billing/wallet`).
|
|
941
|
+
*
|
|
942
|
+
* Two money figures, and they are NOT interchangeable: `balance_cents` is the
|
|
943
|
+
* deposited balance, while `available_balance_cents` is what can actually be
|
|
944
|
+
* spent right now (balance minus `active_holds_cents` and `accruing_cents`).
|
|
945
|
+
* Spend decisions read the second one.
|
|
946
|
+
*
|
|
947
|
+
* Auto top-up is FLAT, not nested, and the threshold/amount fields are in
|
|
948
|
+
* cents despite carrying no `_cents` suffix.
|
|
949
|
+
*/
|
|
950
|
+
export interface WalletBalance {
|
|
951
|
+
balance_cents: number;
|
|
952
|
+
/** Same figure formatted as "12.34"; convenience only. */
|
|
953
|
+
balance_dollars?: string;
|
|
954
|
+
available_balance_cents: number;
|
|
955
|
+
available_balance_dollars?: string;
|
|
956
|
+
/**
|
|
957
|
+
* Usage recorded per pod-minute but not yet closed into an hourly ledger
|
|
958
|
+
* row. `accrued_usage_cents` is the same number under its older name.
|
|
959
|
+
*/
|
|
960
|
+
accruing_cents?: number;
|
|
961
|
+
accrued_usage_cents?: number;
|
|
962
|
+
/** Money reserved by open deposits/authorizations on running work. */
|
|
963
|
+
active_holds_cents?: number;
|
|
964
|
+
currency: string;
|
|
965
|
+
auto_topup_enabled?: boolean;
|
|
966
|
+
/** Threshold in CENTS, despite the field name. */
|
|
967
|
+
auto_topup_threshold?: number;
|
|
968
|
+
/** Top-up amount in CENTS, despite the field name. */
|
|
969
|
+
auto_topup_amount?: number;
|
|
970
|
+
low_balance_bar1_cents?: number;
|
|
971
|
+
low_balance_bar2_cents?: number;
|
|
972
|
+
low_balance_bar3_cents?: number;
|
|
973
|
+
has_payment_method?: boolean;
|
|
974
|
+
has_stripe_customer?: boolean;
|
|
975
|
+
total_deposited_cents?: number;
|
|
976
|
+
total_spent_cents?: number;
|
|
977
|
+
total_tax_cents?: number;
|
|
978
|
+
transaction_count?: number;
|
|
979
|
+
}
|
|
980
|
+
/** One billing ledger row. */
|
|
981
|
+
export interface Transaction {
|
|
982
|
+
id: string;
|
|
983
|
+
wallet_id?: string;
|
|
984
|
+
/** credit | debit | refund */
|
|
985
|
+
type: string;
|
|
986
|
+
amount_cents: number;
|
|
987
|
+
tax_cents?: number;
|
|
988
|
+
balance_after_cents?: number;
|
|
989
|
+
source?: string;
|
|
990
|
+
source_ref?: string | null;
|
|
991
|
+
description?: string;
|
|
992
|
+
/**
|
|
993
|
+
* Coarse user-facing bucket: top_up, bonus, training_compute,
|
|
994
|
+
* inference_compute, compute, storage, training_deposit, inference_deposit,
|
|
995
|
+
* training_deposit_return, inference_deposit_return, deposit,
|
|
996
|
+
* deposit_return, card_refund, other. Presentation only, never money.
|
|
997
|
+
*/
|
|
998
|
+
category?: string;
|
|
999
|
+
/**
|
|
1000
|
+
* The resource this row was attributed to. Use these instead of a `job_id`
|
|
1001
|
+
* field, which the ledger does not return.
|
|
1002
|
+
*/
|
|
1003
|
+
resource_type?: string | null;
|
|
1004
|
+
resource_id?: string | null;
|
|
1005
|
+
status: string;
|
|
1006
|
+
metadata?: Record<string, unknown>;
|
|
1007
|
+
created_at: string;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Response from `GET /api/billing/transactions`.
|
|
1011
|
+
*
|
|
1012
|
+
* The rows are WRAPPED -- read `.transactions`, never the response itself.
|
|
1013
|
+
*/
|
|
1014
|
+
export interface TransactionListResponse {
|
|
1015
|
+
transactions: Transaction[];
|
|
1016
|
+
total: number;
|
|
1017
|
+
limit: number;
|
|
1018
|
+
offset: number;
|
|
1019
|
+
}
|
|
1020
|
+
/** Parameters for listing transactions. */
|
|
1021
|
+
export interface TransactionListParams {
|
|
1022
|
+
/** Maximum number of transactions. Defaults to 50. */
|
|
1023
|
+
limit?: number;
|
|
1024
|
+
/** Pagination offset. Defaults to 0. */
|
|
1025
|
+
offset?: number;
|
|
1026
|
+
}
|
|
1027
|
+
/** GPU pricing and availability info. */
|
|
1028
|
+
export interface GPUInfo {
|
|
1029
|
+
gpu_type: string;
|
|
1030
|
+
display_name: string;
|
|
1031
|
+
vram_gb: number;
|
|
1032
|
+
tier: string;
|
|
1033
|
+
best_for: string;
|
|
1034
|
+
max_gpu_count: number;
|
|
1035
|
+
default_storage_gb: number;
|
|
1036
|
+
param_range: string;
|
|
1037
|
+
methods: string;
|
|
1038
|
+
available: boolean;
|
|
1039
|
+
available_count: number;
|
|
1040
|
+
price_per_hour_cents: number;
|
|
1041
|
+
price_display: string;
|
|
1042
|
+
}
|
|
1043
|
+
/** Response from the GPU pricing endpoint. */
|
|
1044
|
+
export interface GPUPricingResponse {
|
|
1045
|
+
gpus: GPUInfo[];
|
|
1046
|
+
stale?: boolean;
|
|
1047
|
+
stale_message?: string;
|
|
1048
|
+
}
|
|
1049
|
+
/** Parameters understood by the authenticated training GPU-options endpoint. */
|
|
1050
|
+
export interface GPUOptionsParams {
|
|
1051
|
+
modelId: string;
|
|
1052
|
+
/** Requested model branch, tag, or commit; response returns the exact commit. */
|
|
1053
|
+
modelRevision?: string;
|
|
1054
|
+
/** Stored integration used for gated or private models. */
|
|
1055
|
+
integrationId?: string;
|
|
1056
|
+
/** Canonical adapter/train type. */
|
|
1057
|
+
trainType?: AdapterType | string;
|
|
1058
|
+
/** @deprecated Use trainType. */
|
|
1059
|
+
adapter?: AdapterType | string;
|
|
1060
|
+
method?: TrainingMethod | string;
|
|
1061
|
+
rlhfType?: RLHFAlgorithm | string;
|
|
1062
|
+
modelParamsB?: number;
|
|
1063
|
+
modelActiveParamsB?: number;
|
|
1064
|
+
}
|
|
1065
|
+
/** One model-aware GPU option with live stock and total-price context. */
|
|
1066
|
+
export interface GPUOption {
|
|
1067
|
+
gpu_type: string;
|
|
1068
|
+
display_name: string;
|
|
1069
|
+
vram_gb: number;
|
|
1070
|
+
price_per_hour_cents: number;
|
|
1071
|
+
available: boolean;
|
|
1072
|
+
available_count: number;
|
|
1073
|
+
max_gpu_count: number;
|
|
1074
|
+
min_gpu_count: number;
|
|
1075
|
+
required_count: number;
|
|
1076
|
+
recommended_count: number;
|
|
1077
|
+
total_price_per_hour_cents?: number;
|
|
1078
|
+
default_storage_gb: number;
|
|
1079
|
+
min_storage_gb: number;
|
|
1080
|
+
selectable: boolean;
|
|
1081
|
+
bookable: boolean;
|
|
1082
|
+
reason?: string;
|
|
1083
|
+
checked_at?: string;
|
|
1084
|
+
}
|
|
1085
|
+
/** Actionable alternative returned when no GPU option is currently bookable. */
|
|
1086
|
+
export interface GPUOptionSuggestion {
|
|
1087
|
+
type: 'adapter' | 'smaller_model' | 'wait' | string;
|
|
1088
|
+
adapter?: string;
|
|
1089
|
+
adapter_label?: string;
|
|
1090
|
+
gpu_type?: string;
|
|
1091
|
+
gpu_display_name?: string;
|
|
1092
|
+
gpu_count?: number;
|
|
1093
|
+
price_per_hour_cents?: number;
|
|
1094
|
+
message: string;
|
|
1095
|
+
}
|
|
1096
|
+
export interface GPUOptionsResponse {
|
|
1097
|
+
options: GPUOption[];
|
|
1098
|
+
/** Canonical owner/model identity. */
|
|
1099
|
+
model_id: string;
|
|
1100
|
+
/** Exact immutable 40-hex model commit used for sizing. */
|
|
1101
|
+
model_revision: string;
|
|
1102
|
+
model_params_b: number;
|
|
1103
|
+
min_vram_gb: number;
|
|
1104
|
+
min_storage_gb: number;
|
|
1105
|
+
availability_known: boolean;
|
|
1106
|
+
checked_at: string;
|
|
1107
|
+
recommended?: {
|
|
1108
|
+
gpu_type: string;
|
|
1109
|
+
gpu_count: number;
|
|
1110
|
+
storage_gb: number;
|
|
1111
|
+
price_per_hour_cents: number;
|
|
1112
|
+
total_price_per_hour_cents: number;
|
|
1113
|
+
};
|
|
1114
|
+
suggestions?: GPUOptionSuggestion[];
|
|
1115
|
+
}
|
|
1116
|
+
export type InferenceStatus = 'provisioning' | 'queued_capacity' | 'downloading_weights' | 'loading_model' | 'running' | 'degraded' | 'stopped' | 'paused_insufficient_funds' | 'crash_loop' | 'failed' | 'deleting' | 'deleted' | string;
|
|
1117
|
+
export type InferenceToolCallParser = 'deepseekv3' | 'deepseekv31' | 'deepseekv32' | 'glm' | 'glm45' | 'glm47' | 'gpt-oss' | 'kimi_k2' | 'lfm2' | 'llama3' | 'mimo' | 'mistral' | 'omega17' | 'omega17_exp' | 'omega17_vl_exp' | 'pythonic' | 'qwen' | 'qwen25' | 'qwen3_coder' | 'step3' | 'step3p5' | 'minimax-m2' | 'trinity' | 'interns1' | 'hermes' | 'gigachat3' | 'usf_omega' | 'usf_milli' | 'usf_mini';
|
|
1118
|
+
export type InferenceReasoningParser = 'deepseek-r1' | 'deepseek-v3' | 'glm45' | 'gpt-oss' | 'kimi' | 'kimi_k2' | 'mimo' | 'qwen3' | 'qwen3-thinking' | 'minimax' | 'minimax-append-think' | 'step3' | 'step3p5' | 'mistral' | 'nemotron_3' | 'interns1' | 'usf_omega' | 'usf_milli' | 'usf_mini';
|
|
1119
|
+
/** How the tool-call verdict was reached and what callers can expect. */
|
|
1120
|
+
export type InferenceToolCallMode = 'native' | 'best_effort' | 'off' | 'unsupported';
|
|
1121
|
+
export interface InferenceServingConfig {
|
|
1122
|
+
/**
|
|
1123
|
+
* 'auto' (default) derives the format from the model's own chat template;
|
|
1124
|
+
* 'off' disables tool calling for this deployment; a concrete family name
|
|
1125
|
+
* forces that parser. Unknown names are rejected before GPU allocation.
|
|
1126
|
+
*/
|
|
1127
|
+
tool_call_parser?: InferenceToolCallParser | 'auto' | 'off';
|
|
1128
|
+
/** Same semantics as tool_call_parser, for reasoning extraction. */
|
|
1129
|
+
reasoning_parser?: InferenceReasoningParser | 'auto' | 'off';
|
|
1130
|
+
/**
|
|
1131
|
+
* Custom chat template (Jinja text, 64 KB max). Validated at save time and
|
|
1132
|
+
* applied at the next restart. A template with a known tool format enables
|
|
1133
|
+
* full tool support; an unknown format runs tools in best-effort mode.
|
|
1134
|
+
*/
|
|
1135
|
+
chat_template?: string;
|
|
1136
|
+
[key: string]: unknown;
|
|
1137
|
+
}
|
|
1138
|
+
export interface InferenceCreateParams {
|
|
1139
|
+
name: string;
|
|
1140
|
+
/**
|
|
1141
|
+
* Deployment source: a verified training checkpoint, or 'hf_model' — the
|
|
1142
|
+
* legacy wire name for a base model from the Run BiOS catalog (the platform's
|
|
1143
|
+
* own hosted registry, never a live Hugging Face reference).
|
|
1144
|
+
*/
|
|
1145
|
+
sourceType: 'checkpoint' | 'hf_model';
|
|
1146
|
+
sourceJobId?: string;
|
|
1147
|
+
sourceCheckpointId?: string;
|
|
1148
|
+
/**
|
|
1149
|
+
* Catalog model id (e.g. "meta-llama/Llama-3.1-8B-Instruct"), required with
|
|
1150
|
+
* sourceType 'hf_model'. Legacy field name: the model must be hosted on
|
|
1151
|
+
* Run BiOS (see client.models.search) — arbitrary Hugging Face ids are rejected.
|
|
1152
|
+
*/
|
|
1153
|
+
hfModelId?: string;
|
|
1154
|
+
/** Exact 40-hex commit returned by deployment preflight. */
|
|
1155
|
+
hfModelRevision?: string;
|
|
1156
|
+
/**
|
|
1157
|
+
* @deprecated Legacy field kept for wire compatibility. Catalog models are
|
|
1158
|
+
* pre-mirrored and never gated, so no integration is needed to deploy them.
|
|
1159
|
+
*/
|
|
1160
|
+
hfIntegrationId?: string;
|
|
1161
|
+
baseModelId?: string;
|
|
1162
|
+
/** Exact base-model commit returned by deployment preflight. */
|
|
1163
|
+
baseModelRevision?: string;
|
|
1164
|
+
/** Optional assertion; the API derives the authoritative mode from the verified source artifact. */
|
|
1165
|
+
servingMode?: 'full' | 'adapter' | 'merged';
|
|
1166
|
+
/**
|
|
1167
|
+
* SERVER-DERIVED and immutable, exactly like `servingMode` above: the
|
|
1168
|
+
* platform reads the task off the resolved model (chat for chat and vision
|
|
1169
|
+
* models, completion for a base checkpoint with no chat template, embedding,
|
|
1170
|
+
* rerank) and REJECTS a value that disagrees with its own derivation with
|
|
1171
|
+
* 400 "This model's serving mode is configured automatically from the model
|
|
1172
|
+
* itself". Whether a given value is accepted therefore depends on the MODEL,
|
|
1173
|
+
* which only the server can resolve, so the SDK does not pre-judge it: those
|
|
1174
|
+
* four are the canonical spellings, the server also accepts its own variants
|
|
1175
|
+
* (plurals, any case, surrounding space), and the value is forwarded
|
|
1176
|
+
* untouched for the server to rule on. Omit it and read the derived task back
|
|
1177
|
+
* from preflight's `canonical_request.model_task`.
|
|
1178
|
+
*/
|
|
1179
|
+
modelTask?: string;
|
|
1180
|
+
/**
|
|
1181
|
+
* SERVER-DERIVED. Accepted on the wire for backward compatibility and then
|
|
1182
|
+
* IGNORED: image-input support comes from the resolved model's own config
|
|
1183
|
+
* (vision_config / image tokens), never from the client. The SDK does not
|
|
1184
|
+
* forward it; read `supports_images` back from the deployment instead.
|
|
1185
|
+
*/
|
|
1186
|
+
supportsImages?: boolean;
|
|
1187
|
+
gpuType: string;
|
|
1188
|
+
gpuCount: number;
|
|
1189
|
+
/** Primary plus ranked fallback GPU types; queueing requires 3-5 distinct types. */
|
|
1190
|
+
gpuPriorities?: GPUChoice[];
|
|
1191
|
+
/** Deployment serving currently supports only the secure capacity tier. */
|
|
1192
|
+
gpuTier?: 'secure';
|
|
1193
|
+
/** Explicit consent to wait up to seven days when the selected SKU is unavailable. */
|
|
1194
|
+
allowCapacityQueue?: boolean;
|
|
1195
|
+
/** Maximum accepted total hourly price across all selected GPUs, in cents. */
|
|
1196
|
+
maxPriceHourCents?: number;
|
|
1197
|
+
storageGb?: number;
|
|
1198
|
+
/**
|
|
1199
|
+
* Serving context window in tokens. OMIT IT and the server pre-fills
|
|
1200
|
+
* `min(nativeMax, 262144)`; the window is adjustable only when the model's
|
|
1201
|
+
* native max exceeds the 32,768 floor (which is also the fallback when the
|
|
1202
|
+
* native window is unknown), and it can NEVER exceed the model's own native
|
|
1203
|
+
* max -- a larger value is rejected with 400 `context_length N exceeds the
|
|
1204
|
+
* model's maximum of M`. Read the ceiling from
|
|
1205
|
+
* `client.models.nativeMaxContext(modelId)` before deploying, and read it
|
|
1206
|
+
* back from `native_max_context` on the deployment detail.
|
|
1207
|
+
*
|
|
1208
|
+
* This is a SIZING input: a larger window means a larger KV cache and can
|
|
1209
|
+
* raise the minimum GPU count for the same model.
|
|
1210
|
+
*/
|
|
1211
|
+
contextLength?: number;
|
|
1212
|
+
quant?: string;
|
|
1213
|
+
servingConfig?: InferenceServingConfig;
|
|
1214
|
+
}
|
|
1215
|
+
export interface InferenceUpdateParams {
|
|
1216
|
+
allowCapacityQueue?: boolean;
|
|
1217
|
+
maxPriceHourCents?: number;
|
|
1218
|
+
/**
|
|
1219
|
+
* Raise or lower the serving window. Same policy as on create: never above
|
|
1220
|
+
* the model's native max (read it from `native_max_context` on the
|
|
1221
|
+
* deployment detail, or `client.models.nativeMaxContext(modelId)`), and
|
|
1222
|
+
* adjustable only when that native max exceeds the 32,768 floor. Raising it
|
|
1223
|
+
* enlarges the KV cache and can require more GPUs than the deployment holds.
|
|
1224
|
+
*/
|
|
1225
|
+
contextLength?: number;
|
|
1226
|
+
quant?: string;
|
|
1227
|
+
servingConfig?: InferenceServingConfig;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* One row of the deployment LIST (`GET /api/inference`).
|
|
1231
|
+
*
|
|
1232
|
+
* The list is a lean grid projection and is NOT the same shape as the detail:
|
|
1233
|
+
* it carries the model handle as `model_ref` (there is no `model` key -- that
|
|
1234
|
+
* only exists on the detail, where it aliases the name) plus per-deployment
|
|
1235
|
+
* usage counters, and it omits everything the detail resolves per row
|
|
1236
|
+
* (context_length, native_max_context, quantization, serving_config, endpoint
|
|
1237
|
+
* key prefix, queue block, connection, ...). Call `get(id)` for those.
|
|
1238
|
+
*/
|
|
1239
|
+
export interface InferenceDeploymentSummary {
|
|
1240
|
+
id: string;
|
|
1241
|
+
name: string;
|
|
1242
|
+
status: InferenceStatus;
|
|
1243
|
+
status_reason?: string;
|
|
1244
|
+
/** Compatibility alias of status_reason. */
|
|
1245
|
+
error_code?: string;
|
|
1246
|
+
desired_state: 'running' | 'stopped';
|
|
1247
|
+
source_type: 'checkpoint' | 'hf_model';
|
|
1248
|
+
/**
|
|
1249
|
+
* The deployment's model repo id (hf_model_id, else base_model_id, else "").
|
|
1250
|
+
* The detail exposes the same handle as hf_model_id / base_model_id.
|
|
1251
|
+
*/
|
|
1252
|
+
model_ref?: string;
|
|
1253
|
+
architecture?: string;
|
|
1254
|
+
params_total_b?: number;
|
|
1255
|
+
is_moe?: boolean;
|
|
1256
|
+
model_task?: 'chat' | 'completion' | 'embedding' | 'rerank';
|
|
1257
|
+
supports_images?: boolean;
|
|
1258
|
+
gpu_type: string;
|
|
1259
|
+
gpu_count: number;
|
|
1260
|
+
gpu_tier: 'secure';
|
|
1261
|
+
gpu_provider?: string;
|
|
1262
|
+
gpu_region?: string;
|
|
1263
|
+
cost_per_hour_cents?: number;
|
|
1264
|
+
endpoint_url?: string;
|
|
1265
|
+
created_at: string;
|
|
1266
|
+
started_at?: string | null;
|
|
1267
|
+
stopped_at?: string | null;
|
|
1268
|
+
/** Lifetime counters from the deployment's own metering rollup. */
|
|
1269
|
+
requests_total?: number;
|
|
1270
|
+
prompt_tokens_total?: number;
|
|
1271
|
+
generation_tokens_total?: number;
|
|
1272
|
+
gpu_seconds_total?: number;
|
|
1273
|
+
/** Streaming-only mean TTFT; null until a streamed request has landed. */
|
|
1274
|
+
avg_ttft_ms?: number | null;
|
|
1275
|
+
/**
|
|
1276
|
+
* Billed charge from one batched billing lookup; null when billing was
|
|
1277
|
+
* unreachable or slow (a money read never blocks the list).
|
|
1278
|
+
*/
|
|
1279
|
+
charged_cents?: number | null;
|
|
1280
|
+
/** History view (`include_terminated`) only: how the lifecycle closed, and when. */
|
|
1281
|
+
disposition?: string;
|
|
1282
|
+
deleted_at?: string | null;
|
|
1283
|
+
ended_at?: string | null;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* One deployment DETAIL (`GET /api/inference/{id}`). See
|
|
1287
|
+
* {@link InferenceDeploymentSummary} for the narrower list row.
|
|
1288
|
+
*/
|
|
1289
|
+
export interface InferenceDeployment {
|
|
1290
|
+
id: string;
|
|
1291
|
+
/**
|
|
1292
|
+
* The public model handle is the workspace-unique deployment NAME (the detail
|
|
1293
|
+
* aliases `name` here). The MODEL repo id is hf_model_id / base_model_id; the
|
|
1294
|
+
* list row calls it `model_ref`.
|
|
1295
|
+
*/
|
|
1296
|
+
name: string;
|
|
1297
|
+
model?: string;
|
|
1298
|
+
workspace_id?: string;
|
|
1299
|
+
status: InferenceStatus;
|
|
1300
|
+
/** Stable machine-readable terminal reason; queue expiry is `queue_expired`. */
|
|
1301
|
+
status_reason?: string | null;
|
|
1302
|
+
/** Compatibility alias for status_reason. */
|
|
1303
|
+
error_code?: string | null;
|
|
1304
|
+
desired_state: 'running' | 'stopped';
|
|
1305
|
+
/** 'hf_model' is the legacy wire name for a Run BiOS-catalog base model. */
|
|
1306
|
+
source_type: 'checkpoint' | 'hf_model';
|
|
1307
|
+
source_job_id?: string;
|
|
1308
|
+
source_checkpoint_id?: string;
|
|
1309
|
+
/** Catalog model id. Legacy field name — hosted on Run BiOS, not live Hugging Face. */
|
|
1310
|
+
hf_model_id?: string;
|
|
1311
|
+
hf_model_revision?: string | null;
|
|
1312
|
+
base_model_id?: string;
|
|
1313
|
+
base_model_revision?: string;
|
|
1314
|
+
immutable_base_model_source?: string;
|
|
1315
|
+
serving_mode?: 'full' | 'adapter' | 'merged';
|
|
1316
|
+
supports_tool_calls?: boolean;
|
|
1317
|
+
tool_call_parser?: InferenceToolCallParser | null;
|
|
1318
|
+
reasoning_parser?: InferenceReasoningParser | null;
|
|
1319
|
+
tool_call_mode?: InferenceToolCallMode;
|
|
1320
|
+
tool_calls_unsupported_reason?: string;
|
|
1321
|
+
tool_calls_note?: string;
|
|
1322
|
+
supports_reasoning?: boolean;
|
|
1323
|
+
tool_call_source?: string;
|
|
1324
|
+
/**
|
|
1325
|
+
* False for a base model with no chat template -- /v1/chat/completions
|
|
1326
|
+
* raises a tokenizer error there; use text completions instead.
|
|
1327
|
+
*/
|
|
1328
|
+
chat_capable?: boolean;
|
|
1329
|
+
is_base_model?: boolean;
|
|
1330
|
+
/** SERVER-DERIVED (see {@link InferenceCreateParams}). */
|
|
1331
|
+
model_task?: 'chat' | 'completion' | 'embedding' | 'rerank';
|
|
1332
|
+
architecture?: string;
|
|
1333
|
+
model_type?: string;
|
|
1334
|
+
params_total_b?: number;
|
|
1335
|
+
params_active_b?: number;
|
|
1336
|
+
is_moe?: boolean;
|
|
1337
|
+
quantization?: string;
|
|
1338
|
+
quant_locked?: boolean;
|
|
1339
|
+
weight_bytes?: number;
|
|
1340
|
+
/** The window this deployment runs with. */
|
|
1341
|
+
context_length?: number;
|
|
1342
|
+
/**
|
|
1343
|
+
* The model's native ceiling, which `context_length` can never be raised
|
|
1344
|
+
* past. 0 when the native max is unknown. LIST rows do not carry this.
|
|
1345
|
+
*/
|
|
1346
|
+
native_max_context?: number;
|
|
1347
|
+
storage_gb?: number;
|
|
1348
|
+
serving_config?: Record<string, unknown>;
|
|
1349
|
+
/**
|
|
1350
|
+
* True while the requested settings differ from the applied_* values the
|
|
1351
|
+
* engine is actually running.
|
|
1352
|
+
*/
|
|
1353
|
+
config_dirty?: boolean;
|
|
1354
|
+
applied_context_length?: number | null;
|
|
1355
|
+
applied_quantization?: string | null;
|
|
1356
|
+
applied_serving_config?: Record<string, unknown> | null;
|
|
1357
|
+
supports_images?: boolean;
|
|
1358
|
+
/** Weight-download progress while status is downloading_weights. */
|
|
1359
|
+
download_progress?: Record<string, unknown>;
|
|
1360
|
+
/** Sanitized pre-agent boot phase, present only while provisioning. */
|
|
1361
|
+
boot_progress?: Record<string, unknown>;
|
|
1362
|
+
boot_elapsed_seconds?: number;
|
|
1363
|
+
failed_phase?: string;
|
|
1364
|
+
restart_count?: number;
|
|
1365
|
+
last_heartbeat_at?: string | null;
|
|
1366
|
+
auto_sleep_minutes?: number | null;
|
|
1367
|
+
/** Segmented two-way connection health (push / pull / tunnel). */
|
|
1368
|
+
connection?: Record<string, unknown>;
|
|
1369
|
+
/**
|
|
1370
|
+
* The AUTHORITATIVE set of lifecycle actions this deployment accepts right
|
|
1371
|
+
* now, computed from the same guards resume/stop/restart/delete enforce.
|
|
1372
|
+
*/
|
|
1373
|
+
available_actions?: Record<string, boolean>;
|
|
1374
|
+
eligible_gpu_choice_count?: number;
|
|
1375
|
+
gpu_type: string;
|
|
1376
|
+
gpu_count: number;
|
|
1377
|
+
gpu_tier: 'secure';
|
|
1378
|
+
gpu_provider?: string;
|
|
1379
|
+
gpu_region?: string;
|
|
1380
|
+
cost_per_hour_cents?: number;
|
|
1381
|
+
max_price_hour_cents?: number;
|
|
1382
|
+
allow_capacity_queue?: boolean;
|
|
1383
|
+
queued_since?: string | null;
|
|
1384
|
+
queue_expires_at?: string | null;
|
|
1385
|
+
queue_position?: number | null;
|
|
1386
|
+
gpu_priorities?: Array<{
|
|
1387
|
+
gpu_type: string;
|
|
1388
|
+
gpu_count: number;
|
|
1389
|
+
provider?: string;
|
|
1390
|
+
region?: string;
|
|
1391
|
+
tier?: 'secure';
|
|
1392
|
+
}>;
|
|
1393
|
+
selected_gpu_rank?: number | null;
|
|
1394
|
+
queue?: InferenceQueue | null;
|
|
1395
|
+
provision_generation?: number;
|
|
1396
|
+
restart_generation?: number;
|
|
1397
|
+
restart_state?: 'idle' | 'in_progress' | 'waiting_ready';
|
|
1398
|
+
restart_requested_at?: string | null;
|
|
1399
|
+
restart_completed_at?: string | null;
|
|
1400
|
+
restart_claimed_until?: string | null;
|
|
1401
|
+
restart_last_error?: string | null;
|
|
1402
|
+
wallet_authorization_status?: 'active' | 'captured' | 'released' | 'refunded' | 'expired' | string;
|
|
1403
|
+
billing_contract_version?: number;
|
|
1404
|
+
endpoint_url?: string;
|
|
1405
|
+
inference_key_prefix?: string;
|
|
1406
|
+
last_error?: string;
|
|
1407
|
+
created_at: string;
|
|
1408
|
+
started_at?: string | null;
|
|
1409
|
+
stopped_at?: string | null;
|
|
1410
|
+
notification_delivery?: InferenceNotificationSummary;
|
|
1411
|
+
}
|
|
1412
|
+
export type InferenceNotificationState = 'pending' | 'sending' | 'delivered' | 'dead_letter';
|
|
1413
|
+
export interface InferenceNotification {
|
|
1414
|
+
id: number;
|
|
1415
|
+
deployment_id: string;
|
|
1416
|
+
event_type: string;
|
|
1417
|
+
template: string;
|
|
1418
|
+
template_data: Record<string, string>;
|
|
1419
|
+
idempotency_key: string;
|
|
1420
|
+
state: InferenceNotificationState;
|
|
1421
|
+
attempt_count: number;
|
|
1422
|
+
last_error?: string | null;
|
|
1423
|
+
created_at: string;
|
|
1424
|
+
updated_at: string;
|
|
1425
|
+
delivered_at?: string | null;
|
|
1426
|
+
dead_lettered_at?: string | null;
|
|
1427
|
+
}
|
|
1428
|
+
export interface InferenceNotificationSummary {
|
|
1429
|
+
pending: number;
|
|
1430
|
+
sending: number;
|
|
1431
|
+
delivered: number;
|
|
1432
|
+
dead_letter: number;
|
|
1433
|
+
}
|
|
1434
|
+
export interface InferenceNotificationListResponse {
|
|
1435
|
+
notifications: InferenceNotification[];
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* 202 body of a book-before-reveal create: no id, no key — only the opaque
|
|
1439
|
+
* handle to poll (`inference.getBooking` / `inference.waitForBooking`).
|
|
1440
|
+
*/
|
|
1441
|
+
export interface InferenceBookingAccepted {
|
|
1442
|
+
booking: {
|
|
1443
|
+
handle: string;
|
|
1444
|
+
status: 'booking';
|
|
1445
|
+
estimated_seconds: number;
|
|
1446
|
+
poll_url: string;
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
export interface InferenceCreateResponse {
|
|
1450
|
+
id: string;
|
|
1451
|
+
deployment_id: string;
|
|
1452
|
+
model: string;
|
|
1453
|
+
workspace_id: string;
|
|
1454
|
+
endpoint_url: string;
|
|
1455
|
+
status: InferenceStatus;
|
|
1456
|
+
/** Returned exactly once. Store it securely. */
|
|
1457
|
+
inference_key: string;
|
|
1458
|
+
inference_key_prefix: string;
|
|
1459
|
+
hf_model_revision?: string | null;
|
|
1460
|
+
base_model_revision: string;
|
|
1461
|
+
immutable_base_model_source: string;
|
|
1462
|
+
supports_tool_calls: boolean;
|
|
1463
|
+
tool_call_parser?: InferenceToolCallParser | null;
|
|
1464
|
+
reasoning_parser?: InferenceReasoningParser | null;
|
|
1465
|
+
tool_call_mode?: InferenceToolCallMode;
|
|
1466
|
+
tool_calls_unsupported_reason?: string;
|
|
1467
|
+
tool_calls_note?: string;
|
|
1468
|
+
gpu: string;
|
|
1469
|
+
gpu_provider: string;
|
|
1470
|
+
gpu_region: string;
|
|
1471
|
+
gpu_tier: 'secure';
|
|
1472
|
+
estimated_hourly_cents: number;
|
|
1473
|
+
max_price_hour_cents: number;
|
|
1474
|
+
/** Runtime-supported ranked choices whose frozen price is within the accepted cap. */
|
|
1475
|
+
eligible_gpu_choice_count: number;
|
|
1476
|
+
authorized_cents: number;
|
|
1477
|
+
gpu_priorities: Array<{
|
|
1478
|
+
gpu_type: string;
|
|
1479
|
+
gpu_count: number;
|
|
1480
|
+
provider?: string;
|
|
1481
|
+
region?: string;
|
|
1482
|
+
tier?: 'secure';
|
|
1483
|
+
}>;
|
|
1484
|
+
}
|
|
1485
|
+
export type InferenceListStatusFilter = 'all' | 'running' | 'provisioning' | 'stopped' | 'failed' | 'queued_capacity' | 'degraded' | 'paused_insufficient_funds' | 'crash_loop' | 'downloading_weights' | 'loading_model';
|
|
1486
|
+
export interface InferenceListParams {
|
|
1487
|
+
/** Bounded page size. The server defaults to 50 and caps at 200. */
|
|
1488
|
+
limit?: number;
|
|
1489
|
+
/** Opaque nextCursor returned by the preceding page. */
|
|
1490
|
+
cursor?: string;
|
|
1491
|
+
status?: InferenceListStatusFilter;
|
|
1492
|
+
/** Case-insensitive deployment-name prefix, maximum 120 characters. */
|
|
1493
|
+
search?: string;
|
|
1494
|
+
}
|
|
1495
|
+
/** One bounded keyset page of {@link InferenceDeploymentSummary} rows. */
|
|
1496
|
+
export interface InferenceListResponse {
|
|
1497
|
+
deployments: InferenceDeploymentSummary[];
|
|
1498
|
+
has_more: boolean;
|
|
1499
|
+
next_cursor?: string | null;
|
|
1500
|
+
limit: number;
|
|
1501
|
+
}
|
|
1502
|
+
export interface InferenceQueueChoice {
|
|
1503
|
+
choice_id?: string;
|
|
1504
|
+
rank: number;
|
|
1505
|
+
gpu_type: string;
|
|
1506
|
+
gpu_count: number;
|
|
1507
|
+
provider?: string;
|
|
1508
|
+
region?: string;
|
|
1509
|
+
tier?: 'secure';
|
|
1510
|
+
price_per_gpu_hour_cents?: number;
|
|
1511
|
+
total_price_hour_cents?: number;
|
|
1512
|
+
eligible: boolean;
|
|
1513
|
+
selected: boolean;
|
|
1514
|
+
}
|
|
1515
|
+
export interface InferenceQueue {
|
|
1516
|
+
request_id?: string | null;
|
|
1517
|
+
state?: string | null;
|
|
1518
|
+
position?: number | null;
|
|
1519
|
+
position_scope?: 'shared_capacity_fair_queue' | 'shared_capacity_position_unavailable';
|
|
1520
|
+
position_estimated?: boolean;
|
|
1521
|
+
position_as_of?: string | null;
|
|
1522
|
+
position_lower_bound?: number | null;
|
|
1523
|
+
position_truncated?: boolean;
|
|
1524
|
+
position_unavailable_reason?: string;
|
|
1525
|
+
priority?: number;
|
|
1526
|
+
enqueue_sequence?: number | null;
|
|
1527
|
+
deadline_at?: string | null;
|
|
1528
|
+
max_price_hour_cents?: number;
|
|
1529
|
+
eligible_gpu_choice_count?: number;
|
|
1530
|
+
all_choices?: InferenceQueueChoice[];
|
|
1531
|
+
selected_choice?: InferenceQueueChoice | null;
|
|
1532
|
+
allocation_claimed_until?: string | null;
|
|
1533
|
+
reservation_expires_at?: string | null;
|
|
1534
|
+
provision_retry_at?: string | null;
|
|
1535
|
+
last_error?: string | null;
|
|
1536
|
+
}
|
|
1537
|
+
export interface InferenceLifecycleResponse {
|
|
1538
|
+
status: string;
|
|
1539
|
+
action: 'stop' | 'resume' | 'restart';
|
|
1540
|
+
in_place?: boolean;
|
|
1541
|
+
restart_generation?: number;
|
|
1542
|
+
}
|
|
1543
|
+
export interface InferenceDeleteResponse {
|
|
1544
|
+
status: 'deleted' | 'deleting';
|
|
1545
|
+
detail?: string;
|
|
1546
|
+
}
|
|
1547
|
+
export interface InferenceUpdateResponse {
|
|
1548
|
+
status: 'updated' | string;
|
|
1549
|
+
restart_required: boolean;
|
|
1550
|
+
}
|
|
1551
|
+
export interface InferenceGPUOptionMarket {
|
|
1552
|
+
availability_status: 'available' | 'out_of_stock' | 'unknown';
|
|
1553
|
+
/** Null/omitted when live stock could not be verified. */
|
|
1554
|
+
available_count?: number | null;
|
|
1555
|
+
price_per_gpu_hour_cents: number;
|
|
1556
|
+
minimum_configuration_hour_cents: number;
|
|
1557
|
+
recommended_configuration_hour_cents: number;
|
|
1558
|
+
}
|
|
1559
|
+
export interface InferenceGPUOption {
|
|
1560
|
+
gpu_type: string;
|
|
1561
|
+
vram_gb: number;
|
|
1562
|
+
min_gpus: number;
|
|
1563
|
+
recommended_gpus: number;
|
|
1564
|
+
valid_counts?: number[];
|
|
1565
|
+
/**
|
|
1566
|
+
* valid_counts filtered to counts live stock can fill RIGHT NOW in a single
|
|
1567
|
+
* placement (book-first contract). Absent when availability is unknown — never
|
|
1568
|
+
* fabricated. Offer/submit only these when present.
|
|
1569
|
+
*/
|
|
1570
|
+
bookable_counts?: number[];
|
|
1571
|
+
selectable: boolean;
|
|
1572
|
+
reason?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* Machine discriminator for an unselectable option: `gpu_unsupported` when
|
|
1575
|
+
* the serving engine cannot run this card at all (size and count are both
|
|
1576
|
+
* irrelevant), otherwise the memory verdict (`model_too_large`).
|
|
1577
|
+
*/
|
|
1578
|
+
reason_code?: string;
|
|
1579
|
+
market?: InferenceGPUOptionMarket;
|
|
1580
|
+
}
|
|
1581
|
+
export interface InferenceGPUPlacementOption extends InferenceGPUOption {
|
|
1582
|
+
provider: string;
|
|
1583
|
+
region: string;
|
|
1584
|
+
tier: 'secure';
|
|
1585
|
+
market: InferenceGPUOptionMarket;
|
|
1586
|
+
}
|
|
1587
|
+
export interface InferenceGPUAlternative {
|
|
1588
|
+
gpu_type: string;
|
|
1589
|
+
gpu_count: number;
|
|
1590
|
+
vram_gb: number;
|
|
1591
|
+
price_hour_cents: number;
|
|
1592
|
+
availability_status: 'available' | 'out_of_stock' | 'unknown';
|
|
1593
|
+
}
|
|
1594
|
+
export interface InferenceGPUOptionsParams {
|
|
1595
|
+
/**
|
|
1596
|
+
* MODEL-ADDRESSED sizing (recommended): the SERVER resolves the model facts
|
|
1597
|
+
* from this model id (optionally with `revision`) and computes
|
|
1598
|
+
* min_gpus/valid_counts/bookable_counts — the same single implementation the
|
|
1599
|
+
* create gate enforces. When set, the deprecated client-fact params below
|
|
1600
|
+
* are unnecessary.
|
|
1601
|
+
*/
|
|
1602
|
+
model?: string;
|
|
1603
|
+
revision?: string;
|
|
1604
|
+
/** Size from an existing deployment's pinned facts instead of a model id. */
|
|
1605
|
+
inferenceId?: string;
|
|
1606
|
+
/**
|
|
1607
|
+
* @deprecated Legacy field kept for wire compatibility — catalog models are
|
|
1608
|
+
* pre-mirrored and never gated, so no integration is needed with `model`.
|
|
1609
|
+
*/
|
|
1610
|
+
hfIntegrationId?: string;
|
|
1611
|
+
/** DEPRECATED client-fact path; required only when `model`/`inferenceId` are absent. */
|
|
1612
|
+
paramsB?: number;
|
|
1613
|
+
activeParamsB?: number;
|
|
1614
|
+
isMoe?: boolean;
|
|
1615
|
+
quant?: string;
|
|
1616
|
+
/**
|
|
1617
|
+
* SIZING INPUT, not a validated field: this endpoint sizes whatever window
|
|
1618
|
+
* you pass and never checks it against the model's native max. Omit it to
|
|
1619
|
+
* size the window a deployment would actually get (`min(nativeMax, 262144)`,
|
|
1620
|
+
* falling back to the 32,768 floor when the native window is unknown).
|
|
1621
|
+
* Passing a value ABOVE the native max returns honest sizing for an
|
|
1622
|
+
* IMPOSSIBLE window -- a larger `min_gpus` for a deployment the create gate
|
|
1623
|
+
* will reject with 400 `context_length N exceeds the model's maximum of M`.
|
|
1624
|
+
* Read the ceiling from `client.models.nativeMaxContext(modelId)` before
|
|
1625
|
+
* trusting a `min_gpus` computed at a custom window.
|
|
1626
|
+
*/
|
|
1627
|
+
contextLength?: number;
|
|
1628
|
+
kvHeads?: number;
|
|
1629
|
+
numLayers?: number;
|
|
1630
|
+
kvLayers?: number;
|
|
1631
|
+
headDim?: number;
|
|
1632
|
+
attention?: 'gqa' | 'mla';
|
|
1633
|
+
numAttentionHeads?: number;
|
|
1634
|
+
kvLoraRank?: number;
|
|
1635
|
+
qkRopeHeadDim?: number;
|
|
1636
|
+
gpuTier?: 'secure';
|
|
1637
|
+
}
|
|
1638
|
+
export interface InferenceGPUOptionsResponse {
|
|
1639
|
+
options: InferenceGPUOption[];
|
|
1640
|
+
/** Exact provider/region/tier markets; clients must select from this list. */
|
|
1641
|
+
placements: InferenceGPUPlacementOption[];
|
|
1642
|
+
cheapest_recommended?: InferenceGPUOption | null;
|
|
1643
|
+
best_available?: InferenceGPUAlternative | null;
|
|
1644
|
+
alternatives?: InferenceGPUAlternative[];
|
|
1645
|
+
availability_known: boolean;
|
|
1646
|
+
availability_checked_at?: string;
|
|
1647
|
+
}
|
|
1648
|
+
export interface InferencePreflightWarning {
|
|
1649
|
+
code: string;
|
|
1650
|
+
message: string;
|
|
1651
|
+
}
|
|
1652
|
+
export interface InferenceCanonicalRequest {
|
|
1653
|
+
name: string;
|
|
1654
|
+
/** 'hf_model' is the legacy wire name for a Run BiOS-catalog base model. */
|
|
1655
|
+
source_type: 'checkpoint' | 'hf_model';
|
|
1656
|
+
source_job_id?: string;
|
|
1657
|
+
source_checkpoint_id?: string;
|
|
1658
|
+
/** Catalog model id. Legacy field name — hosted on Run BiOS, not live Hugging Face. */
|
|
1659
|
+
hf_model_id?: string;
|
|
1660
|
+
hf_model_revision?: string;
|
|
1661
|
+
/** Legacy field — catalog models never need an integration. */
|
|
1662
|
+
hf_integration_id?: string;
|
|
1663
|
+
base_model_id: string;
|
|
1664
|
+
base_model_revision: string;
|
|
1665
|
+
serving_mode?: 'full' | 'adapter' | 'merged';
|
|
1666
|
+
model_task?: 'chat' | 'completion' | 'embedding' | 'rerank';
|
|
1667
|
+
supports_images?: boolean;
|
|
1668
|
+
gpu_type: string;
|
|
1669
|
+
gpu_count: number;
|
|
1670
|
+
gpu_priorities?: Array<{
|
|
1671
|
+
gpu_type: string;
|
|
1672
|
+
gpu_count: number;
|
|
1673
|
+
provider?: string;
|
|
1674
|
+
region?: string;
|
|
1675
|
+
tier?: 'secure';
|
|
1676
|
+
}>;
|
|
1677
|
+
allow_capacity_queue: boolean;
|
|
1678
|
+
max_price_hour_cents: number;
|
|
1679
|
+
[key: string]: unknown;
|
|
1680
|
+
}
|
|
1681
|
+
export interface InferencePreflightResponse {
|
|
1682
|
+
valid: boolean;
|
|
1683
|
+
contract_version: 'deployment.v3' | string;
|
|
1684
|
+
request_hash: string;
|
|
1685
|
+
workspace_id: string;
|
|
1686
|
+
canonical_request: InferenceCanonicalRequest;
|
|
1687
|
+
model: {
|
|
1688
|
+
repo_id: string;
|
|
1689
|
+
revision: string;
|
|
1690
|
+
immutable_source: string;
|
|
1691
|
+
architecture: string;
|
|
1692
|
+
model_type: string;
|
|
1693
|
+
params_total_b: number;
|
|
1694
|
+
params_active_b: number;
|
|
1695
|
+
is_moe: boolean;
|
|
1696
|
+
native_max_context: number;
|
|
1697
|
+
quant_locked: boolean;
|
|
1698
|
+
supports_tool_calls: boolean;
|
|
1699
|
+
tool_call_parser?: InferenceToolCallParser | null;
|
|
1700
|
+
reasoning_parser?: InferenceReasoningParser | null;
|
|
1701
|
+
tool_call_mode?: InferenceToolCallMode;
|
|
1702
|
+
tool_calls_unsupported_reason?: string;
|
|
1703
|
+
tool_calls_note?: string;
|
|
1704
|
+
};
|
|
1705
|
+
selected_gpu: {
|
|
1706
|
+
gpu_type: string;
|
|
1707
|
+
gpu_count: number;
|
|
1708
|
+
provider: string;
|
|
1709
|
+
region: string;
|
|
1710
|
+
tier: 'secure';
|
|
1711
|
+
availability_status: 'available' | 'out_of_stock' | 'unknown';
|
|
1712
|
+
available_count: number;
|
|
1713
|
+
price_per_gpu_hour_cents: number;
|
|
1714
|
+
total_price_hour_cents: number;
|
|
1715
|
+
};
|
|
1716
|
+
gpu_options: InferenceGPUOption[];
|
|
1717
|
+
gpu_placements: InferenceGPUPlacementOption[];
|
|
1718
|
+
alternatives: InferenceGPUAlternative[];
|
|
1719
|
+
best_available?: InferenceGPUAlternative | null;
|
|
1720
|
+
availability_known: boolean;
|
|
1721
|
+
availability_checked_at: string;
|
|
1722
|
+
eligible_gpu_choice_count: number;
|
|
1723
|
+
supports_tool_calls: boolean;
|
|
1724
|
+
tool_call_parser?: InferenceToolCallParser | null;
|
|
1725
|
+
reasoning_parser?: InferenceReasoningParser | null;
|
|
1726
|
+
tool_call_mode?: InferenceToolCallMode;
|
|
1727
|
+
tool_calls_unsupported_reason?: string;
|
|
1728
|
+
tool_calls_note?: string;
|
|
1729
|
+
queue_eligible: boolean;
|
|
1730
|
+
queue_required: boolean;
|
|
1731
|
+
billing: {
|
|
1732
|
+
max_price_hour_cents: number;
|
|
1733
|
+
authorization_amount_cents: number;
|
|
1734
|
+
capture_amount_cents: number;
|
|
1735
|
+
authorization_ttl_seconds: number;
|
|
1736
|
+
authorization_mutates_balance: false;
|
|
1737
|
+
};
|
|
1738
|
+
warnings: InferencePreflightWarning[];
|
|
1739
|
+
}
|
|
1740
|
+
/** Adapter compatibility info. */
|
|
1741
|
+
export interface AdapterCompatibility {
|
|
1742
|
+
id: string;
|
|
1743
|
+
name: string;
|
|
1744
|
+
fullName: string;
|
|
1745
|
+
category: 'popular' | 'advanced' | 'specialized';
|
|
1746
|
+
description: string;
|
|
1747
|
+
compatible: boolean;
|
|
1748
|
+
reason: string | null;
|
|
1749
|
+
defaultConfig: Record<string, unknown>;
|
|
1750
|
+
rlhfAlgorithms: string[];
|
|
1751
|
+
}
|
|
1752
|
+
/** Response from the adapter compatibility endpoint. */
|
|
1753
|
+
export interface AdapterCompatibilityResponse {
|
|
1754
|
+
architecture: string;
|
|
1755
|
+
architectureName: string;
|
|
1756
|
+
type: 'llm' | 'vlm';
|
|
1757
|
+
trainingMethod: string;
|
|
1758
|
+
rlhfAlgorithm: string | null;
|
|
1759
|
+
unsupported: string | null;
|
|
1760
|
+
gated: boolean;
|
|
1761
|
+
adapters: AdapterCompatibility[];
|
|
1762
|
+
compatibleCount: number;
|
|
1763
|
+
incompatibleCount: number;
|
|
1764
|
+
}
|
|
1765
|
+
/** One entry in the supported-architecture registry. */
|
|
1766
|
+
export interface SupportedArchitecture {
|
|
1767
|
+
/** For inference: the architecture class (e.g. "LlamaForCausalLM"). For training: the arch key (e.g. "llama"). */
|
|
1768
|
+
architecture: string;
|
|
1769
|
+
display_name: string;
|
|
1770
|
+
/** Comma-separated model_type aliases this entry covers. */
|
|
1771
|
+
model_types: string;
|
|
1772
|
+
enabled: boolean;
|
|
1773
|
+
notes: string;
|
|
1774
|
+
}
|
|
1775
|
+
/** Which registry to read. */
|
|
1776
|
+
export type ArchitectureScope = 'inference' | 'training';
|
|
1777
|
+
/** Response from getSupportedArchitectures. When `count` is 0 the registry is empty (nothing is explicitly gated). */
|
|
1778
|
+
export interface SupportedArchitecturesResponse {
|
|
1779
|
+
scope: ArchitectureScope;
|
|
1780
|
+
architectures: SupportedArchitecture[];
|
|
1781
|
+
count: number;
|
|
1782
|
+
}
|
|
1783
|
+
/** Parameters for checking adapter compatibility. */
|
|
1784
|
+
export interface AdapterCompatibilityParams {
|
|
1785
|
+
/** Architecture key (e.g. "llama", "qwen2"). */
|
|
1786
|
+
architecture?: string;
|
|
1787
|
+
/** The model's model_type for automatic architecture detection. */
|
|
1788
|
+
modelType?: string;
|
|
1789
|
+
/** Training method. Defaults to "sft". */
|
|
1790
|
+
trainingMethod?: TrainingMethod;
|
|
1791
|
+
/** RLHF algorithm (relevant when trainingMethod is "rlhf"). */
|
|
1792
|
+
rlhfAlgorithm?: RLHFAlgorithm;
|
|
1793
|
+
}
|
|
1794
|
+
/** An API key. */
|
|
1795
|
+
export interface ApiKey {
|
|
1796
|
+
id: string;
|
|
1797
|
+
name: string;
|
|
1798
|
+
prefix: string;
|
|
1799
|
+
/** The full key value — only present on creation. */
|
|
1800
|
+
key?: string;
|
|
1801
|
+
scopes: ApiKeyScope[];
|
|
1802
|
+
scope_preset: string;
|
|
1803
|
+
created_at: string;
|
|
1804
|
+
last_used_at?: string | null;
|
|
1805
|
+
expires_at?: string | null;
|
|
1806
|
+
status: 'active' | 'revoked' | 'expired';
|
|
1807
|
+
}
|
|
1808
|
+
/** Valid API key permission scope. */
|
|
1809
|
+
export type ApiKeyScope = 'models:read' | 'datasets:read' | 'datasets:write' | 'training:read' | 'training:write' | 'billing:read' | 'deployments:read' | 'deployments:write' | 'analytics:read' | 'integrations:read' | 'integrations:write' | 'serverless';
|
|
1810
|
+
/** Result of introspecting an API key — shows what it can do. */
|
|
1811
|
+
export interface ApiKeyIntrospection {
|
|
1812
|
+
auth_type: 'api_key' | 'jwt';
|
|
1813
|
+
key_id: string | null;
|
|
1814
|
+
key_name: string | null;
|
|
1815
|
+
key_prefix: string | null;
|
|
1816
|
+
status: string;
|
|
1817
|
+
org: {
|
|
1818
|
+
id: string;
|
|
1819
|
+
name: string;
|
|
1820
|
+
};
|
|
1821
|
+
workspace: {
|
|
1822
|
+
id: string;
|
|
1823
|
+
name: string;
|
|
1824
|
+
};
|
|
1825
|
+
user: {
|
|
1826
|
+
id: string;
|
|
1827
|
+
name: string;
|
|
1828
|
+
email: string;
|
|
1829
|
+
role: string;
|
|
1830
|
+
};
|
|
1831
|
+
scopes: ApiKeyScope[];
|
|
1832
|
+
scope_preset: string;
|
|
1833
|
+
scope_details: Array<{
|
|
1834
|
+
scope: ApiKeyScope;
|
|
1835
|
+
description: string;
|
|
1836
|
+
tools: string[];
|
|
1837
|
+
sdk_methods: string[];
|
|
1838
|
+
}>;
|
|
1839
|
+
allowed_mcp_tools: string[];
|
|
1840
|
+
allowed_sdk_methods: string[];
|
|
1841
|
+
rate_limit: {
|
|
1842
|
+
requests_per_minute: number;
|
|
1843
|
+
requests_per_hour: number;
|
|
1844
|
+
};
|
|
1845
|
+
expires_at: string | null;
|
|
1846
|
+
created_at: string;
|
|
1847
|
+
last_used_at: string | null;
|
|
1848
|
+
}
|
|
1849
|
+
/** An organization. */
|
|
1850
|
+
export interface Organization {
|
|
1851
|
+
id: string;
|
|
1852
|
+
name: string;
|
|
1853
|
+
avatar_url?: string;
|
|
1854
|
+
created_at?: string;
|
|
1855
|
+
}
|
|
1856
|
+
/** An organization member. */
|
|
1857
|
+
export interface OrgMember {
|
|
1858
|
+
user_id: string;
|
|
1859
|
+
name: string;
|
|
1860
|
+
email: string;
|
|
1861
|
+
role: string;
|
|
1862
|
+
avatar_url?: string;
|
|
1863
|
+
joined_at?: string;
|
|
1864
|
+
}
|
|
1865
|
+
/** An organization invite. */
|
|
1866
|
+
export interface OrgInvite {
|
|
1867
|
+
id: string;
|
|
1868
|
+
email: string;
|
|
1869
|
+
role: string;
|
|
1870
|
+
status: string;
|
|
1871
|
+
created_at: string;
|
|
1872
|
+
expires_at?: string;
|
|
1873
|
+
}
|
|
1874
|
+
/** A workspace within an organization. */
|
|
1875
|
+
export interface Workspace {
|
|
1876
|
+
id: string;
|
|
1877
|
+
name: string;
|
|
1878
|
+
description?: string;
|
|
1879
|
+
org_id: string;
|
|
1880
|
+
created_at?: string;
|
|
1881
|
+
updated_at?: string;
|
|
1882
|
+
}
|
|
1883
|
+
/** A HuggingFace integration connection. */
|
|
1884
|
+
export interface Integration {
|
|
1885
|
+
id: string;
|
|
1886
|
+
provider: string;
|
|
1887
|
+
label: string;
|
|
1888
|
+
hf_username: string;
|
|
1889
|
+
key_last4: string;
|
|
1890
|
+
scope: string;
|
|
1891
|
+
status: string;
|
|
1892
|
+
created_at?: string;
|
|
1893
|
+
}
|
|
1894
|
+
/** Parameters for creating an integration. */
|
|
1895
|
+
export interface IntegrationCreateParams {
|
|
1896
|
+
/** Display label for this integration. */
|
|
1897
|
+
label: string;
|
|
1898
|
+
/** HuggingFace API key. */
|
|
1899
|
+
apiKey: string;
|
|
1900
|
+
/** Provider name. Defaults to "huggingface". */
|
|
1901
|
+
provider?: string;
|
|
1902
|
+
}
|
|
1903
|
+
/** Storage usage info. */
|
|
1904
|
+
export interface StorageUsage {
|
|
1905
|
+
total_bytes: number;
|
|
1906
|
+
object_count: number;
|
|
1907
|
+
by_type?: Record<string, number>;
|
|
1908
|
+
}
|
|
1909
|
+
/** A storage object. */
|
|
1910
|
+
export interface StorageObject {
|
|
1911
|
+
id: string;
|
|
1912
|
+
type: string;
|
|
1913
|
+
name: string;
|
|
1914
|
+
size_bytes: number;
|
|
1915
|
+
created_at: string;
|
|
1916
|
+
}
|