@abliteration/sdk 0.1.7 → 0.1.8

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.
Files changed (38) hide show
  1. package/.openapi-generator/FILES +8 -0
  2. package/README.md +6 -0
  3. package/dist/apis/ModelsApi.d.ts +122 -0
  4. package/dist/apis/ModelsApi.js +120 -1
  5. package/dist/esm/apis/ModelsApi.d.ts +122 -0
  6. package/dist/esm/apis/ModelsApi.js +119 -0
  7. package/dist/esm/models/DownloadAnomaly.d.ts +66 -0
  8. package/dist/esm/models/DownloadAnomaly.js +62 -0
  9. package/dist/esm/models/DownloadPoint.d.ts +34 -0
  10. package/dist/esm/models/DownloadPoint.js +43 -0
  11. package/dist/esm/models/GetModelDownloadHistory200Response.d.ts +67 -0
  12. package/dist/esm/models/GetModelDownloadHistory200Response.js +79 -0
  13. package/dist/esm/models/ListAnomalies200Response.d.ts +67 -0
  14. package/dist/esm/models/ListAnomalies200Response.js +79 -0
  15. package/dist/esm/models/index.d.ts +4 -0
  16. package/dist/esm/models/index.js +4 -0
  17. package/dist/models/DownloadAnomaly.d.ts +66 -0
  18. package/dist/models/DownloadAnomaly.js +70 -0
  19. package/dist/models/DownloadPoint.d.ts +34 -0
  20. package/dist/models/DownloadPoint.js +50 -0
  21. package/dist/models/GetModelDownloadHistory200Response.d.ts +67 -0
  22. package/dist/models/GetModelDownloadHistory200Response.js +87 -0
  23. package/dist/models/ListAnomalies200Response.d.ts +67 -0
  24. package/dist/models/ListAnomalies200Response.js +87 -0
  25. package/dist/models/index.d.ts +4 -0
  26. package/dist/models/index.js +4 -0
  27. package/docs/DownloadAnomaly.md +49 -0
  28. package/docs/DownloadPoint.md +37 -0
  29. package/docs/GetModelDownloadHistory200Response.md +48 -0
  30. package/docs/ListAnomalies200Response.md +48 -0
  31. package/docs/ModelsApi.md +167 -0
  32. package/package.json +1 -1
  33. package/src/apis/ModelsApi.ts +236 -0
  34. package/src/models/DownloadAnomaly.ts +116 -0
  35. package/src/models/DownloadPoint.ts +69 -0
  36. package/src/models/GetModelDownloadHistory200Response.ts +132 -0
  37. package/src/models/ListAnomalies200Response.ts +132 -0
  38. package/src/models/index.ts +4 -0
@@ -0,0 +1,37 @@
1
+
2
+ # DownloadPoint
3
+
4
+ One snapshot in a per-model download timeline.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `date` | string
11
+ `downloads` | number
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { DownloadPoint } from '@abliteration/sdk'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "date": null,
21
+ "downloads": null,
22
+ } satisfies DownloadPoint
23
+
24
+ console.log(example)
25
+
26
+ // Convert the instance to a JSON string
27
+ const exampleJSON: string = JSON.stringify(example)
28
+ console.log(exampleJSON)
29
+
30
+ // Parse the JSON string back to an object
31
+ const exampleParsed = JSON.parse(exampleJSON) as DownloadPoint
32
+ console.log(exampleParsed)
33
+ ```
34
+
35
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
36
+
37
+
@@ -0,0 +1,48 @@
1
+
2
+ # GetModelDownloadHistory200Response
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `data` | [Array<DownloadPoint>](DownloadPoint.md)
10
+ `cost` | number
11
+ `credits_remaining` | number
12
+ `rate_limit_limit` | number
13
+ `rate_limit_remaining` | number
14
+ `rate_limit_reset` | number
15
+ `metering` | string
16
+ `request_id` | string
17
+
18
+ ## Example
19
+
20
+ ```typescript
21
+ import type { GetModelDownloadHistory200Response } from '@abliteration/sdk'
22
+
23
+ // TODO: Update the object below with actual values
24
+ const example = {
25
+ "data": null,
26
+ "cost": null,
27
+ "credits_remaining": null,
28
+ "rate_limit_limit": null,
29
+ "rate_limit_remaining": null,
30
+ "rate_limit_reset": null,
31
+ "metering": null,
32
+ "request_id": null,
33
+ } satisfies GetModelDownloadHistory200Response
34
+
35
+ console.log(example)
36
+
37
+ // Convert the instance to a JSON string
38
+ const exampleJSON: string = JSON.stringify(example)
39
+ console.log(exampleJSON)
40
+
41
+ // Parse the JSON string back to an object
42
+ const exampleParsed = JSON.parse(exampleJSON) as GetModelDownloadHistory200Response
43
+ console.log(exampleParsed)
44
+ ```
45
+
46
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
47
+
48
+
@@ -0,0 +1,48 @@
1
+
2
+ # ListAnomalies200Response
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `data` | [Array<DownloadAnomaly>](DownloadAnomaly.md)
10
+ `cost` | number
11
+ `credits_remaining` | number
12
+ `rate_limit_limit` | number
13
+ `rate_limit_remaining` | number
14
+ `rate_limit_reset` | number
15
+ `metering` | string
16
+ `request_id` | string
17
+
18
+ ## Example
19
+
20
+ ```typescript
21
+ import type { ListAnomalies200Response } from '@abliteration/sdk'
22
+
23
+ // TODO: Update the object below with actual values
24
+ const example = {
25
+ "data": null,
26
+ "cost": null,
27
+ "credits_remaining": null,
28
+ "rate_limit_limit": null,
29
+ "rate_limit_remaining": null,
30
+ "rate_limit_reset": null,
31
+ "metering": null,
32
+ "request_id": null,
33
+ } satisfies ListAnomalies200Response
34
+
35
+ console.log(example)
36
+
37
+ // Convert the instance to a JSON string
38
+ const exampleJSON: string = JSON.stringify(example)
39
+ console.log(exampleJSON)
40
+
41
+ // Parse the JSON string back to an object
42
+ const exampleParsed = JSON.parse(exampleJSON) as ListAnomalies200Response
43
+ console.log(exampleParsed)
44
+ ```
45
+
46
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
47
+
48
+
package/docs/ModelsApi.md CHANGED
@@ -6,7 +6,9 @@ All URIs are relative to *https://abliteration.org*
6
6
  |------------- | ------------- | -------------|
7
7
  | [**getHistoricalDeletionSummary**](ModelsApi.md#gethistoricaldeletionsummary) | **GET** /api/v1/models/historical-deletions/summary | Historical deletions — aggregate summary |
8
8
  | [**getModel**](ModelsApi.md#getmodel) | **GET** /api/v1/models/{id} | Get one model |
9
+ | [**getModelDownloadHistory**](ModelsApi.md#getmodeldownloadhistory) | **GET** /api/v1/models/{id}/download-history | Per-model download timeline |
9
10
  | [**getModelReadmeAt**](ModelsApi.md#getmodelreadmeat) | **GET** /api/v1/models/{id}/readme-at/{commit} | README content at one commit (wayback) |
11
+ | [**listAnomalies**](ModelsApi.md#listanomalies) | **GET** /api/v1/market/anomalies | Anomalies in the download counter (change stream) |
10
12
  | [**listDelistedModels**](ModelsApi.md#listdelistedmodels) | **GET** /api/v1/models/delisted | List delisted models (change stream) |
11
13
  | [**listHistoricalDeletions**](ModelsApi.md#listhistoricaldeletions) | **GET** /api/v1/models/historical-deletions/list | Historical deletions — paged list |
12
14
  | [**listModelReadmeDrifts**](ModelsApi.md#listmodelreadmedrifts) | **GET** /api/v1/models/{id}/drifts | README drift stream for one model |
@@ -157,6 +159,84 @@ example().catch(console.error);
157
159
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
158
160
 
159
161
 
162
+ ## getModelDownloadHistory
163
+
164
+ > GetModelDownloadHistory200Response getModelDownloadHistory(id, days)
165
+
166
+ Per-model download timeline
167
+
168
+ Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
169
+
170
+ ### Example
171
+
172
+ ```ts
173
+ import {
174
+ Configuration,
175
+ ModelsApi,
176
+ } from '@abliteration/sdk';
177
+ import type { GetModelDownloadHistoryRequest } from '@abliteration/sdk';
178
+
179
+ async function example() {
180
+ console.log("🚀 Testing @abliteration/sdk SDK...");
181
+ const config = new Configuration({
182
+ // Configure HTTP bearer authorization: bearerAuth
183
+ accessToken: "YOUR BEARER TOKEN",
184
+ });
185
+ const api = new ModelsApi(config);
186
+
187
+ const body = {
188
+ // string
189
+ id: id_example,
190
+ // number | Window in days (max 365). Pass 0 for full history. (optional)
191
+ days: 56,
192
+ } satisfies GetModelDownloadHistoryRequest;
193
+
194
+ try {
195
+ const data = await api.getModelDownloadHistory(body);
196
+ console.log(data);
197
+ } catch (error) {
198
+ console.error(error);
199
+ }
200
+ }
201
+
202
+ // Run the test
203
+ example().catch(console.error);
204
+ ```
205
+
206
+ ### Parameters
207
+
208
+
209
+ | Name | Type | Description | Notes |
210
+ |------------- | ------------- | ------------- | -------------|
211
+ | **id** | `string` | | [Defaults to `undefined`] |
212
+ | **days** | `number` | Window in days (max 365). Pass 0 for full history. | [Optional] [Defaults to `90`] |
213
+
214
+ ### Return type
215
+
216
+ [**GetModelDownloadHistory200Response**](GetModelDownloadHistory200Response.md)
217
+
218
+ ### Authorization
219
+
220
+ [bearerAuth](../README.md#bearerAuth)
221
+
222
+ ### HTTP request headers
223
+
224
+ - **Content-Type**: Not defined
225
+ - **Accept**: `application/json`
226
+
227
+
228
+ ### HTTP response details
229
+ | Status code | Description | Response headers |
230
+ |-------------|-------------|------------------|
231
+ | **200** | Timeline. | - |
232
+ | **401** | Missing, unknown or revoked key. | - |
233
+ | **402** | Not enough credits. Only possible while metering is enabled. | - |
234
+ | **429** | Per-key rate limit exceeded. Retry-After header is set. | - |
235
+ | **503** | Catalog temporarily unreadable. Nothing was charged. | - |
236
+
237
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
238
+
239
+
160
240
  ## getModelReadmeAt
161
241
 
162
242
  > GetModelReadmeAt200Response getModelReadmeAt(id, commit)
@@ -236,6 +316,93 @@ example().catch(console.error);
236
316
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
237
317
 
238
318
 
319
+ ## listAnomalies
320
+
321
+ > ListAnomalies200Response listAnomalies(windowDays, minBaseline, kind, limit, offset)
322
+
323
+ Anomalies in the download counter (change stream)
324
+
325
+ Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
326
+
327
+ ### Example
328
+
329
+ ```ts
330
+ import {
331
+ Configuration,
332
+ ModelsApi,
333
+ } from '@abliteration/sdk';
334
+ import type { ListAnomaliesRequest } from '@abliteration/sdk';
335
+
336
+ async function example() {
337
+ console.log("🚀 Testing @abliteration/sdk SDK...");
338
+ const config = new Configuration({
339
+ // Configure HTTP bearer authorization: bearerAuth
340
+ accessToken: "YOUR BEARER TOKEN",
341
+ });
342
+ const api = new ModelsApi(config);
343
+
344
+ const body = {
345
+ // number | Baseline distance in days. Default 7, min 1, max 365. (optional)
346
+ windowDays: 56,
347
+ // number | Only rows where baseline downloads >= this. Filters `0→10` noise. Default 1000. (optional)
348
+ minBaseline: 56,
349
+ // 'spike' | 'drop' | Filter to one class. Omit for both. (optional)
350
+ kind: kind_example,
351
+ // number | Rows to return, 1 to 1000. Values outside the range are clamped, not rejected. (optional)
352
+ limit: 56,
353
+ // number | Rows to skip. Negative and non-numeric values are treated as 0. (optional)
354
+ offset: 56,
355
+ } satisfies ListAnomaliesRequest;
356
+
357
+ try {
358
+ const data = await api.listAnomalies(body);
359
+ console.log(data);
360
+ } catch (error) {
361
+ console.error(error);
362
+ }
363
+ }
364
+
365
+ // Run the test
366
+ example().catch(console.error);
367
+ ```
368
+
369
+ ### Parameters
370
+
371
+
372
+ | Name | Type | Description | Notes |
373
+ |------------- | ------------- | ------------- | -------------|
374
+ | **windowDays** | `number` | Baseline distance in days. Default 7, min 1, max 365. | [Optional] [Defaults to `7`] |
375
+ | **minBaseline** | `number` | Only rows where baseline downloads >= this. Filters `0→10` noise. Default 1000. | [Optional] [Defaults to `1000`] |
376
+ | **kind** | `spike`, `drop` | Filter to one class. Omit for both. | [Optional] [Defaults to `undefined`] [Enum: spike, drop] |
377
+ | **limit** | `number` | Rows to return, 1 to 1000. Values outside the range are clamped, not rejected. | [Optional] [Defaults to `50`] |
378
+ | **offset** | `number` | Rows to skip. Negative and non-numeric values are treated as 0. | [Optional] [Defaults to `0`] |
379
+
380
+ ### Return type
381
+
382
+ [**ListAnomalies200Response**](ListAnomalies200Response.md)
383
+
384
+ ### Authorization
385
+
386
+ [bearerAuth](../README.md#bearerAuth)
387
+
388
+ ### HTTP request headers
389
+
390
+ - **Content-Type**: Not defined
391
+ - **Accept**: `application/json`
392
+
393
+
394
+ ### HTTP response details
395
+ | Status code | Description | Response headers |
396
+ |-------------|-------------|------------------|
397
+ | **200** | Detected anomalies. | - |
398
+ | **401** | Missing, unknown or revoked key. | - |
399
+ | **402** | Not enough credits. Only possible while metering is enabled. | - |
400
+ | **429** | Per-key rate limit exceeded. Retry-After header is set. | - |
401
+ | **503** | Catalog temporarily unreadable. Nothing was charged. | - |
402
+
403
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
404
+
405
+
239
406
  ## listDelistedModels
240
407
 
241
408
  > ListDelistedModels200Response listDelistedModels(since, sort, limit, offset)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abliteration/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "OpenAPI client for @abliteration/sdk",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -23,11 +23,21 @@ import {
23
23
  GetModel200ResponseFromJSON,
24
24
  GetModel200ResponseToJSON,
25
25
  } from '../models/GetModel200Response';
26
+ import {
27
+ type GetModelDownloadHistory200Response,
28
+ GetModelDownloadHistory200ResponseFromJSON,
29
+ GetModelDownloadHistory200ResponseToJSON,
30
+ } from '../models/GetModelDownloadHistory200Response';
26
31
  import {
27
32
  type GetModelReadmeAt200Response,
28
33
  GetModelReadmeAt200ResponseFromJSON,
29
34
  GetModelReadmeAt200ResponseToJSON,
30
35
  } from '../models/GetModelReadmeAt200Response';
36
+ import {
37
+ type ListAnomalies200Response,
38
+ ListAnomalies200ResponseFromJSON,
39
+ ListAnomalies200ResponseToJSON,
40
+ } from '../models/ListAnomalies200Response';
31
41
  import {
32
42
  type ListDelistedModels200Response,
33
43
  ListDelistedModels200ResponseFromJSON,
@@ -56,6 +66,17 @@ export interface GetModelRequest {
56
66
  id: string;
57
67
  }
58
68
 
69
+ export interface GetModelDownloadHistoryRequest {
70
+ /**
71
+ *
72
+ */
73
+ id: string;
74
+ /**
75
+ * Window in days (max 365). Pass 0 for full history.
76
+ */
77
+ days?: number;
78
+ }
79
+
59
80
  export interface GetModelReadmeAtRequest {
60
81
  /**
61
82
  *
@@ -67,6 +88,29 @@ export interface GetModelReadmeAtRequest {
67
88
  commit: string;
68
89
  }
69
90
 
91
+ export interface ListAnomaliesRequest {
92
+ /**
93
+ * Baseline distance in days. Default 7, min 1, max 365.
94
+ */
95
+ windowDays?: number;
96
+ /**
97
+ * Only rows where baseline downloads >= this. Filters `0→10` noise. Default 1000.
98
+ */
99
+ minBaseline?: number;
100
+ /**
101
+ * Filter to one class. Omit for both.
102
+ */
103
+ kind?: ListAnomaliesKindEnum;
104
+ /**
105
+ * Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
106
+ */
107
+ limit?: number;
108
+ /**
109
+ * Rows to skip. Negative and non-numeric values are treated as 0.
110
+ */
111
+ offset?: number;
112
+ }
113
+
70
114
  export interface ListDelistedModelsRequest {
71
115
  /**
72
116
  * ISO-8601 date or timestamp. Rows with last_seen_at >= since only. Use your previous poll's newest last_seen_at to build an incremental feed.
@@ -232,6 +276,32 @@ export interface ModelsApiInterface {
232
276
  */
233
277
  getModel(requestParameters: GetModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModel200Response>;
234
278
 
279
+ /**
280
+ * Creates request options for getModelDownloadHistory without sending the request
281
+ * @param {string} id
282
+ * @param {number} [days] Window in days (max 365). Pass 0 for full history.
283
+ * @throws {RequiredError}
284
+ * @memberof ModelsApiInterface
285
+ */
286
+ getModelDownloadHistoryRequestOpts(requestParameters: GetModelDownloadHistoryRequest): Promise<runtime.RequestOpts>;
287
+
288
+ /**
289
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
290
+ * @summary Per-model download timeline
291
+ * @param {string} id
292
+ * @param {number} [days] Window in days (max 365). Pass 0 for full history.
293
+ * @param {*} [options] Override http request option.
294
+ * @throws {RequiredError}
295
+ * @memberof ModelsApiInterface
296
+ */
297
+ getModelDownloadHistoryRaw(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetModelDownloadHistory200Response>>;
298
+
299
+ /**
300
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
301
+ * Per-model download timeline
302
+ */
303
+ getModelDownloadHistory(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModelDownloadHistory200Response>;
304
+
235
305
  /**
236
306
  * Creates request options for getModelReadmeAt without sending the request
237
307
  * @param {string} id
@@ -258,6 +328,38 @@ export interface ModelsApiInterface {
258
328
  */
259
329
  getModelReadmeAt(requestParameters: GetModelReadmeAtRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModelReadmeAt200Response>;
260
330
 
331
+ /**
332
+ * Creates request options for listAnomalies without sending the request
333
+ * @param {number} [windowDays] Baseline distance in days. Default 7, min 1, max 365.
334
+ * @param {number} [minBaseline] Only rows where baseline downloads &gt;&#x3D; this. Filters &#x60;0→10&#x60; noise. Default 1000.
335
+ * @param {'spike' | 'drop'} [kind] Filter to one class. Omit for both.
336
+ * @param {number} [limit] Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
337
+ * @param {number} [offset] Rows to skip. Negative and non-numeric values are treated as 0.
338
+ * @throws {RequiredError}
339
+ * @memberof ModelsApiInterface
340
+ */
341
+ listAnomaliesRequestOpts(requestParameters: ListAnomaliesRequest): Promise<runtime.RequestOpts>;
342
+
343
+ /**
344
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
345
+ * @summary Anomalies in the download counter (change stream)
346
+ * @param {number} [windowDays] Baseline distance in days. Default 7, min 1, max 365.
347
+ * @param {number} [minBaseline] Only rows where baseline downloads &gt;&#x3D; this. Filters &#x60;0→10&#x60; noise. Default 1000.
348
+ * @param {'spike' | 'drop'} [kind] Filter to one class. Omit for both.
349
+ * @param {number} [limit] Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
350
+ * @param {number} [offset] Rows to skip. Negative and non-numeric values are treated as 0.
351
+ * @param {*} [options] Override http request option.
352
+ * @throws {RequiredError}
353
+ * @memberof ModelsApiInterface
354
+ */
355
+ listAnomaliesRaw(requestParameters: ListAnomaliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListAnomalies200Response>>;
356
+
357
+ /**
358
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
359
+ * Anomalies in the download counter (change stream)
360
+ */
361
+ listAnomalies(requestParameters: ListAnomaliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListAnomalies200Response>;
362
+
261
363
  /**
262
364
  * Creates request options for listDelistedModels without sending the request
263
365
  * @param {string} [since] ISO-8601 date or timestamp. Rows with last_seen_at &gt;&#x3D; since only. Use your previous poll\&#39;s newest last_seen_at to build an incremental feed.
@@ -505,6 +607,65 @@ export class ModelsApi extends runtime.BaseAPI implements ModelsApiInterface {
505
607
  return await response.value();
506
608
  }
507
609
 
610
+ /**
611
+ * Creates request options for getModelDownloadHistory without sending the request
612
+ */
613
+ async getModelDownloadHistoryRequestOpts(requestParameters: GetModelDownloadHistoryRequest): Promise<runtime.RequestOpts> {
614
+ if (requestParameters['id'] == null) {
615
+ throw new runtime.RequiredError(
616
+ 'id',
617
+ 'Required parameter "id" was null or undefined when calling getModelDownloadHistory().'
618
+ );
619
+ }
620
+
621
+ const queryParameters: any = {};
622
+
623
+ if (requestParameters['days'] != null) {
624
+ queryParameters['days'] = requestParameters['days'];
625
+ }
626
+
627
+ const headerParameters: runtime.HTTPHeaders = {};
628
+
629
+ if (this.configuration && this.configuration.accessToken) {
630
+ const token = this.configuration.accessToken;
631
+ const tokenString = await token("bearerAuth", []);
632
+
633
+ if (tokenString) {
634
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
635
+ }
636
+ }
637
+
638
+ let urlPath = `/api/v1/models/{id}/download-history`;
639
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
640
+
641
+ return {
642
+ path: urlPath,
643
+ method: 'GET',
644
+ headers: headerParameters,
645
+ query: queryParameters,
646
+ };
647
+ }
648
+
649
+ /**
650
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
651
+ * Per-model download timeline
652
+ */
653
+ async getModelDownloadHistoryRaw(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetModelDownloadHistory200Response>> {
654
+ const requestOptions = await this.getModelDownloadHistoryRequestOpts(requestParameters);
655
+ const response = await this.request(requestOptions, initOverrides);
656
+
657
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetModelDownloadHistory200ResponseFromJSON(jsonValue));
658
+ }
659
+
660
+ /**
661
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
662
+ * Per-model download timeline
663
+ */
664
+ async getModelDownloadHistory(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModelDownloadHistory200Response> {
665
+ const response = await this.getModelDownloadHistoryRaw(requestParameters, initOverrides);
666
+ return await response.value();
667
+ }
668
+
508
669
  /**
509
670
  * Creates request options for getModelReadmeAt without sending the request
510
671
  */
@@ -568,6 +729,73 @@ export class ModelsApi extends runtime.BaseAPI implements ModelsApiInterface {
568
729
  return await response.value();
569
730
  }
570
731
 
732
+ /**
733
+ * Creates request options for listAnomalies without sending the request
734
+ */
735
+ async listAnomaliesRequestOpts(requestParameters: ListAnomaliesRequest): Promise<runtime.RequestOpts> {
736
+ const queryParameters: any = {};
737
+
738
+ if (requestParameters['windowDays'] != null) {
739
+ queryParameters['window_days'] = requestParameters['windowDays'];
740
+ }
741
+
742
+ if (requestParameters['minBaseline'] != null) {
743
+ queryParameters['min_baseline'] = requestParameters['minBaseline'];
744
+ }
745
+
746
+ if (requestParameters['kind'] != null) {
747
+ queryParameters['kind'] = requestParameters['kind'];
748
+ }
749
+
750
+ if (requestParameters['limit'] != null) {
751
+ queryParameters['limit'] = requestParameters['limit'];
752
+ }
753
+
754
+ if (requestParameters['offset'] != null) {
755
+ queryParameters['offset'] = requestParameters['offset'];
756
+ }
757
+
758
+ const headerParameters: runtime.HTTPHeaders = {};
759
+
760
+ if (this.configuration && this.configuration.accessToken) {
761
+ const token = this.configuration.accessToken;
762
+ const tokenString = await token("bearerAuth", []);
763
+
764
+ if (tokenString) {
765
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
766
+ }
767
+ }
768
+
769
+ let urlPath = `/api/v1/market/anomalies`;
770
+
771
+ return {
772
+ path: urlPath,
773
+ method: 'GET',
774
+ headers: headerParameters,
775
+ query: queryParameters,
776
+ };
777
+ }
778
+
779
+ /**
780
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
781
+ * Anomalies in the download counter (change stream)
782
+ */
783
+ async listAnomaliesRaw(requestParameters: ListAnomaliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListAnomalies200Response>> {
784
+ const requestOptions = await this.listAnomaliesRequestOpts(requestParameters);
785
+ const response = await this.request(requestOptions, initOverrides);
786
+
787
+ return new runtime.JSONApiResponse(response, (jsonValue) => ListAnomalies200ResponseFromJSON(jsonValue));
788
+ }
789
+
790
+ /**
791
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
792
+ * Anomalies in the download counter (change stream)
793
+ */
794
+ async listAnomalies(requestParameters: ListAnomaliesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListAnomalies200Response> {
795
+ const response = await this.listAnomaliesRaw(requestParameters, initOverrides);
796
+ return await response.value();
797
+ }
798
+
571
799
  /**
572
800
  * Creates request options for listDelistedModels without sending the request
573
801
  */
@@ -862,6 +1090,14 @@ export class ModelsApi extends runtime.BaseAPI implements ModelsApiInterface {
862
1090
 
863
1091
  }
864
1092
 
1093
+ /**
1094
+ * @export
1095
+ */
1096
+ export const ListAnomaliesKindEnum = {
1097
+ Spike: 'spike',
1098
+ Drop: 'drop',
1099
+ } as const;
1100
+ export type ListAnomaliesKindEnum = typeof ListAnomaliesKindEnum[keyof typeof ListAnomaliesKindEnum];
865
1101
  /**
866
1102
  * @export
867
1103
  */